Simulink model autocoding: how to generate global parameters shared between different subsystems component-by-component?

42 ビュー (過去 30 日間)
N/A
N/A 2017 年 6 月 19 日
編集済み: N/A 2017 年 6 月 20 日
hello,
I am currently autocoding a model "modA" composed of two subsystems "ssA1" and "ssA2", from the ERT script. This model modA is based on a global parameter p = [p1, p2] shared between both subsystems, that is, p(1) is given as a parameter of the subsystem ssA1 while p(2) is given as a parameter of the subsystem ssA2.
My problem is that the ERT does not declare the global parameter p as it is, but two parameters "ssA1_p" and "ssA2_p" instead. I would prefere to keep the original semantics of the parameters because I am generating at the same time a wrapper that requires to be based on the parameters names as they are declared in the workspace. That is, p declared as is it in the header, and p(1) and p(2) used instead of ssA1_p and ssA2_p in the source code.
At present, all I know is that in RTW file, p is given as an element of CollapsedTunableParameters list, and both ssA1_p and ssA2_p parameters are declared in ModelParameters with the attribute IsPseudoWorkspaceVar set to yes.
I have supposed that my problem could be solved by specifying the right model configuration parameter, but I could not find it...
Thanks for your time and answer ;)

回答 (1 件)

N/A
N/A 2017 年 6 月 20 日
編集済み: N/A 2017 年 6 月 20 日
Well, it seems that my problem can not be solved because of what is called parameter loss of tunability.
The problem is that code generation does not support tunable parameters when used in an arithmetic expression with unsupported operators:
https://fr.mathworks.com/help/rtw/ug/parameters.html#bvbmv64
...and in my case, referencing a parameter of a subsystem instance as a particular component of a global parameter is not supported, with the result that my parameter is inlined. All I can do is detect when a parameter loses its tunability by generating a warning or an error wia the ParameterTunabilityLossMsg configuration option:
https://fr.mathworks.com/help/simulink/gui/detect-loss-of-tunability.html
Quentin

カテゴリ

Help Center および File ExchangeTarget Language Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by