Have you ever need to take a quick look on a parameter
value doing modeling?
Maybe you inherited a Simulink model from another engineer
and just want to check if the gain block was given
a reasonable gain value, but the variable
that specified to the gain was defined inside a deeply nested
structure.
You would need to go to the workspace
where the top struct is defined, then navigate into the struct
until you find a variable.
Sometimes, it really cost you time just
to see the simple value.
To help you in such a situation, we
introduce the inplace parameter value display feature
in a coming release.
Let's say I have a Simulink model that represents a car.
All data used by this model was defined in different MATLAB
classes and structured according to the model hierarchy.
rootData is a type of vehicle class
and contains all the data needed by the model.
Inside rootData, there's three groups
of data represented as properties.
Engine is a type of engine V8 class,
and contains all data needed by the Engine subsystem.
Drivetrain is a type of drivetrain 4x4 class,
and contains all data needed by the Drivetrain subsystem.
And finally, vehicleBody is a type of body SUV class
and contains all data needed by the vehicle body subsystem.
Inside each subgroup of data, there
are different variables that are defined
to be used in those corresponding subsystems.
Besides that, there are other variables
defined in the model space and attached data dictionary that's
used by Sum blocks.
Now, let's see how you can leverage this feature where
you are working with the model.
On the top level, let's open the System Block dialog.
The system block is a masked subsystem with a data object
parameter on the mask.
The value of that parameter is specified as rootData.
In this case, the type of rootData
will be shown on the right hand of the Edit widget as a link
since the rootData is a struct.
If you wonder how this vehicle class is defined,
you can click on the label, and the MATLAB doc page
for this class will pop up.
You can scroll through this auto-generated doc page
or click on the View Code link at the top right
corner of the view to check the actual code.
Now let's dive into the subsystem.
This time, I want to check the drivetrain block.
This block is also a masked subsystem
with two promoted parameters from the blocks underneath it.
MotorPower is specified with obj.drivertrain.motorPower,
which has a double value defined.
So it shows the value right in Edit widget.
Same for the generated power.
Next, I want to check the engine subsystem.
I double-click to open the dialog for the constant block.
For this constant value, it is specified as an expression
with variables that's defined in Model Workspace and Base
Workspace.
Fortunately, with this feature, the result of this expression
is already calculated and displayed
on the right side of the expression
without any additional action.
Now, let's get into the Body subsystem
and open the Constant Block dialog.
I have a data dictionary attached to this model.
And I'm using a variable defined in that data
dictionary in this block.
And as shown, the expression also
gets correctly resolved by finding the right variable
in that data dictionary.