- setparam: https://www.mathworks.com/help/releases/R2024a/slrealtime/api/slrealtime.target.setparam.html
- Tunable Block Parameters and Tunable Global Parameters: https://www.mathworks.com/help/releases/R2024a/slrealtime/ug/tuning-block-parameters-and-model-parameters.html
tuning paramters in referenced model whithin a Simulink Real-Time model
42 views (last 30 days)
Show older comments
Previous to R2020b, we can tune the parameter inside the model reference by the command such as:
tPar_a = getparamid(tg, 'ModelReference1/subsys1/a','Value');
setparam(tg,tPar_a,1);
After I upgrated to R2024a, the above commands are not availble anymore. I can get and set parameters of the top model, but I can not change parameter values insie the model reference and all the parameters in the model reference are not showing in SLRT_explorer neither. Is there anyway to get the parameter values in the model reference and tune them during simulink realtime simulation?
0 Comments
Answers (1)
Epsilon
on 17 Jan 2025 at 5:46
Hi Yufeng,
In R2024a tuning block parameters inside a referenced model is not possible, only workspace parameters, model arguments, and model instance parameters in referenced models can be tuned while the real-time application is executing.
The parameters inside a model reference can be tuned by using ‘Tuneable Global Parameters’ which are variables in the top model workspace or MATLAB base workspace. These can be referenced inside the model reference.
To programmatically tune using ‘setparam’, use the following syntax:
setparam(target_object, '', parameter_name, parameter_value,'Force',true)
i.e. the parameter name can be passed directly to the function ‘setparam’.
‘setparam’ function also supports dot notation syntax to access parameter values in real-time applications.
For further reference please refer to the following documentations:
Hope it helps.
0 Comments
See Also
Categories
Find more on Target Computer Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!