Create a Stateflow using local variables (not global)

3 visualizaciones (últimos 30 días)
Eduard Monlleo
Eduard Monlleo el 29 de Jul. de 2019
Respondida: Manjunath Bhimalli el 6 de Ag. de 2019
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 comentario
Eduard Monlleo
Eduard Monlleo el 5 de Ag. de 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

Iniciar sesión para comentar.

Respuestas (1)

Manjunath Bhimalli
Manjunath Bhimalli el 6 de Ag. de 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.

Categorías

Más información sobre Complex Logic en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by