Make Simulink Real-Time Parameters Tuneable
显示 更早的评论
When using R2025b with previously tunable models, we have noticed that items such as constant blocks no longer appear as tunable parameters for us to modify within the real-time application on a Speedgoat target.
Is there a way to force the model to make specific block parameters tunable?
I've considered the guidance provided on the page Tunable Block Parameters and Tunable Global Parameters but this doesn't offer an actual solution
For example, we have a constant block with the value '5' and during model exection we want to change it to '6'. We have tried setting this value as a parameter on the base workspace and model workspace and this does not seem to force the tunability.
Is setting tunable parameters as base/model workspace parameters required? This seems like a backwards step from previous MATLAB versions where any constant block could be a tunable parameter.
回答(1 个)
nws
2026-8-17,10:21
The behavior you are seeing can occur when a Constant block value is entered directly as a literal such as 5. In that case, Simulink may treat the value as compile-time data and optimize or inline it during code generation, which can prevent it from being exposed as a tunable runtime parameter on the Speedgoat target.
To preserve tunability, use a Simulink.Parameter object and reference that object from the Constant block. For example:
K_const = Simulink.Parameter(5);
Then set the Constant block Value parameter to:
K_const
A few important points:
- Simply placing a value in the base or model workspace does not guarantee runtime tunability.
- What matters is whether the value is preserved as a tunable parameter during code generation.
- Parameter inlining or other optimizations can remove the parameter from the runtime application.
Regarding the UI behavior:
- If the parameter appears in the Application Inspector, the application contains metadata for that parameter.
- If it does not appear in the Parameters tab after deployment, it is likely not exposed as a runtime-tunable parameter on the target.
- Parameter sets help manage values of existing tunable parameters; they do not make parameters tunable.
For standalone workflows, tunable parameters can also be modified programmatically through the Simulink Real-Time APIs, provided they are available for runtime tuning in the deployed application.
2 个评论
Scott
2026-8-19,14:14
nws
about 3 hours 前
A lot can change in this 7 years span wrt Simulink but I would recommend getting in touch with MathWorks Support, as they may have better insight into this issue.
类别
在 帮助中心 和 File Exchange 中查找有关 Target Computer Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!