.. Note! This file is included both, in the user guide, as well as in a standalone document. Hence, avoid creating hyper links from here to other parts of the user guide! .. _error-list: =============================== Appendix A: Errors and warnings =============================== 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. .. TODO If any notable errors/warnings are generated only from qgen_build.m, other scripts or GUI, then insert them here. .. _error-list-export: Preliminary steps ================= 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 ^^^^^^^^^^^^^^^^^^^^ .. code-block:: text 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text 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 ^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text 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. Model was created with a newer version of Simulink ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text Created with newer version of simulink. Version in file: . Simulink version: . 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. .. We avoid a hyper-link here, as explained in the header of this section. 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 XMI files, :ref:`exporting-model`. Unable to open output file ^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text Port: "", Portnumber= DimensionsError:Over2D Model has -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 ^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text 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 ^^^^^^^^^^^^^^^^^^^^ .. code-block:: text The model has undefined parameters, run m-file first. Model parameters contain unbound named constants. Cannot determine fundamental sample time ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text 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) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text 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_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. 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``. Command-line arguments ---------------------- Bad model file ^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Format of input file [Model_File] not recognized. Unsupported target language ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Unsupported target language [Some_Language] Only Ada and C output is supported. Model import ------------ Unsupported block type ^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [FATAL ERROR] Could not instantiate block [Block]: Block type [BlockType] not supported MATLAB Function blocks ^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Data types with more than 2 dimensions are not supported: [Element_Ref] Unsupported StorageClass ^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Unsupported StorageClass [StorageClass]: [Ref] Unsupported StorageClass used in the input file and location indicated by Ref. Parameter or variable with a reserved name ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] [Reserved_Name] : Variable: reserved name cannot be used The indicated variable should be renamed. Duplicated workspace parameter ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Invalid lhs for assignment in M-file at [File_Loc]. Simulink object [Name] already exists. Missing initial value in parameter definition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Initial value for a parameter must be specified : [File_Loc]. Unsupported statement in the provided M-file ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Non assignment statement in M-file Only definitions in the form of assign statements are supported in M-files. Pre-processing signal paths --------------------------- Unconnected signal destination ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] no DstBlock in Line at [Model_Loc] Unconnected signal source ^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] unknown input connection [Model_Loc] Broken data flow processing ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Out data port [Block]/[Port] does not emit a function call but is connected to a Trigger Port Implicit data rate conversion ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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. Pre-processing model/block references ------------------------------------- Unresolved library references ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [FATAL ERROR] Unresolved library reference [Library]/[LibaryBlock] .. code-block:: text [FATAL ERROR] Missing referenced model [Model] Indicate location with --lib Unsupported block in a referenced model ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [FATAL ERROR] Could not import block Reference block [Library]/[LibaryBlock]: it references a block of an unsupported type for Element :[Library]/[LibaryBlock]/[UnsupportedBlock] Pre-processing block constraints -------------------------------- Block type specific constraints ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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. Using saturation outside the Saturation block ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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. Using rounding outside the Rounding block ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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. Sequencing ---------- Feedback loop resolution failure ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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. Stateflow constraints --------------------- Containment of events ^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] [Model_Ref]: Events can only be contained in a chart. Event [Event_Name] Local events ^^^^^^^^^^^^ .. code-block:: text [ERROR] Unsupported feature: The scope for event [Event_Name] is local. for Element :[Event_Name] : Event Referencing events in event conditions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Chart input event expected in given context. Event: [Event_Name] Referred from: [Element_Ref] Only function-call output events ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Unsupported feature: Trigger type for ouput events can only be FUNCTION_CALL_EVENT for Element : [Event_Ref] Unresolved output event ^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Unknown broadcast action: [Name]. The current chart does not have an output event with the given name. [Chart_Ref] [Action_Ref] Directed (local) broadcasts ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Unsupported form of broadcast action. A 'send' call is supported with a single argument only. [Action_Ref] Usage of boxes ^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Boxes can only contain boxes, functions or annotations. Data stores in Stateflow ^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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. Unresolved functions ^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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. Unconnected inputs ^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Unconnected Inport [Port_Name]: cannot generate code for Element : [Chart_Ref] Machine level data ^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Machine level data blocks are not supported. Data Block: [Data_Name] Starting index ^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Variables must use default indexing. First index for [Var_Name] is [Value]. Literal dimension values ^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Dimensions specified by variables are not supported. Variable [Var_Name] with dimension [Value] Absolute-time temporal logic ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Absolute time based temporal logic is not yet supported. [Expression] [Container] 'in' operator ^^^^^^^^^^^^^ .. code-block:: text [ERROR] 'in' operator not supported. [Element_Ref] Action syntax ^^^^^^^^^^^^^ .. code-block:: text [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``. Shift operations on signed integers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Shift operations are only allowed with unsigned integers: [Left, Right Ref] Broadcast in the init phase ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] [Chart Ref] does not have userSpecifiedStateTransitionExecutionOrder flag set to True Simulink functions ^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Simulink functions are not supported [Chart, Function Ref] Transition actions in flow graph compositions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Transition actions are not allowed in [Element Ref] : Flow graph composition Nested calls to graphical functions returning non-scalar data ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [FATAL ERROR] Nested calls for non-scalar functions are not supported for C code generation: [Function Ref] Code generation --------------- This section describes some generic code generation errors. Unresolved variable or parameter ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [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. Signal resolution to Simulink.Signal objects ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [WARNING] Not resolving signal '' that matches a defined Simulink.Signal because MustResolveToSignalObject is false and model signal resolution is 'Explicit only' for Element : When the "Signal resolution" parameter of the model is set to "Explicit only", signal resolution to Simulink.Signal objects will **not** occur for signals that are not explicitly marked for resolution. This warning indicates a case where the user has defined a Simulink Signal with this name as the signal in the model but has not set the "MustResolveToSignalObject" parameter of the signal to true. In this case the variable for the signal will not be resolved to the global Simulink Signal. Typically this is caused when the user has forgot to mark the port for resolution. The warning can safely be ignored if not marking the signal for resolution was intentional. Use of mutual recursion ^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: text [ERROR] Himoco_Wrapper: Unable to sort functions based on the call order in [ERROR] Mutual recursion detected between functions: [ERROR] [ERROR] 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.