Target Language Compiler    

Advanced External Mode Exercise

Starting with the model simple, add a Constant block (value of constant set to zero). Add a Stop Simulation block (Sinks) downstream from the Constant block. Save this model as simple_s.mdl.

  1. Set the Stop Time to 200,000. From the Code Generation Options dialog box, select External mode and Verbose builds. Save the model as simple_s.mdl. Generate and build the executable. Be sure to select limit rows to last 1,000. (Workspace I/O page)
  2. Before running the executable, look at the Simulation menu items that specify external mode. You'll need to observe the following sequence:

This starts the standalone simulation. Then, it starts Simulink's external mode and allows you to change model parameters in the generated code automatically. Although it is not obvious on your computer, the underlying mechanism allows parameter changes to generated code even if running on target hardware. The only requirement in such an application is that your external hardware must provide TCP/IP support. For example, TCP/IP stack or library that you can link against during the build process.

Observe messages in the DOS window regarding updating of parameters.

When you complete this example, go to the Simulink menu or External Mode Control Panel and select Disconnect, and then select Normal to resume normal simulation mode.


 Simulink External Mode and GRT Loop Rolling Through a TLC File