11. Appendix A: Errors and warnings¶
11.1. General notes¶
This appendix lists the main errors and warnings emitted by the QGen tool in
common usage scenarios. There are several different workflows for using the
tool. E.g. launching from the Simulink GUI, the qgen_build
script or
explicitly from the system command line. The possible messages vary slightly
depending on the chosen workflow.
11.2. Preliminary steps¶
11.2.1. Exporting decoration data¶
The decoration data exporting step is performed via the
qgen_export_types
script, which is invoked either from the Simulink
GUI, qgen_build
script or directly from command line.
In order to get typing and scheduling information the script needs to execute the model. Because of that, errors or warnings from Simulink may appear, if the model is not consistent with Simulink constraints.
In addition, the following errors can be detected by the
qgen_export_types
script.
11.2.1.1. Model file not found¶
There is no system named [Model_Name] to open
The error occurs, when the indicated model cannot be found. Check that the model name and path to the model were entered correctly and the model exists.
11.2.1.2. Unsaved changes to the model¶
Model: [Model_Name] is modified please save it before code generation
The error occurs, when the given model is open and contains unsaved changes.
11.2.1.3. Cannot close the model¶
Cannot close the model [Model_Name] because it has been changed.
This error can occur, for example, when the simulation executed by the script altered the model (for instance the model contains a callback that modifies block parameters). In this case simply ignore the message and close the model manually.
11.2.1.4. Model was created with a newer version of Simulink¶
Created with newer version of simulink.
Version in file: <version of loaded model>.
Simulink version: <current version of Simulink>.
If the changes between two different Simulink versions are not too big, it might be possible to open a model in an older version of Simulink than the one, where it was created. By default the script rejects such models with a following error message.
In case it is known, that the model works correctly in the current version, then the version check can be switched off. See, the section for producing the decoration file.
11.2.1.5. Unable to open output file¶
Unable to open output file "[file_name]"
The error occurs, when an invalid filename was specified for output, the output folder does not exist or the file is locked.
11.2.1.6. Higher than 2-dimensional data¶
Port: "<block name/port type>", Portnumber=<port number>
<Block reference in error message printed as Simulink hyperlink>
DimensionsError:Over2D
Model has <N> -dimensional elements. QGENC supports up to two dimensions.
Code generation from data with higher than two dimensions is not supported. Redesign the model to avoid higher-order arrays.
11.2.1.7. Missing bus definition¶
Bus object: [bus name] not found from workspace, import the type definition before
generating the decoration file.
If the tool was not able to find the definition for a bus object a following error is generated.
The type definition must be either manually imported to the workspace before running the qgen_export_types script or be fed in a .m script given as an argument when generating the decoration file.
11.2.1.8. Undefined parameters¶
The model has undefined parameters, run m-file first.
Model parameters contain unbound named constants.
11.2.1.9. Cannot determine fundamental sample time¶
Cannot determine fundamental sample time for the model.
Make sure that the value of the "Stop time" parameter'
allows simulation to run at least two steps.
Make sure that the value of the “Stop time” parameter’ allows simulation to run at least two steps.
11.2.1.10. Callback functions (warning)¶
Custom code detected in the following blocks: [block list]
or
Custom code detected.
The model [Model_Name] contains callback functions. Please make sure that
none of them changes the model behaviour or structure. Run the script with
'-v' to see the list of affected blocks
QGenc does not evaluate any of the callback functions in the model. In case any callback functions are detected the qgen_export_types script issues a warning. If you are sure the callback do not alter model behaviour then the warning can be safely ignored. Otherwise, the model must be rearranged to achieve the same functionality without manipulating model elements with scripts.
NB! There is an exception in case of masked blocks – if the purpose of a callback function is to transfer mask parameter value from mask to all parameters with same name inside of the masked subsystem, then this is supported by qgenc.
11.3. Code generation¶
Code generation is performed by the QGen code generator (qgenc
) tool. The
events raised by qgenc
have following categories:
- INFO – Information to the user about the operations performed by the tool.
- WARNING – Information to the user of a modelling pattern that does not prohibit code generation, but should be reviewed by the user.
- ERROR – Unsupported modelling construct or usage of the tool. All errors result in the tool stopping without generating the output code. It is possible that several ERROR events are caught and processed by the tool before stopping execution.
- FATAL_ERROR – An error of this category stops the tool’s operation immediately.
The next sections describe the main error and warning events generated by
qgenc
.
11.3.1. Command-line arguments¶
11.3.1.1. Bad model file¶
[ERROR] Format of input file [Model_File] not recognized.
11.3.1.2. Missing decoration (types) file parameter¶
[ERROR] No types file specified for .mdl model: [Model_File]
11.3.1.3. Bad decoration file (types) parameter¶
[FATAL ERROR] Cannot find types file [Path_To_File]
11.3.1.4. Unsupported target language¶
[ERROR] Unsupported target language [Some_Language]
Only Ada and C output is supported.
11.3.2. Model import¶
11.3.2.1. Unsupported block type¶
[FATAL ERROR] Could not instantiate block [Block]: Block type [BlockType]
not supported
11.3.2.2. MATLAB Function blocks¶
[WARNING] 'MATLAB Function' not supported. Replacing the block 'Embedded
MATLAB Function' with an empty function call wrapper
Blocks containing MATLAB language are not supported. Replace such block in the model by an equivalent subsystem or chart. Or alternatively, provide the implementation of the MATLAB code in the wrapper generated by QGen.
11.3.2.3. MATLAB functions in block parameters¶
[FATAL ERROR] Use of unsupported MATLAB function [Function]
Block: [Block]
Parameter: [Parameter]
This message indicates that a block that is otherwise supported contains a call to a MATLAB function that is not supported. Replace calls to [Function] in the indicated block and parameter with a function that is supported by QGen or use another kind of block.
11.3.2.4. Missing block or port entry in the decoration (types) file¶
[ERROR] The decoration file does not contain datatype for the port
[Block]/[Port] for Element :In data port [Block]/[Port]
Make sure that the decoration file was generated after saving the model.
11.3.2.5. Unsupported data type in the decoration (types) file¶
[ERROR] Unrecognized type in decoration file: [Data_Type]
for Element :[Block/Port]
Make sure that the model contains only data types supported by QGen. E.g. data types from the Simulink Fix Point toolbox, such as sfix32_En13 are not supported.
11.3.2.6. Over 2-dimensional data¶
[ERROR] Data types with more than 2 dimensions are not supported:
[Element_Ref]
11.3.2.7. Unsupported StorageClass¶
[ERROR] Unsupported StorageClass [StorageClass]: [Ref]
Unsupported StorageClass used in the input file and location indicated by Ref.
11.3.2.8. Parameter or variable with a reserved name¶
[ERROR] [Reserved_Name] : Variable: reserved name cannot be used
The indicated variable should be renamed.
11.3.2.9. Duplicated workspace parameter¶
[ERROR] Invalid lhs for assignment in M-file at [File_Loc].
Simulink object [Name] already exists.
11.3.2.10. Missing initial value in parameter definition¶
[ERROR] Initial value for a parameter must be specified : [File_Loc].
11.3.2.11. Unsupported statement in the provided M-file¶
[ERROR] Non assignment statement in M-file
Only definitions in the form of assign statements are supported in M-files.
11.3.2.12. Decoration file weaving error¶
[ERROR] Errors in step Weaving data from decoration file
In case any error occur during the step of weaving data from decoration file, the tool stops. Examine the specific errors and warnings emitted before this point.
11.3.3. Pre-processing signal paths¶
11.3.3.1. Unconnected signal destination¶
[ERROR] no DstBlock in Line at [Model_Loc]
11.3.3.2. Unconnected signal source¶
[ERROR] unknown input connection [Model_Loc]
11.3.3.3. Broken data flow processing¶
[ERROR] Could not create incoming signals for block [Block]
There was an error processing some of the blocks preceeding the indicated block. Review these blocks and errors.
11.3.3.4. Bad function-call source¶
[ERROR] Out data port [Block]/[Port] does not emit a function call but is
connected to a Trigger Port
11.3.3.5. Implicit data rate conversion¶
[FATAL ERROR] Data flow between two tasks with different frequencies
requires an explicit Rate Transition block
for Element :Signal [Block1] -> [Block2]
11.3.3.6. Data store references across system boundaries¶
[ERROR] MISRA AC SLSF (v1.0) 005.C forbids use of data store to exchange
data across subsystem boundaries: [Data_Store_Block]
Note
Violation of this constraint can be treated as error (default),
warning or ignored depending on the MISRA options that were selected,
when launching the qgenc
tool.
11.3.4. Pre-processing model/block references¶
11.3.4.1. Unresolved library references¶
[FATAL ERROR] Unresolved library reference [Library]/[LibaryBlock]
[FATAL ERROR] Missing referenced model [Model] Indicate location
with --lib
11.3.4.2. Unsupported block in a referenced model¶
[FATAL ERROR] Could not import block Reference block [Library]/[LibaryBlock]:
it references a block of an unsupported type
for Element :[Library]/[LibaryBlock]/[UnsupportedBlock]
11.3.5. Pre-processing block constraints¶
11.3.5.1. Block type specific constraints¶
[ERROR] [Block]: structure check failed.
Most block types supported by QGen have block type specific constraints
regarding the allowed values for block parameters or context, where the block is
used in the model. The constraints are provided in the QGen User Guide. The
constraints are checked for each block instance in a pass called
check_structure
. If it fails, an error such as the one presented here is
raised. In addition, the structure check usually provides one or more detailed
error messages related to the particular constraint that is violated. Such
errors are emitted right before the “structure check failed” error.
11.3.5.2. Using data type conversion outside the Data Type Conversion block¶
[ERROR] MISRA AC SLSF (v1.0) 002 forbids using data type conversion outside
the Data Type Conversion block. Output of the block must have the same base
type as input.
[Block]
This constraint applies for primitive blocks with data feedthrough.
Note
Violation of this constraint can be treated as error (default),
warning or ignored depending on the MISRA options that were selected,
when launching the qgenc
tool.
11.3.5.3. Using saturation outside the Saturation block¶
[ERROR] MISRA AC SLSF (v1.0) 008.A forbids using saturation outside the
Saturation block.
[Block]
Note
Violation of this constraint can be treated as error (default),
warning or ignored depending on the MISRA options that were selected,
when launching the qgenc
tool.
11.3.5.4. Using rounding outside the Rounding block¶
[ERROR] MISRA AC SLSF (v1.0) 008.B requires the rounding behaviour to be
configured to round towards zero in all blocks other than the "Rounding
Function" block.
[Block]
Note
Violation of this constraint can be treated as error (default),
warning or ignored depending on the MISRA options that were selected,
when launching the qgenc
tool.
11.3.6. Sequencing¶
11.3.6.1. Feedback loop resolution failure¶
[INFO] Cannot generate code due to possible algebraic loop detected among:
[INFO] Elementary block [Block1]: is direct feedthrough
[INFO] Elementary block [Block2]: is direct feedthrough
...
[FATAL ERROR] A possible solution is to make a subsystem virtual or to add
a non- directFeedThrough block (like a UnitDelay) between the blocks above.
Check and redesign the indicated part of the model.
11.3.7. Stateflow constraints¶
11.3.7.1. Containment of events¶
[ERROR] [Model_Ref]: Events can only be contained in a chart. Event
[Event_Name]
11.3.7.2. Local events¶
[ERROR] Unsupported feature: The scope for event [Event_Name] is local.
for Element :[Event_Name] : Event
11.3.7.3. Referencing events in event conditions¶
[ERROR] Chart input event expected in given context.
Event: [Event_Name]
Referred from: [Element_Ref]
11.3.7.4. Only function-call output events¶
[ERROR] Unsupported feature: Trigger type for ouput events can only be
FUNCTION_CALL_EVENT
for Element : [Event_Ref]
11.3.7.5. Unresolved output event¶
[ERROR] Unknown broadcast action: [Name]. The current chart does not have
an output event with the given name.
[Chart_Ref]
[Action_Ref]
11.3.7.6. Directed (local) broadcasts¶
[ERROR] Unsupported form of broadcast action. A 'send' call is supported
with a single argument only.
[Action_Ref]
11.3.7.7. Usage of boxes¶
[ERROR] Boxes can only contain boxes, functions or annotations.
11.3.7.8. Data stores in Stateflow¶
[ERROR] Using Data Stores in Stateflow charts is currently not supported.
[Chart_Ref]
[Data_Store_Ref]
Instead, use Data Store Read or Write blocks connected to the chart’s IO.
11.3.7.9. Unresolved functions¶
[ERROR] Unable to match function: [Function_Name]
[Chart_Ref]/[Element_Ref]
The function with the given name cannot be resolved. Note that Truth table functions, Simulink functions and C math functions are currently not supported by QGen.
11.3.7.10. Unconnected inputs¶
[ERROR] Unconnected Inport [Port_Name]: cannot generate code
for Element : [Chart_Ref]
11.3.7.11. Machine level data¶
[ERROR] Machine level data blocks are not supported. Data Block:
[Data_Name]
11.3.7.12. Starting index¶
[ERROR] Variables must use default indexing. First index for [Var_Name] is
[Value].
11.3.7.13. Literal dimension values¶
[ERROR] Dimensions specified by variables are not supported. Variable
[Var_Name] with dimension [Value]
11.3.7.14. Absolute-time temporal logic¶
[ERROR] Absolute time based temporal logic is not yet supported.
[Expression]
[Container]
11.3.7.15. ‘in’ operator¶
[ERROR] 'in' operator not supported.
[Element_Ref]
11.3.7.16. Action syntax¶
[ERROR] [Label_Ref] expected a statement
[ERROR] Error parsing transition label in:
[Element_Ref]
[Label]
Actions must be formed of valid statements as opposed to an expression such as
a + b
.
11.3.7.17. Shift operations on signed integers¶
[ERROR] Shift operations are only allowed with unsigned integers:
[Left, Right Ref]
11.3.7.18. Broadcast in the init phase¶
[ERROR] External event broadcast is generated during the initialization
phase. This is not allowed.
[Chart, Event, Action Ref]
11.3.7.19. Referencing inputs from graphical functions during init¶
[ERROR] Chart has 'Execute at init' property set to True and it contains
graphical functions that reference chart's input. This is not supported.
[Chart, Input, Context Ref]
11.3.7.20. OR decomposition without an unguarded default transition¶
[ERROR] Violation of a modelling rule. An OR decomposition must always have
an unguarded default transition
[Chart Ref]
11.3.7.21. Initial transitions in AND states¶
- [ERROR] Initial transitions are not allowed for AND states
- [Element Ref]
11.3.7.22. Horizontal inter-level transitions¶
[ERROR] Only vertical inter level transitions are allowed
[Element Ref]
Only vertical inter-level transitions (i.e. transitions within a containment hierarchy) are allowed.
11.3.7.23. Implicit execution order of states and transitions¶
[ERROR] [Chart Ref] does not have userSpecifiedStateTransitionExecutionOrder
flag set to True
11.3.7.24. Simulink functions¶
[ERROR] Simulink functions are not supported
[Chart, Function Ref]
11.3.7.25. Transition actions in flow graph compositions¶
[ERROR] Transition actions are not allowed in [Element Ref] : Flow graph
composition
11.3.7.26. Nested calls to graphical functions returning non-scalar data¶
[FATAL ERROR] Nested calls for non-scalar functions are not supported for
C code generation: [Function Ref]
11.3.8. Code generation¶
This section describes some generic code generation errors.
11.3.8.1. Unresolved variable or parameter¶
[ERROR] Can not resolve VariableExpression.
Expression : [Expression_Ref]
references variable with name=[NAME], which is not found.
The model contains a block parameter or variable that is not found. Make sure all required workspace parameters have been passed to QGen and that the model can be simulated in Simulink.
11.3.8.2. Enumerated types for Ada code generation¶
[ERROR] Duplicate representation value in an enumeration type not allowed
for Ada code generation. Please refine the assignment of representation
values in the type definition and update the model as needed.
[Enumeration ref, Literal, Other Literal]
When the chosen target language is Ada make sure all enumeration literals in one type are associated with different integer values.