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 the real-time application for the target computer. Click Run on Target > Build Application.
Deploy the real-time application to the target computer. Click Run on Target > Deploy to Target.
Connect to the target computer and run the real-time application. In the MATLAB Command Window, use the
tg = slrealtime
command, then use thestart(tg)
command.Open the Simulation Data Inspector. In the MATLAB Command Window, use the
Simulink.sdi.view
command.In the Simulation Data Inspector, drag the MuxOut(1) signal to the top display and drag the MuxOut(2) signal to the bottom display.
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
, andC
with their values.
Modify Parameter Values
To update a parameter value:
Select the parameter value for the
Amplitude
parameter and change the value to0.5
.Select the parameter value for the
Frequency
parameter and change the value to15
.For multidimensional parameters, you can click the parameter value to view and edit the values on the SLRT Explorer.
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 the description of Tune Parameters by Using Hold Updates and Update All Parameters in Tune Parameters by Using Simulink® External Mode.
Related Topics
- Simulink Real-Time Operation Modes
- Filter Hierarchical List of Signals and Parameters in Simulink Real-Time Explorer
- Tune Parameters by Using Simulink® External Mode
- Troubleshoot Parameters Not Accessible by Name
- Save and Reload Parameters by Using Simulink Real-Time Explorer
- Save and Reload Parameters by Using the MATLAB Language