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 model data

The data exporting step is performed via the qgen_export_xmi 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_xmi script. 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. 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. 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. 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. Higher than 2-dimensional data

Port: "<block name/port type>", Portnumber=<port number>
<Block reference in error message printed as Simulink hyperlink>
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. Missing bus definition

Bus object:  [bus name] not found from workspace, import the type definition before
starting the export process.

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_xmi script or be fed in a .m script given as an argument when exporting the model. Undefined parameters

The model has undefined parameters, run m-file first.

Model parameters contain unbound named constants. 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. Callback functions (warning)

Custom code detected in the following blocks: [block list]


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_xmi 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 Bad model file

[ERROR] Format of input file [Model_File] not recognized. Unsupported target language

[ERROR] Unsupported target language [Some_Language]

Only Ada and C output is supported.

11.3.2. Model import Unsupported block type

[FATAL ERROR] Could not instantiate block [Block]: Block type [BlockType]
not supported 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. 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. Over 2-dimensional data

[ERROR] Data types with more than 2 dimensions are not supported:
[Element_Ref] Unsupported StorageClass

[ERROR] Unsupported StorageClass [StorageClass]: [Ref]

Unsupported StorageClass used in the input file and location indicated by Ref. Parameter or variable with a reserved name

[ERROR] [Reserved_Name] : Variable: reserved name cannot be used

The indicated variable should be renamed. Duplicated workspace parameter

[ERROR] Invalid lhs for assignment in M-file at [File_Loc].
Simulink object [Name] already exists. Missing initial value in parameter definition

[ERROR] Initial value for a parameter must be specified : [File_Loc]. 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.3. Pre-processing signal paths Unconnected signal destination

[ERROR] no DstBlock in Line at [Model_Loc] Unconnected signal source

[ERROR] unknown input connection [Model_Loc] 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. Bad function-call source

[ERROR] Out data port [Block]/[Port] does not emit a function call but is
connected to a Trigger Port 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] 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]


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 Unresolved library references

[FATAL ERROR] Unresolved library reference [Library]/[LibaryBlock]
[FATAL ERROR] Missing referenced model [Model] Indicate location
with --lib 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 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. 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.

This constraint applies for primitive blocks with data feedthrough.


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. Using saturation outside the Saturation block

[ERROR] MISRA AC SLSF (v1.0) 008.A forbids using saturation outside the
Saturation block.


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. 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.


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 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 Containment of events

[ERROR] [Model_Ref]: Events can only be contained in a chart. Event
[Event_Name] Local events

[ERROR] Unsupported feature: The scope for event [Event_Name] is local.
     for Element :[Event_Name] : Event Referencing events in event conditions

[ERROR] Chart input event expected in given context.
    Event: [Event_Name]
    Referred from: [Element_Ref] Only function-call output events

[ERROR] Unsupported feature: Trigger type for ouput events can only be
        for Element : [Event_Ref] Unresolved output event

[ERROR] Unknown broadcast action: [Name]. The current chart does not have
an output event with the given name.
        [Action_Ref] Directed (local) broadcasts

[ERROR] Unsupported form of broadcast action. A 'send' call is supported
with a single argument only.
        [Action_Ref] Usage of boxes

[ERROR] Boxes can only contain boxes, functions or annotations. Data stores in Stateflow

[ERROR] Using Data Stores in Stateflow charts is currently not supported.

Instead, use Data Store Read or Write blocks connected to the chart’s IO. Unresolved functions

[ERROR] Unable to match function: [Function_Name]

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. Unconnected inputs

[ERROR] Unconnected Inport [Port_Name]: cannot generate code
     for Element : [Chart_Ref] Machine level data

[ERROR] Machine level data blocks are not supported. Data Block:
[Data_Name] Starting index

[ERROR] Variables must use default indexing. First index for [Var_Name] is
[Value]. Literal dimension values

[ERROR] Dimensions specified by variables are not supported. Variable
[Var_Name] with dimension [Value] Absolute-time temporal logic

[ERROR] Absolute time based temporal logic is not yet supported.
    [Container] ‘in’ operator

[ERROR] 'in' operator not supported.
    [Element_Ref] Action syntax

[ERROR] [Label_Ref] expected a statement
[ERROR] Error parsing transition label in:

Actions must be formed of valid statements as opposed to an expression such as a + b. Shift operations on signed integers

[ERROR] Shift operations are only allowed with unsigned integers:
    [Left, Right Ref] Broadcast in the init phase

[ERROR] External event broadcast is generated during the initialization
phase.  This is not allowed.
        [Chart, Event, Action Ref] 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] 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] Initial transitions in AND states

[ERROR] Initial transitions are not allowed for AND states

[Element Ref] 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. Implicit execution order of states and transitions

[ERROR] [Chart Ref] does not have userSpecifiedStateTransitionExecutionOrder
    flag set to True Transition actions in flow graph compositions

[ERROR] Transition actions are not allowed in [Element Ref] : Flow graph
    composition 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. 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. 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. Use of mutual recursion

[ERROR] Himoco_Wrapper: Unable to sort functions based on the call order in <Module Name>
[ERROR] Mutual recursion detected between functions:
[ERROR] <Function Name>
[ERROR] <Function Name>

QGen does not allow the use of mutual recursion in its generated code. Typically this pattern can only be generated if modelled explicitly with Stateflow functions. Mutual recursion is generally considered a bad coding pattern. In this case you should refactor your Stateflow algorithm. Note that direct recursion is allowed.