Main Content

Tips for Running Apps on Simulink Normal Mode Target

While developing an App Designer instrument panel for a Simulink® Real-Time™ model, it can help to test the instrument panel in normal mode simulation by using the Simulink Normal Mode target. This target performs differently than a physical target computer when running a Simulink Real-Time application due to normal mode support limitations for these apps.

When you choose the Simulink Normal Mode target, the instrument panel app interfaces with the model in normal mode simulation. Follow these steps to address workflow requirements and support limitations that come with using normal mode simulation to test your App Designer instrument panel.

Use a TargetSelector UI Component to Select the Simulink Normal Mode Target

To use the Simulink Normal Mode target with your App Designer app, add a TargetSelector UI component to the app. This component lets you select the target and connect to your model for normal mode simulation instead of connecting to a real-time application on a target computer for external mode simulation. Set the TargetSource property value to the slrealtime.ui.control.TargetSelector object for all components in the app.

The Simulink Normal Mode target is available from the Target Selector drop down list.

Use the LoadButton UI Component to Load the Model

When you run the app and select the Simulink Normal Mode target, the text on the LoadButton UI component changes to Load Model. Use this button to connect the model to the app for normal mode simulation in Simulink. During the load, parameter values in the app are updated from the current values in the model.

The target computer system log does not display messages when using the Simulink Normal Mode target. You can view relevant Simulink messages in the Diagnostic Viewer.

Use the StartStopButton UI Component to Start the Simulation

To start or stop the simulation on the Simulink Normal Mode target, use the StartStopButton UI component in the app. Do not use other interfaces, such as the Real-Time tab in the Simulink editor, to start or stop the simulation.

Consider Limitations on Normal Mode Simulation in the App

Consider these issues before using the Simulink Normal Mode target.

  • Signals inside referenced models are not supported for the Simulink Normal Mode target. UI components in the app that you bind to these signals do not display data when you simulate the model in normal mode.

  • Sample times may differ when simulating the Simulink Normal Mode target instead of simulating with generated code and a real-time application.

  • To better simulate on the Simulink Normal Mode target and for smoother operation of the instrument panel app, set Simulation Pacing Options for the model.

  • If your model uses custom code to manipulate parameters, make sure that your code takes into account the difference in parameter data types between the model and the real-time application. In a model, all parameters are strings. In a real-time application, all parameters are numeric data types. This difference may cause your code to error when switching to Simulink normal mode simulation when the parameters become strings instead of numbers.

  • If your model has a MATLAB® observer configured for a signal, the app cannot create a MATLAB observer for that signal. The signal does not stream to the app.

  • If a UI control is bound to a parameter value, changes to that parameter value in the model, such as changing the value in the Block Parameter dialog box, are not reflected in the app. The bound UI control continues to show the previous parameter value.

See Also

| |

Related Topics

External Websites