Embedded coder single task tunable time step

5 ビュー (過去 30 日間)
Ben Rancici
Ben Rancici 2019 年 10 月 16 日
コメント済み: Ben Rancici 2020 年 3 月 26 日
In my embedded generated code, one "magic number" still remains: the time step (used in Discrete Integrators or Filters code for instance).
I would like to make this time step tunable by using a dictionary entry with "Define" Storage Class, so I could make it consistant with the actual time step of my target.
Whatever the storage class I choose, in the end the generated code still has a numerical value instead of a tunable variable.
Is this normal? Is there a workaround?

採用された回答

Nick Sarnie
Nick Sarnie 2019 年 10 月 18 日
編集済み: Nick Sarnie 2019 年 10 月 18 日
Hi Ben,
It sounds like you are trying to make the 'Sample time' parameter on blocks be tunable in the generated code.
This is not possible, because changing the sample time effects other parts of the model, such as sorted block order, data transfers, sample time propagation, and more. It's not as simple as changing a variable value in the geneated code.
If you want to have a model that is sample-time independent, consider using model reference: https://www.mathworks.com/help/simulink/ug/inherit-sample-times-for-model-referencing-1.html
However, this will use the sample time of the Model Reference block in the upper model.
Thanks,
Nick
  1 件のコメント
Ben Rancici
Ben Rancici 2020 年 3 月 26 日
Thank you. Model referencing was the solution.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by