You can use external mode simulations for rapid prototyping. An external mode simulation establishes a communication channel between Simulink® on your development computer (host) and the target hardware that runs the executable file created by the code generation and build process.
Through the communication channel, you can:
Modify or tune block parameters in real time. When you change parameters in your model, Simulink downloads the new values to the executing target application.
Monitor and save signal data from the executing target application.
The low-level transport layer of the channel handles the transmission of messages. Simulink and the generated model code are independent of this layer. The transport layer and its interface code are isolated in separate modules that format, transmit, and receive messages and data packets.
Simulink supports two communication mechanisms for external mode simulation. To decide which mechanism to use, see the information in this table.
Communication Mechanism | Supports | Reasons for Selecting Communication Mechanism |
---|---|---|
XCP, the Universal Measurement and Calibration Protocol | ERT and GRT system target files. Some Simulink support packages. For details, see https://www.mathworks.com/hardware-support.html?q=&page=1. | XCP external mode:
For information about running XCP external mode simulations, see:
|
TCP/IP and serial (RS-232) | ERT, GRT, and RSim system target files. Simulink support packages. | You do not use the Simulation Data Inspector for visualizing, exporting, and saving data. You want to use signal triggering. For information about running TCP/IP and serial external mode simulations, see:
|
This table summarizes feature support for both forms of external mode simulations.
Feature | XCP Support | TCP/IP and Serial Support | |
---|---|---|---|
Parameter tuning | With Dashboard blocks | Yes | Yes |
Of tunable (Simulink) block parameters | Yes | Yes | |
Simulation Data Inspector | Yes. Includes signals within referenced models. | No | |
Logic Analyzer | Yes. Includes signals within referenced models. | No | |
Blocks that receive and display signals from target application | Dashboard | Yes | No |
Floating Scope, Scope | Yes, provided signal logging is enabled for block input. | Yes | |
Spectrum Analyzer, Time Scope (DSP System Toolbox™) | Yes, provided signal logging is enabled for block input. | Yes | |
Display | Yes, if signal logging is enabled for block input. | Yes | |
To Workspace | Yes, if signal logging is enabled for block input. | Yes | |
User-written S-Function. A method, which enables user-written blocks to support external mode, is built into the S-function API. See
| Yes, if signal logging is enabled for block input. | Yes | |
XY Graph | Yes, if signal logging is enabled for block input. | Yes | |
Yes, if signal logging is enabled for subsystem input. | Yes |
To run external mode simulations on your development computer or target hardware that is not supported by MathWorks® support packages, use the Run on Custom Hardware app. For an external mode simulation, you:
Build the target application on your development computer.
Deploy the target application to the target hardware.
Connect Simulink to the target application that runs on the target hardware.
Start execution of generated code on the target hardware.
With the app, you can perform the steps separately or by using one-click. This table shows the workflow support that the app provides for your target hardware.
Workflow Feature or Task | Target Hardware | ||
---|---|---|---|
Development Computer | Custom Hardware | ||
One-click | Yes | No, unless you register custom launcher in Simulink. | |
Step-by-step | Build for Monitoring
| Yes | Yes. Software builds target application on development computer by using the toolchain that you specify. |
Deploy
| Yes | No, unless you register custom launcher in Simulink. Deploy target application manually. | |
Connect
| Yes | Yes | |
Start
| Yes | Yes |
Ensure that access to your development computer and the target hardware is secure.
Provide a secure communication channel between your development computer and the target application by applying the security measures listed in this table.
Communication Protocol | Security Measure |
---|---|
XCP on TCP/IP, TCP/IP | Run your development computer and target application within a trusted private network or virtual private network (VPN). |
XCP on serial, serial | Use a point-to-point link between your development computer and target application, for example, a serial cable. |
Before generating code for production, to reduce the risk of unintended access to the target application, disable external mode settings.