why Code generation with model reference initialize port is not working?

I tried to analyze initialize port setting in reference model. During model in loop it works fine but its functionality not understanding. During code generation wit ert.tlc and autosar.tlc it is giving below error :
The top model '__________' contains the model block '________' which has one or more of its Initialize, Reset or Terminate ports enabled. Code generated is not supported for such models.
Need c code for reference model initialize port setting to iinitialize function call subsystem. If we use trigger or enable it holds previous value instead of initial output. But we use initialize port with reference model block holds initial value till next change at output.

3 件のコメント

Samir Revelo
Samir Revelo 2020 年 10 月 23 日
編集済み: Samir Revelo 2020 年 10 月 23 日
I´m getting the same problem trying to generate code out of a top model which has a reference model inside. This reference model has initialize and reset blocks and I was hoping that top model can schedule init and reset ports by means of state flow events.
It seems that simulink does not support this for codegeneration, but I don´t get why? I want some internal states of reference model to be reset once certain conditions are fulfilled. Altough initial states and reset states have to be different. Nevertheless, if I use reset input for delays or integrator reset internal states, then those states are set to initial value of states and not to reset value.
I hope someone from Mathworks provides any support here too.
Binh Huynh Thanh
Binh Huynh Thanh 2022 年 6 月 20 日
Hello All,
I have a same issue. But I can not underatand why.
But, it can be in simulation mode only. I can not generate the code using embeded coder packages.
Please help us.
Binh Huynh Thanh
Binh Huynh Thanh 2022 年 6 月 20 日
Please spend your time to support us

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

回答 (1 件)

Jesús Zambrano
Jesús Zambrano 2020 年 10 月 23 日

1 投票

Hi Ranganatha and Samir,
Please follow the steps discribed in the following link:
In there you'll find the workflow to generate code for a model that responds to Initialize, Reset and Terminate events.
Hope it helps!

2 件のコメント

Samir Revelo
Samir Revelo 2020 年 10 月 23 日
編集済み: Samir Revelo 2020 年 10 月 23 日
Hello Jesús,
Thanks for your reply.
As I described in my post above I have actually following limitation (you can find this in link you shared above):
I need that my root model generates code which calls reset function of child refence model.
Is any solution going to be provided for this limitation as this is a use case which I need to handle with Simulink?
Thanks in advance.
Jesús Zambrano
Jesús Zambrano 2020 年 10 月 23 日
編集済み: Jesús Zambrano 2020 年 10 月 23 日
If the child includes explicit ports for Initialize, Reset, Terminate you can't generate code. If you use Initialize, Reset and Terminate function blocks then you can. Outside this workflow you will get a limitation at the moment.

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

カテゴリ

ヘルプ センター および File ExchangeGeneral Applications についてさらに検索

製品

質問済み:

2020 年 6 月 9 日

コメント済み:

2022 年 6 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by