Simulink Real Time: Referenced Models with non-tunable configuration Arguments

12 vues (au cours des 30 derniers jours)
Johann Asam
Johann Asam le 15 Avr 2024
Hello,
I'm trying to use 2 instances of a referenced model whithin a Simulink Real-Time model. Therefore, I need to run them with different parameters, so I added an Argument in the Model Workspace.
The Simulink block, where I'd like to use this Argument in the referenced model needs a non-tunable input.
Since this is just an initial ID setting that won't be changed during operation, I would be happy with the non-tunable configuration, but it seems that the System Mask Editor doesn't allow you to change this Property. At least there is no drop down menu when I click on it, as there is in the Mask Editor for Sub Systems.
Do you have any suggestions on how to work around this problem?

Réponses (1)

Kothuri
Kothuri le 25 Mai 2024
Hi,
To use the 2 instances of the referenced model with different parameters which are non-tunable, you can
(a)Define a model argument Modelling > Model Settings > Model Properties > Model Referencing tab and add your parameters under Model arguments. For example, you might add an argument named initialID.
In the Model block (the instance of your referenced model in the parent model), specify the value for this argument in the Model arguments field found in the block's parameters. You can enter the specific value or use a workspace variable. For example: initialID=1 for the first instance and initialID=2 for the second.
With this approach you pass the initial ID setting as a non-tunable parameter since the model argument's value is set before simulation starts and cannot be changed during simulation.
(b) Use a Preload function script to set up different parameters for each instance of the referenced model by creating a MATLAB script that sets the parameters in the base workspace or model workspace before the model is loaded.
Using this script assign values to variables that correspond to the parameters in your referenced models.
Ensure this script is executed before the model runs. You can set the script to run automatically by including it in the model's Preload callback (in Model Properties under Callbacks).
You can refer the below link for more information on Model referencing
Hope this helps.

Catégories

En savoir plus sur Multicore Processor Targets dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by