Create a Stateflow using local variables (not global)

3 vues (au cours des 30 derniers jours)
Eduard Monlleo
Eduard Monlleo le 29 Juil 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 commentaire
Eduard Monlleo
Eduard Monlleo le 5 Août 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

Connectez-vous pour commenter.

Réponses (1)

Manjunath Bhimalli
Manjunath Bhimalli le 6 Août 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.

Catégories

En savoir plus sur Complex Logic dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by