Main Content

External Mode Simulation of Deployed Applications

R2026b

You can use the Linux Runtime Manager app to deploy the models that you configure for external mode. The app supports external mode simulation by establishing a communication channel between the Simulink® model on your development computer (host) and the application running in a Docker container on the Linux target.

For more information about external mode simulation, see External Mode Simulations for Parameter Tuning, Signal Monitoring, and Code Execution Profiling. For more information about deploying a model to a target computer, see Build Simulink Model and Deploy Application.

To perform external mode simulation of a deployed application, follow these steps.

  1. Open a software component model or a DDS Blockset model.

  2. Set the Hardware board configuration parameter in the Hardware Implementation to:

    • Embedded Coder Linux Docker Container for x86_64 targets.

    • Embedded Coder Linux Docker Container - ARM64 for ARM targets.

  3. Enable the XCP service for the model by using the linux.setXCPServiceConfiguration function. For example, to enable the XCP service with a specific TCP port and target computer:

    linux.setXCPServiceConfiguration("myModel", TCPPort=12345, Target="LinuxTarget3");

    To enable the XCP service with default settings:

    linux.setXCPServiceConfiguration("myModel");

    Note

    Ensure that the specified TCP port is not blocked by a firewall on the target machine.

  4. Enable the External mode option in Code Generation > Interface.

  5. To log signals, select the signals you want to log and click Log Signals in the Simulation > Prepare section.

  6. Open the Linux Runtime Manager from the Simulink apps gallery. Alternatively, enter this command at the MATLAB® Command Window.

    linuxRuntimeManager

  7. Deploy the model on the Linux target machine. For more information, see Build Simulink Model and Deploy Application.

  8. Select the model in the Linux Runtime Manager and click the Monitor & Tune button to start the application and begin an external mode simulation.

    Alternatively, use this command:

    startMonitorAndTune(tg,<applicationName>);
  9. Tune parameters by using Dashboard blocks such as Slider, Knob, and Radio Button, or by changing block parameters directly. View signals by using Dashboard blocks such as Gauge and Scope, or use the Simulation Data Inspector.

To stop the external mode simulation, select the application and click Stop Monitor & Tune. Alternatively, select the application and click Stop Application to stop the running application.

Programmatically, use this command:

tg.stopMonitorAndTune(<applicationName>);

Note

For a DDS Blockset model, enter the target details in the MEX-file arguments section of Code Generation > Interface > External mode configuration. For more information, see MEX-file arguments.

External Mode Simulation Using Hardware Tab

Simulink Coder™ enables you to perform external mode simulation for an AUTOSAR adaptive model and DDS model using the Hardware tab in the toolstrip.

To perform external mode simulation using the Hardware tab, follow these steps.

  1. Open a software component model or a DDS Blockset model.

  2. Enable the External mode option in the Code Generation > Interface section in the configuration settings of the model.

    This enables the Hardware tab of the model.

  3. On the Hardware tab, set the Board option to Embedded Coder Linux Docker Container.

    Hardware tab in the Simulink toolstrip showing Board option set to Embedded Coder Linux Docker Container.

  4. Select Open Linux Runtime Manager for the Connection option.

    This opens the Linux Runtime Manager application.

  5. In the Linux Runtime Manager application, specify the fields in the Target Configuration section.

  6. On the Hardware tab, click the Monitor and Tune button in the Run on Hardware section.

This deploys the application to the specified target and starts external mode simulation.

See Also

| |

Topics