Create a Stateflow using local variables (not global)

3 ビュー (過去 30 日間)
Eduard Monlleo
Eduard Monlleo 2019 年 7 月 29 日
回答済み: Manjunath Bhimalli 2019 年 8 月 6 日
Hello,
I need the Stateflow to generate code with just local variables, but the generated code always creates global variables for the different states and for local variables. Inputs and outputs of the chart are created correctly modifying those signals properties.
/* Gateway: Subsystem1/Subsystem/cla_subsystem/PeriodT1ControlManager */
326 /* During: Subsystem1/Subsystem/cla_subsystem/PeriodT1ControlManager */
327 if (dcdc48_12_w_CLA2_DWork.is_active_c3_dcdc48_12_w_CLA2 == 0U) {
328 /* Entry: Subsystem1/Subsystem/cla_subsystem/PeriodT1ControlManager */
329 dcdc48_12_w_CLA2_DWork.is_active_c3_dcdc48_12_w_CLA2 = 1U;
330
331 /* Entry Internal: Subsystem1/Subsystem/cla_subsystem/PeriodT1ControlManager */
332 /* Entry Internal 'PeriodT1ControlManager': '<S12>:112' */
333 /* Entry Internal 'PERIOD_Control': '<S12>:431' */
334 /* Transition: '<S12>:434' */
335 dcdc48_12_w_CLA2_B.PERIOD_ControlMode = PERIOD_ControlModeType_IDLE;
That's a part of the code that is generated.
I just need PERIOD_ControlMode = IDLE;, instead of that structure.
  1 件のコメント
Eduard Monlleo
Eduard Monlleo 2019 年 8 月 5 日
If it is of someone's interest, I found a solution but it is so inefficient.
For the chart local variables, you make them outputs, and this way, the out port of the chart can be set to RAM memory. This way it will be created without that struct.
For the state machine, you can mark the parameter "Create output for monitoring", and once again set it to RAM memory.
If you found a better way to do it please tell me!
Thank you

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

回答 (1 件)

Manjunath Bhimalli
Manjunath Bhimalli 2019 年 8 月 6 日
This can be controlled with code generation options from configuration setting panel.
configuration setting ->code generation->Template
Modify the local variable tokens if you have access to tlc templates.

カテゴリ

Help Center および File ExchangeComplex Logic についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by