필터 지우기
필터 지우기

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

조회 수: 8 (최근 30일)
Johann Asam
Johann Asam 2024년 4월 15일
답변: Kothuri 2024년 5월 25일
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?

답변 (1개)

Kothuri
Kothuri 2024년 5월 25일
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.

카테고리

Help CenterFile Exchange에서 Multicore Processor Targets에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by