Filter löschen
Filter löschen

Create a Stateflow using local variables (not global)

7 Ansichten (letzte 30 Tage)
Eduard Monlleo
Eduard Monlleo am 29 Jul. 2019
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;
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 Kommentar
Eduard Monlleo
Eduard Monlleo am 5 Aug. 2019
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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Manjunath Bhimalli
Manjunath Bhimalli am 6 Aug. 2019
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.


Mehr zu Complex Logic finden Sie in Help Center und File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by