External Mode Simulations for Parameter Tuning, Signal Monitoring, and Code Execution Profiling - MATLAB & Simulink (original) (raw)

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:

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.

Communication Mechanisms for External Mode

Simulink supports two communication mechanisms for external mode simulation. To decide which mechanism to use, see the information in this table.

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 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 library Yes No
Floating Scope, Scope Yes Yes
Spectrum Analyzer, Time Scope (DSP System Toolbox™) Yes Yes
Display Yes Yes
To Workspace Yes Yes
User-written S-Function. A method, which enables user-written blocks to support external mode, is built into the S-function API. See_matlabroot_/simulink/include/simstruc.h. Yes Yes
Record Yes Yes
Signal Viewing Subsystem Yes Yes

External Mode Simulations by Using the Run on Custom Hardware App

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:

  1. Build the target application on your development computer.
  2. Deploy the target application to the target hardware.
  3. Connect Simulink to the target application that runs on the target hardware.
  4. 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 Yes, if you set up connectivity between Simulink and your target hardware.
Step-by-step Build for Monitoring Yes Yes. Software builds target application on development computer by using the toolchain that you specify.
Deploy Yes Yes, if you set up connectivity between Simulink and your target hardware.
Connect Yes Yes
Start Yes Yes

External Mode Control Panel

Using the External Mode Control Panel, you can perform some of the functions that the Run on Custom Hardware app provides, for example, Connect,Start, and Disconnect. You can also open the External Signal & Triggering dialog box, which enables you to:

For details, see XCP panel or TCP/IP and serial panel.

Security for External Mode Simulations

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.

See Also

Topics