Main Content

Tune Parameters by Using Simulink Real-Time Explorer

You can use Simulink® Real-Time™ Explorer to change parameters in your real-time application while it is running or between runs. You do not need to rebuild the Simulink model, set the Simulink interface to external mode, or connect the Simulink interface with the real-time application.

This procedure uses the model slrt_ex_osc.

Set Up the Simulation Data Inspector

Before tuning parameter values, set up the Simulation Data Inspector:

Open the Simulation Data Inspector ().

Click Layout ().

Select two horizontal displays.

Open model slrt_ex_osc. Set property Stop time to inf. In the Simulink Editor, on the Real-Time tab, select Run on Target > Stop Time and set Stop Time to inf.

Connect to the target computer. Toggle the Disconnected indicator to Connected.

Build and download the real-time application to the target computer. Click Run on Target.

In the Simulation Data Inspector, drag the MuxOut(1) signal to the top display and drag the MuxOut(2) signal to the bottom display.

Image of the Simulation Data Inspector with initial values (before tuning)

View Initial Parameter Values

To view the initial parameter values:

Open Simulink Real-Time Explorer. On the Real-Time tab, click Prepare > SLRT Explorer.

Select the Parameters tab. The tab lists parameters Amplitude, Frequency, A, and C with their values.

Modify Parameter Values

To update a parameter value:

Select the parameter value for the Amplitude parameter and change the value to 0.5.

Select the parameter value for the Frequency parameter and change the value to 15.

After each change, the signal display in the Simulation Data Inspector alters to match the effect of the parameter change. You can change multiple parameters at the same time by using The Hold Updates button. For more information, see Tune Parameters by Using Hold Updates and Update All Parameters.

Related Topics