Execute Real-Time Application in Simulink External Mode by Using Step-by-Step Commands
Control of the real-time application with Simulink® is limited to connecting a Simulink model to a real-time application through external mode, and then starting the real-time application. Using Simulink external mode is one method to tune parameters.
The model connects to the target computer that you have selected in the Simulink Editor on the Real-Time tab.
To avoid target computer communication issues, do not use Simulink external mode while Simulink Real-Time™ Explorer is running. Use only one interface.
After you build and download a real-time
application to the
target computer, you can run the
real-time application. This
procedure uses the Simulink model
slrt_ex_osc_rt. To open the model, in the
MATLAB® Command Window, type:
openExample('slrealtime/SlrtCreateAndRunRealTimeAppFromSimulinkModelExample', ... 'supportingFile','slrt_ex_osc_rt.slx')
For more information about building applications, see Build and Download Real-Time Application by Using Run on Target.
You must already have specified the required target computer environment. Specifically, in the Simulink Editor, from the target computers list on the Real-Time tab, you must select the target computer to which you want to connect.
In the Simulink Editor, connect to the target computer. In the Real-Time tab, click Toggle target computer connection. The connection status toggles to the connected state .
Click the Run on Target pull down.
To start the Step by Step Commands, select Build Application. This build operation produces the same real-time application MLDATX files as are produced by using the
After the model build completes, from the Run on Target pull down, select Deploy to Target.
After the real-time application deploys to the target, from the Run on Target pull down, select Connect Model.
After you connect the model to the real-time application, the status bar displays External to indicate that the model is ready for external mode simulation. In this mode, the model serves as the interface to the application. This connection permits tuning parameters in the real-time application without rebuilding the application. This connection also permits observing signal activity in the real-time application by using, for example, Simulink Scope blocks in the model.
From the Run on Target pull down, select Start Application.
The current Simulink model parameters are downloaded from the development computer to the real-time application. The real-time application begins running and the Simulink Scope block displays signal data.
To stop the execution, from the Run on Target pull down, select Stop Application.
When the real-time application is deployed to the target computer, the step-by-step commands provide additional workflow options.
In the Step by Step Commands, after you deploy the real-time application to the target computer, you can connect the model to the real-time application. The Connect Model operation enables you to use the model as an interface to the real-time application for external mode simulation.
In the Step by Step Commands, after you connect the model to the real-time application on the target computer, you can disconnect the model from the real-time application. The Disconnect Model operation enables you to keep the real-time simulation running on the target computer and reconnect to the model at a later time.
In the Step by Step Commands, after you deploy the real-time application to the target computer and connect the model to the real-time application, you can start the real-time application. The Start Application operation enables you to start the real-time application for external mode simulation.
Before you start the application, you can select
the AutoImportFileLog option from the Run
on Target button. This checkbox corresponds to the
When you are connected in external mode, to restart the real-time
application from time