Guy on 金宝appSimulink

金宝appSimulink & Model - -based Design

Referencing the Configuration Sets for Model Reference

What weekes I described the possibility of A lineStoring more multiple configuration sets in a single model.

Today we will do the opposite:Sharing one configuration set among multiple models.

The Reference Configuration Set

By default, in 金宝appSimulink, the configuration of a model is stored in the model file itself.

Or when you have a hierarchy of referenced models, those models must have similar configuration sets. The home having each model storing its own configuration, it is possible to have all models refer to a single configuration set.

To begin, setup the configuration you want in one model and convert it To a configuration reference:

Converting to the reference configuration

A dialog will allow you to specify the name of the configuration set and difference you the possibility to save it to A MAT - the file or A MATLAB script.

Specifying the name and the file of the configuration set

Note that if you do not save the configuration set at this time, it is always possible to save it later using金宝appSimulink. BlockDiagram. SaveActiveConfigSet

Once the configuration object is in the base workspace, you can configure all your child models to refer to it:

Update:- This can be done by right clicking on the top model configuration reference and selectingThe Propagate to Referenced Models

Multiple model referencing the same configuration

That way if the configuration needs to change, you will need to make the change in only one place.

Creating Variants of a common configuration set

In a hierarchy of referenced models, it is common to want all the child models and almost the same configuration, except what the parameters. For example, In the following the model I want the three child models and all the same configuration, except I wantChild3. SLXTo execute at a company's sample time.

Multiple model referencing similar configuration

To make that happen, I stored a configuration namedmyConfigIn a MATLAB scriptConfigFile. M.in the an initialization script that I execute before running my model (for example theThe model PreLoadFcn callback), I copy this configuration set and modify the parameter I need.

Creating a configuration set -based on an existing configuration set

That way, I can configureChild3. SLXTo refer tomyConfigTS2If, in the future, I need to change a parameter in all the child models, I only need to do it once inConfigFile. M. When my initialization script will createmyConfigTS2, it will automatically inherit this change.

Now it 's your turn

Do you take advantage of the configuration reference?Let us know by brigade aComment here

|

comments

To comment, please clickhereLog in to your MathWorks account or create a new account.