Tune Parameters and Monitor Data in Model Running on Target Hardware
Monitor and Tune Feature
You can use the Monitor and Tune feature (also called External mode) to tune parameters and monitor a model running on your target hardware in real time.
When you change parameter values from within Simulink®, the modified parameter values are communicated to the target hardware immediately. Also, you can monitor the effects of the parameters tuning activity by viewing the algorithm signals on the scopes. Doing so helps you find the optimal values for performance. This process is called parameter tuning.
Performing the Monitor and Tune action accelerates parameter tuning because you do not have to rerun the model each time you change parameters. You can also use the feature to develop and validate your model using the actual data and hardware for which it is designed.
Run Your Simulink Model for Parameter Tuning
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.
In the Simulation tab, set the Stop Time parameter.
The default value is
10.0
seconds. To run the model for an indefinite period, enterinf
.To log data from the model while it is running on the target hardware:
Select one or more signals in the model.
In the Signal tab, click Log Signals.
The logging badge marks logged signals in the model.
We recommend you to log data by streaming them to the Simulation Data Inspector rather than by using Scope blocks for the following reasons.
Streaming does not store data in memory, making more efficient use of the memory available on the hardware. Scope blocks store data in buffers before sending the data to the host.
You can stream signals from top models and reference models simultaneously. Scope blocks can only log signals from a top-level model.
In the Hardware tab, click Monitor & Tune.
When the simulation completes, the Simulation Data Inspector button appears highlighted to indicate that new simulation data is available in the Simulation Data Inspector.
To view the new simulation data, click the Simulation Data Inspector button. A new simulation run appears in the Inspect pane.
Change and apply parameter values in the model on your host computer.
Observe the corresponding changes in the simulation output.
Stop Signal Monitoring and Parameter Tuning
To stop signal monitoring and parameter tuning, click Stop in the Hardware tab.
If the Stop Time parameter is set to a specific number of seconds, the signal monitoring stops when that time elapses.