Choose from several deployment approaches based on application requirements, prototyping or production environment, and your current phase of the development process. If want to run fast, standalone simulations, such as batch or Monte Carlo simulations on you development computer, build an executable with the rapid simulation (RSim) target. Another method of accelerating simulations is to generate an S-function block for use in another model. In addition to improving simulation speed, this approach reuses code and protects intellectual property.
With an external mode simulation, you create a communication channel between your development computer and a target processor that runs the executable file created by the code generation and build process. Through the communication channel, you can modify parameter values for the target program, and monitor and store signal data from the target program.
If real-time response is critical, build and deploy an executable program. Build the program from a component that controls a system or from a model that represents a system being controlled. In the component case, you build, deploy, and tune code as it runs on a real-time simulator or microprocessor. For a test environment, you build and download an executable program to a model to a hardware-in-the-loop (HIL) simulation platform. After setting up the environment, run the executable program to validate the system or control unit in real time.
Connectivity – Hardware
|Describe API details|
|Describe API implementation details|
|Provide hardware board details|
|Describe C and C++ build dependencies to associate with target hardware|
|Capture system command for execution on MATLAB computer|
|Describe data I/O details for target hardware|
|Describe communication protocol parameters|
|Provide C and C++ compiler implementation details|
|Base class for target types|
|Provide target processor information|
Connectivity – Communication Channel
Connectivity – XCP (
|Represent external mode protocol stack|
|Base class for external mode connectivity options|
|Describe XCP protocol stack for target hardware|
|Represent connectivity options in external mode protocol stack|
|Specify XCP platform abstraction layer for target hardware|
|Represent XCP serial transport protocol layer|
|Represent XCP TCP/IP transport protocol layer|
|Base class for XCP transport protocol layer|
Connectivity – XCP Custom Slave
|Perform external mode background activity|
|External mode event trigger|
|Get final simulation time for external mode platform abstraction layer|
|Initialize external mode target connectivity|
|Extract values of configuration parameters supported by external mode abstraction layer|
|Reset external mode target connectivity|
|Set final simulation time in external mode platform abstraction layer|
|Check that external mode simulation is complete|
|Check whether request to stop external mode simulation is received from model|
|Wait for request from development computer to start or stop external mode simulation|
|Manage target hardware information|
|Run on Custom Hardware||Run external mode simulations|
|Generated S-Function||Represent model or subsystem as generated S-function code|
Rapid Prototyping Considerations
For application integration points, characterize external code, identify code generation integration requirements, and choose a workflow.
Deploy algorithm model for testing in real time.
Use of untrusted custom code entails risk.
Accelerate simulation of a model in nonreal-time on your development computer.
This example shows how to use the RSim system target file to run simulations over a range of parameter values.
This example shows how to run batch simulations without recompiling the generated code.
This example shows how the code generator RSim -i option lets you use a MAT-file as the input data source for Inport blocks for rapid simulations.
Reusable Component Deployment
Generate a shared library from a model or subsystem that you can load dynamically into another application.
Generate a shared library that you can load dynamically into another application.
Apply Generate S-Function operation to create an S-Function from a subsystem block.
External Mode Simulation
Tune parameters and monitor signals through communication channel between development computer and target hardware.
Run external mode simulations that use an XCP communication channel.
Hardware tab and External Mode Control Panel controls for XCP external mode simulations.
target package to provide connectivity between Simulink® and target hardware.
Customize XCP slave software for target hardware.
Run external mode simulations that use a TCP/IP or serial communication channel.
Create custom low-level communications layer to support an external mode connection to your custom target.
Deploy environment model for testing in real time.