Tune Parameters and Monitor Data in Model Running on Target Hardware

Using External Mode

You can use External mode to tune parameters and monitor a model running on your target hardware.

You can tune model parameters and evaluate the effects of different parameter values on model results in real time. Doing so helps you find the optimal values for performance. This process is called parameter tuning.

External mode accelerates parameter tuning because you do not have to rerun the model each time you change parameters. You can also use External mode to develop and validate your model using the actual data and hardware for which it is designed.

This workflow lists the tasks usually required to tune parameters with External mode:

  1. In the model on your host computer, enable External mode.

  2. (Optional) Place sink (Simulink) blocks in your model and connect them to signals. For example, use Display or Scope blocks to visualize data, or use a To File block to log signal data.

  3. Run the model on the target hardware in External mode.

  4. (Optional) Observe signals from target hardware using Display or Scope blocks on your host computer.

  5. Change and apply parameter values in the model on your host computer.

  6. Find the optimal parameter values by making adjustments and observing the results.

  7. Save the new parameter values, disable External mode, and save the model.

Run Your Simulink Model in External Mode

  1. Configure and run your Simulink® model on the target hardware.

    This step verifies that the model is configured correctly and that the connection to the target hardware works.

  2. On the Simulink model toolbar, set Simulation mode to External.

  3. Set the Simulation stop time parameter, located to the left of Simulation mode.

    The default value is 10.0 seconds. To run the model for an indefinite period, enter inf.

  4. (Optional) To log data from the model while it is running on the target hardware:

    • Select Simulation > Output > Configure Data Logging. Then, select the signal to log. In the Simulink editor, right-click the signal line and select Properties > Log signal data.

    • Connect a To File or To Workspace block to a signal in the model.

  5. (Optional) To display data from the model while it is running on the target hardware, connect a Display, Floating Scope, or Scope block to a signal in the model.

  6. Click the Run button.

    If your model does not contain a sink block, the Message Viewer displays a warning that “No data has been selected for uploading.” You can disregard this warning or add a sink block to the model.

    After several minutes, Simulink starts running your model on the board.

  7. In the model on your host computer, change parameter values.

    Observe the corresponding changes in the model running on the hardware.

    Any Simulink sink blocks in your model receive data from the hardware and display it on your host computer.


External mode increases the processing burden of the model running on the board. If the software reports an overrun, disable External mode.

Stop External Mode

To stop the model that is running in External mode, click the Stop button located on the model toolbar.

If the Simulation stop time parameter is set to a specific number of seconds, External mode stops when that time elapses.

When you are finished using External mode, set Simulation mode back to Normal.