Wednesday, May 15, 2024
HomeMatlabParameter Values in Blocks Dialogs » Man on Simulink

Parameter Values in Blocks Dialogs » Man on Simulink


MATLAB R2022b was launched a couple of weeks in the past, so it is time to spotlight a couple of new Simulink options. On this publish, I made a decision to give attention to one characteristic which may move a bit of bit underneath the radar, however that I consider can prevent a whole lot of time.

In case you have not seen, in R2022b we now show the evaluated worth of parameters in block dialogs:

The identical additionally occurs within the Property Inspector:

Here’s a fast video illustrating that this characteristic instantly shows any expression you kind within the block dialog, evaluated within the context of the place the block is situated:

inPlaveValue.gif

A Extra Advanced Instance

Clearly, for easy fashions, determining the worth of a parameter is comparatively straightforward. You possibly can merely kind it within the base workspace or look inside a knowledge dictionary. Let’s look right into a extra complicated setup the place the utility of this characteristic turns into extra apparent.

For those who take a look at the dialog of one of many Fixed blocks in Cylinder 2, you’ll be able to instantly see that the expression Ac^2/Ok resolves to 5e-11:

For those who do the identical inside Cylinder 3, the identical expression resolves to a unique worth, 8e-11:

The reason being that these masked subsystems obtain completely different parameters values. With out this characteristic, you would wish to undergo a sequence of steps to determine these values with out simulating the mannequin:

  • Take a look at the Masks Editor to see which dialog parameter corresponds to Ac and Ok.
  • Look within the dialog of every masked Subsystem to see which parameter is handed to the masks dialog of every block
  • Look within the mannequin workspace to seek out the precise worth of these parameters
  • Consider the equation within the MATLAB base workspace to see the ultimate values

That is a whole lot of clicks! Think about now you probably have a number of ranges of nested masked Subsystems how this complexity grows.

Customized MATLAB Objects

For those who outline your mannequin parameters utilizing MATLAB lessons as I described within the 5-post sequence on slPart, what the evaluated worth will show is a hyperlink that opens the auto-generated class documentation, which then features a hyperlink to open the supply code. For those who obtain my instance on MATLAB File Alternate, or clone the repository on GitHub, you will note that this appears to be like like the next:

If the MATLAB class is well-commented, accessing all this data with one click on may be very helpful.

Disabling it

To reap the benefits of this characteristic, you don’t have anything to do, it is simply there by default. If, for any motive, you wish to disable it, this may be accomplished from Simulink Preferences.

If you find yourself disabling this characteristic, I might be very to listen to the explanation.

Now it is your flip

Tell us within the feedback under what you consider this characteristic. I personally discover that it’s already saving me many clicks on daily basis.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments