User`s guide
Parameter Tuning
3-49
Parameter Tuning
Simulink external mode connects your Simulink model to your real-time
application. The block diagram becomes a graphical user interface to the
real-time application.
This section includes the following topics:
• “Types of Parameters” on page 3-49
• “Changing Model Parameters” on page 3-50
Types of Parameters
You can change parameter values while running the real-time application by
changing the values in
•
Block parameters — Change block parameters by changing the values in
the dialog boxes associated with the Simulink blocks. Once you change a
value, and click
Apply or OK, the new value immediately replaces the
existing parameter while the real-time application continues to run.
•
Block parameters for masked subsystems — Change block parameters in
the user-created dialog boxes associated with a subsystem.
•
MATLAB variables — Change MATLAB variables by entering the changes
through the MATLAB command line, and then press
Ctrl+D for the changes
to be downloaded to your executable. An alternative method to download
parameters is to click
Update Diagram from the Edit menu in your
Simulink window. Simply changing the value of the MATLAB variable at the
MATLAB command line is not sufficient for Simulink to know that the value
has changed.
Simulink external mode also supports side-effects functions. For example,
given an expression in a Gain block of
2*a+b, the expression is evaluated and
the resulting value is exported to the real-time application during execution.
When a parameter in a Simulink model is changed, the communication module
rtwinext.dll transfers the data to the external real-time application and
changes the model parameters. Only the parameters that do not result in
model structure modification can be changed. If the structure is modified, you
must recompile the model. Model structure changes are detected automatically
using model checksum and reported to the MATLAB window to avoid conflicts.