Why do I receive an error while simulating a stateflow chart which passes an enumerated data in Stateflow 7.9 (R2012a)?

2 visualizaciones (últimos 30 días)
I have defined the enumerated type signal with the head file mybasiccolors.h:
Simulink.defineIntEnumType('BasicColors', ...
{'Red', 'Yellow', 'Blue'}, ...
[0;1;2], ...
'Description', 'Basic colors', ...
'DefaultValue', 'Blue', ...
'HeaderFile', 'mybasiccolors.h', ..
'DataScope', 'Imported', ...
'AddClassNameToEnumNames', true);
I want to simulate only the model but not generate code. Therefore, the "mybasiccolors.h" should not be needed during simulation stage.
In Stateflow 7.8 (R2011b), the simulation completed. But in MATLAB R2012a, it pops up error regards missing the "mybasiccolors.h" file:
Data has compiled structure or enumeration type ‘BasicColors’, which specifies customer header file ‘mybasiccolors.h’.
This custom header file must be directly or indirectly included in model’s Configuration Parameters ‘Simulation Target/Custom Code/Header file’ field.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 16 de Nov. de 2012
This behavior is expected in R2012a. From R2012a onwards, if data in a Stateflow chart uses an enumerated type with a custom header file, you will have to include the header information in Simulation Target > Custom Code pane as documented in the followingr release note and documentation page:
If you do not have access to the header file and do not plan to generate code at all, you should be able to define the enumeration the following way (without the header file) and simulate his model:
Simulink.defineIntEnumType('BasicColors', ...
{'Red', 'Yellow', 'Blue'}, ...
[0;1;2], ...
'Description', 'Basic colors', ...
'DefaultValue', 'Blue', ...
'DataScope', 'Imported', ...
'AddClassNameToEnumNames', true);
  1 comentario
TAB
TAB el 20 de Oct. de 2015
Any reason why this change.
A related option "SimGenImportedTypeDefs" is removed from Code Generation settings GUI and by default it is Off for the model.
But making set_param('modelname', 'SimGenImportedTypeDefs', 'On') from command line works.
After turning On SimGenImportedTypeDefs, there is no need to define the header file.
Any side/bad effects of turning "SimGenImportedTypeDefs" On from command line.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos


Versión

R2012a

Community Treasure Hunt

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

Start Hunting!

Translated by