User`s guide

3 Working with Real-Time Workshop
3-50
Part 4: Tuning Parameters
You can change the gain factor of either Gain block by assigning a new value
to the variables
A or B in the MATLAB workspace. When you change block
parameter values in the workspace during a simulation, you must explicitly
update the block diagram with these changes. When the block diagram is
updated, the new values are downloaded to the target program. To tune the
variables
A and B,
1 In the MATLAB Command Window, assign new values to both variables,
for example:
A = 0.5;B = 3.5;
2 Activate the extmode_example model window. Select Update Diagram
from the
Edit menu, or press the Ctrl+D keys. As soon as Simulink has
updated the block parameters, the new gain values are downloaded to the
target program, and the effect of the gain change becomes visible on the
scopes.
You can also enter gain values directly into the Gain blocks. To do this,
3 Open the block dialog for Gain block A or B in the model.
4 Enter a new numerical value for the gain and click Apply. As soon as you
click
Apply, the new value is downloaded to the target program and the
effect of the gain change becomes visible on the scope.
Similarly, you can change the frequency, amplitude, or phase of the sine
wave signal by opening the block dialog for the Sine Wave block and
entering a new numerical value in the appropriate field.
Note, however, that you cannot change the sample time of the Sine Wave
block. Block sample times are part of the structural definition of the model
and are part of the generated code. Therefore, if you want to change a block
sample time, you must stop the external mode simulation, reset the block’s
sample time, and rebuild the executable.
5 To simultaneously disconnect host/target communication and end
execution of the target program, pull down the
Simulation menu and
select
Stop real-time code. You can also do this from the External Mode
Control Panel
.