Tune and Monitor the Model Running on VEX EDR V5 Robot Brain

Overview of Monitor and Tune

You can use Monitor and Tune feature (also called External mode) in Simulink Editor to tune parameters and monitor a model running on your target hardware.

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

Monitor and Tune accelerates parameter tuning because you do not have to rerun the model each time you change parameters. You can also use Monitor and Tune to 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.

You can use Monitor and Tune in Simulink® Coder™ Support Package for VEX® EDR V5 Robot Brain along with the Simulation Data Inspector (SDI) for tuning and monitoring signals in the model.

Preparing Simulink Model for Monitor and Tune

The workflow for preparing the Simulink model for using the Monitor and Tune includes these steps:

  1. For the signals that you would like to visualize, mark them for data logging. To do this, select the signal, open its context menu, and click the icon corresponding to Enable Data Logging.

    For instructions on logging the signal using other methods, refer to Mark a Signal for Logging. Simulink displays a logged signal indicator for each logged signal.

  2. (Optional) Place one or more sink blocks in your model, and then configure the signals connected to them also for logging. For example, connect Display or Scope blocks and mark the signals connected to them for logging.

  3. Connect the VEX EDR V5 Robot Brain hardware to your host computer.

Setting the Configuration Parameters for Monitor and Tune

  1. Configure the Model Configuration Parameters to set the Hardware Board as VEX EDR V5 Robot Brain, as explained in Hardware Implementation Pane Overview.

  2. In the Model Configuration Parameters dialog box, under Hardware board settings > Target Hardware Resources, select External Mode tab.

  3. For setting the COM port automatically, choose the option Automatically for the Set host COM port parameter.

    For setting the COM port manually, choose the option Manually for the Set host COM port parameter.

  4. If you choose the option Manually, specify the corresponding COM port (VEX User Port) in the COMPort field.

    • To find the COM port on your Windows® computer, select Start > Control Panel > Device Manager > Ports (COM & LPT).

    • To find the COM port on your Mac computer, open a terminal window and enter the following command:

      ls /dev/cu.usb*.

      This command lists the path and file name of the USB device that is connected to the VEX hardware. The required COM port corresponds to VEX V5 User Port.

  5. Ensure that you select the Verbose check box to view the external mode execution progress and updates in the Diagnostic Viewer or in the Command Window.

  6. Click Apply and then OK to close the Model Configuration Parameters dialog box.

Running the Simulink Model in External Mode and Tuning the Parameters

  1. Go to Hardware tab.

  2. Set a value for the Simulation stop time parameter. The default value is 10.0 seconds. To run the model for an indefinite period, enter inf.

  3. Click on Monitor & Tune to run the model on external mode.

    Simulink automatically:

    • Runs the model on the target hardware (VEX EDR V5 Robot Brain).

    • Runs the model on the host computer for Monitor and Tune operation.

    • Creates a real-time connection between the model on target hardware and the model on the host computer.

  4. Click the Simulation Data Inspector icon () on the Simulink toolbar to open the Simulation Data Inspector dialog box. You can view the logged signal data that the Monitor and Tune action sends from target hardware to the blocks in the model on the host computer. For more details about inspecting and comparing data, refer to Simulation Data Inspector.

  5. Change the parameter values in the Simulink model.

    In the Simulation Data Inspector, observe the corresponding changes in the model running on the hardware.

  6. Find the optimal parameter values by making adjustments and observing the results in the Simulation Data Inspector.

  7. After you are satisfied with the results, save the new parameter values, disable External mode, and save the model.


Monitor and Tune increases the processing burden of the model running on the target hardware. If the software reports an overrun, stop Monitor and Tune.

Stopping External Mode

To stop the model running Monitor and Tune operation, click the Stop icon on the Simulink toolbar ().

If the Simulation stop time parameter is set to a specific value, Monitor and Tune stops when that time elapses.