Main Content

Tune Parameter During Program Execution

Interact with a generated executable program while the program runs in nonreal time on your development computer by tuning a parameter and observing the results.

Configure Data Accessibility and Communication Channel

This part of the tutorial assumes that you have configured your copy of example model rtwdemo_secondOrderSystem as described in Configure Model for Verification.

Build and Run Executable Program

  1. To allow time for you to monitor changes that you make to the parameter, set the simulation stop time to Inf. In the Simulink® Editor, click the Hardware tab. In the Stop Time field, set the simulation stop time to Inf.

  2. Click Monitor & Tune. The software:

    1. Builds the executable program.

    2. Deploys the program as a separate process on your development computer.

    3. Connects the Simulink model to the program.

    4. Runs the model executable program code.

To stop the simulation, in the Hardware tab, click Stop.

Tune Parameter and Observe Results

Experiment with the value of a block parameter during execution. Observe the impact of the change.

While the executable program is simulating on your development computer, in the model canvas, use the Knob block to change the value of the damping gain. For example, change the value to 600. Observe:

  • The changes in the plot are displayed in the Dashboard Scope block.

  • On the Hardware tab, open the Model Data Editor by clicking Tune Parameters.

Next, package the generated program code and artifacts for deployment.