Tune and Monitor Model Running on PandaBoard Hardware

About External Mode

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

External mode enables you to tune model parameters and evaluate the effects of different parameter values on model results in real-time, in order to find the optimal values to achieve desired performance. This process is called parameter tuning.

External mode accelerates parameter tuning because you do not have to re-run the model each time you change parameters. External mode also lets you develop and validate your model using the actual data and hardware for which it is designed. This software-hardware interaction is not available solely by simulating a model.

The following list provides an overview of the parameter tuning process with External mode:

  • In the model on your host computer, you enable External mode in the Configuration Parameters.

  • In the model on your host computer, you tell Simulink® software to run your model on the target hardware.

  • Simulink software runs the model on the target hardware.

  • You use the model on the host computer as a user interface for interacting with the model running on the target hardware:

    • When open blocks and apply new parameter values on the host computer, External mode updates the corresponding values on target hardware.

    • If your model contains blocks for viewing data, such as Scope or Display blocks, External mode sends the corresponding data from the target hardware to those blocks on the host computer.

  • You determine the optimal parameter values by adjusting parameter values on the host computer and observing data/outputs from the target hardware.

  • When you are finished, you save the new parameter values, disable External mode, and save the model.

Run Your Simulink Model in External Mode

  1. Create a network connection between the PandaBoard hardware and your host computer. See Configure Network Connection with PandaBoard Hardware

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

  3. Set the Simulation stop time parameter, located to the left of Simulation mode on the model toolbar. The default value is 10.0 seconds. To run the model for an indefinite period, enter inf.

  4. Click the Run button.

    If your model does not contain a sink block, the MATLAB® Command Window displays a warning message. For example:

    Warning: No data has been selected for uploading. 
    > In C:\Program Files (x86)\MATLAB\R2013a Student1\toolbox\
    extModeAutoConnect at 17
    In C:\Program Files (x86)\MATLAB\R2013a Student1\toolbox\
    realtime\realtime\sl_customization.p>myRunCallback at 149

    You can disregard this warning or add a sink block to the model.

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

  5. While the model is running in External mode, you can change parameter values in the model on your host computer and observe the corresponding changes in the model running on the hardware.

    If your model contains blocks from the Simulink Sinks block library, the sink blocks in the model on your host computer display the values generated by the model running on the hardware.

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

    Note:   If you have the Embedded Coder® or Simulink Coder™ products, you can use External mode with a model that contains Model blocks (uses the "Model reference").

Stop External Mode

To stop the model 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.

Was this topic helpful?