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:
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.
(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.
Connect the VEX EDR V5 Robot Brain hardware to your host computer.
Setting the Configuration Parameters for Monitor and Tune
Configure the Model Configuration Parameters to set the Hardware Board as VEX EDR V5 Robot Brain, as explained in Hardware Implementation Pane Overview.
In the Model Configuration Parameters dialog box, under Hardware board settings > Target Hardware Resources, select External Mode tab.
For setting the COM port automatically, choose the option
Automaticallyfor the Set host COM port parameter.
For setting the COM port manually, choose the option
Manuallyfor the Set host COM port parameter.
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:
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.
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.
Click Apply and then OK to close the Model Configuration Parameters dialog box.
Running the Simulink Model in External Mode and Tuning the Parameters
Go to Hardware tab.
Set a value for the Simulation stop time parameter. The default value is
10.0seconds. To run the model for an indefinite period, enter
Click on Monitor & Tune to run the model on external mode.
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.
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.
Change the parameter values in the Simulink model.
In the Simulation Data Inspector, observe the corresponding changes in the model running on the hardware.
Find the optimal parameter values by making adjustments and observing the results in the Simulation Data Inspector.
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.