xPC Target | ![]() ![]() |
Parameter Tuning with Simulink External Mode
You use Simulink external mode to connect your Simulink block diagram to your target application. The block diagram becomes a graphical user interface to your target application. You set up Simulink in external mode to establish a communication channel between your Simulink block window and your target application.
In Simulink external mode, wherever you change parameters in the Simulink block diagram, Simulink downloads those parameters to the target application while it is running. This feature lets you change parameters in your program without rebuilding the Simulink model to create a new target application.
After you download your target application to the target PC, you can connect your Simulink model to the target application. This procedure uses the Simulink model xpcosc.mdl
as an example, and assumes you have created and downloaded the target application for that model.
All of the current Simulink model parameters are downloaded to your target application. This downloading guarantees the consistency of the parameters between the host model and the target application.
The target PC displays the following message.
ExtM: Updating # parameters
+tg or tg.start or start(tg)
The target application begins running on the target PC, and the target PC displays the following message.
System: execution started (sample time: 0.000250)
As soon as you change a model parameter and click OK or the Apply button on the Block Parameters: Gain1 dialog box, all of the changed parameters in the model are downloaded to the target application, as shown below.
The Simulink model is disconnected from the target application. Now, if you change a block parameter in the Simulink model, there is no effect on the target application. Connecting and disconnecting Simulink works regardless of whether the target application is running or not.
stop(tg) or -tg
The target application on the target PC stops running, and the target PC displays the following messages.
System: execution stopped minimal TET: 0.000023 at time 1313.789000 maximal TET: 0.000034 at time 407.956000
![]() | Parameter Tuning with MATLAB Commands | Advanced Procedures | ![]() |