- 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
6 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Epsilon
2025 年 1 月 17 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Target Computer Setup についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!