8. QGen Constraints on Input Models
8.1. Simulink Version
The QGen toolset is compatible with MATLAB and Simulink versions R2015b and newer.
8.2. Simulink Block Types and Constraints
This section lists the Simulink block types supported by QGen and details the constraints under which they are supported. This information is organised in the following sections:
8.2.1. Supported Simulink Block Types (alphabetically)
Block Type |
Library |
Constraints |
|
---|---|---|---|
1 |
|||
2 |
|||
A |
|||
None |
|||
None |
|||
None |
|||
None |
|||
B |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
C |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
D |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
E |
|||
None |
|||
None |
|||
F |
|||
None |
|||
None |
|||
None |
|||
G |
|||
None |
|||
None |
|||
None |
|||
None |
|||
H |
|||
I |
|||
None |
|||
None |
|||
None |
|||
L |
|||
None |
|||
M |
|||
None |
|||
None |
|||
None |
|||
None |
|||
O |
|||
P |
|||
None |
|||
None |
|||
Q |
|||
QGen S-Function builder |
None |
||
R |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
S |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
None |
|||
T |
|||
None |
|||
None |
|||
U |
|||
None |
|||
None |
|||
V |
|||
None |
|||
W |
|||
None |
|||
None |
|||
None |
|||
Z |
|||
None |
|||
n |
|||
8.2.2. Supported Simulink Block Types (by library)
8.2.2.1. QGen
Block Type |
Constraints |
---|---|
QGen S-Function builder |
None |
8.2.2.2. Discontinuities
Link to MathWorks documentation: Discontinuities
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
|
None |
|
8.2.2.3. Discrete
Link to MathWorks documentation: Discrete
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
|
None |
8.2.2.4. Logic and Bit Operations
Link to MathWorks documentation: Logic and Bit Operations
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
|
None |
|
8.2.2.5. Lookup Tables
Link to MathWorks documentation: Lookup Tables
Block Type |
Constraints |
---|---|
None |
|
8.2.2.6. Math Operations
Link to MathWorks documentation: Math Operations
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
8.2.2.7. Model Verification
Link to MathWorks documentation: Model Verification
Block Type |
Constraints |
---|---|
8.2.2.8. Ports and Subsystems
Link to MathWorks documentation: Ports and Subsystems
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
8.2.2.9. Signal Attributes
Link to MathWorks documentation: Signal Attributes
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
|
None |
|
None |
8.2.2.10. Signal Routing
Link to MathWorks documentation: Signal Routing
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
8.2.2.11. Sinks
Link to MathWorks documentation: Sinks
Block Type |
Constraints |
---|---|
8.2.2.12. Sources
Link to MathWorks documentation: Sources
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
|
None |
|
None |
|
None |
|
8.2.2.13. User-Defined Functions
Link to MathWorks documentation: User-Defined Functions
Block Type |
Constraints |
---|---|
None |
|
None |
|
8.2.2.14. Model-Wide Utilities
Link to MathWorks documentation: Model-Wide Utilities
Block Type |
Constraints |
---|---|
8.2.2.15. String
Link to MathWorks documentation: String
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
8.2.2.16. Stateflow
Block Type |
Constraints |
---|---|
None |
|
None |
|
None |
8.2.3. Simulink Block Constraints
8.2.3.1. 1-D Lookup Table
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Supported interpolation methods
Flat and Linear interpolation methods are supported. Nearest and Cubic spline methods are not supported.
Supported extrapolation methods
Clip and Linear extrapolation methods are supported. Cubic spline method is not supported.
Maximum number of table dimensions
Table dimensions higher than 2 are not supported.
8.2.3.2. 2-D Lookup Table
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Supported interpolation methods
Flat and Linear interpolation methods are supported. Nearest and Cubic spline methods are not supported.
Supported extrapolation methods
Clip and Linear extrapolation methods are supported. Cubic spline method is not supported.
Maximum number of table dimensions
Table dimensions higher than 2 are not supported.
8.2.3.3. Assertion
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Empty Callback
Using a callback expression for this block is not supported by QGen. The callback expression must be empty.
8.2.3.4. Assignment
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Number of Output Dimensions
The “Number of output dimensions” parameter should be 1 or 2 as QGen does not support data with larger dimensionality.
No Partial Assignment
When the “Initialize output (Y)” parameter is set to “Specify size for each dimension in table”, the “Action if any output element is not assigned” parameter should be set to “Error”.
8.2.3.5. Backlash
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Supported Size
For non-scalar values, the size of each dimension of the “Deadband width” and “Initial output” parameters should be equal to the size of the corresponding input data dimension.
8.2.3.6. Bus Creator
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Bus objects are not supported for virtual buses
Bus objects are not supported for virtual buses. When creating a virtual bus make sure the BusObject / Output Data Type field is empty.
Names of incoming signals must match the names in the bus object
Bus objects are mandatory for non-virtual buses and the names of the incoming signals must match the names defined in the bus object.
8.2.3.7. Compare To Constant
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Supported Size
For non-scalar values, the size of each dimension of the parameter should be equal to the size of the corresponding input data dimension.
8.2.3.8. Compare To Zero
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
[Zero-crossing detection]
The value of the Enable zero-crossing detection parameter is ignored by QGen as QGen only supports fixed-step solvers.
8.2.3.9. Compose String
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Bounded string types only
The output data type must be a bounded string, defined by stringtype(x)
Exponential notation difference in Windows
The implementation of ComposeString in QGen is using snprintf function from the stdio library. A known difference that occurs in Windows is that the exponential notation prints three decimal digits from generated C code (compiled with gcc) and Simulink simulation outputs two decimal digits.
8.2.3.10. Data Type Conversion
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Integer rounding mode
When MISRA violations are treated as errors, integer rounding mode must be “Zero”.
8.2.3.11. Data Type Duplicate
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
NotGenerated
QGen supports models using this block to provide a seamless experience in Simulink, however no code is generated for this block. The code generated for the model is not affected.
8.2.3.12. Delay
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Delay length source
Delay length source must be set to “Dialog”
External Reset
External reset is not supported.
8.2.3.13. Demux
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Input
Bus signals should not be used at the input of this block.
Note: Use BusCreator and BusSelector blocks instead of Mux and Demux to process bus signals, as recommended in the Simulink documentation.
8.2.3.14. Detect Change
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Frame-based input processing not supported
Input processing mode “Columns as channels (frame based)” is not supported.
8.2.3.15. Detect Decrease
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Frame-based input processing not supported
Input processing mode “Columns as channels (frame based)” is not supported.
8.2.3.16. Detect Increase
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Frame-based input processing not supported
Input processing mode “Columns as channels (frame based)” is not supported.
8.2.3.17. Difference
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Unsupported mode ‘Columns as channels’
Parameter InputProcessing value ‘Columns as channels’ sets the block to frame-based input processing. This mode is not supported.
Boolean input is not supported
Simulink does not recommend to use this block with boolean types. A block with boolean input is rejected.
8.2.3.18. Direct Lookup Table (n-D)
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Maximum number of table dimensions
Maximum number of table dimensions is 2.
8.2.3.19. Discrete Derivative
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Matching input/output base types
Base (element) types of input and output must be the same (follows from MISRA AC SLSF 002 Ver 1.0 2009, Section 3.1.2)
8.2.3.20. Discrete State-Space
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Parameters Value
Parameters cannot be specified empty with []
Note: Use zeros(..) instead of [] to specify an empty parameter
8.2.3.21. Discrete Transfer Fcn
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
External Reset
External reset is not supported.
Input Data Type
Only single or double data types are accepted in input. Integers are not accepted.
Initial States
The value of the initial states should be set to zero.
Input Processing
Input Processing parameter should be set to ‘Elements as channels (sample based)’.
Numerator
Numerator parameter has to be set to Dialog and must be scalar or vector.
Denominator
Denominator parameter has to be set to Dialog and must be scalar or vector.
Initial states
Initial states has to be set to Dialog
Scalar signals
The input, output and InitialStates parameter must be scalar.
8.2.3.22. Discrete-Time Integrator
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Integration Method
Only the Forward Euler Integration and the Backward Euler Integration methods are supported.
Show State Port
Show state port is not supported.
Ignore Limit
Ignore limit and reset when linearizing is not supported.
Conditionally activated subsystems
The DTI cannot be called within a conditionally activated subsystem, such as enabled subsystems or function-call triggered subsystems.
Multiple calls
A DTI block cannot be called by multiple callers or multiple times by a single caller in the same time instance within function-call subsystems.
8.2.3.23. Display
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
NotGenerated
QGen supports models using this block to provide a seamless experience in Simulink, however no code is generated for this block. The code generated for the model is not affected.
8.2.3.24. DocBlock
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
NotGenerated
QGen supports models using this block to provide a seamless experience in Simulink, however no code is generated for this block. The code generated for the model is not affected.
8.2.3.25. Enable
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Enable blocks are not supported in a top-level diagram
An Enable block is not supported in a top-level diagram. A workaround is to wrap the contents of the top-level diagram into an Enabled Subsystem and pass the model-level signal that is designated for enabling the model’s contents through a data port.
8.2.3.26. Enabled and Triggered Subsystem
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Non-scalar input to trigger port is not supported
Non-scalar input to trigger port is not supported.
8.2.3.27. Extract Bits
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Supported input data type
The supported data types in input are: boolean and unsigned integers of length 8, 16 or 32 bits, single and double. Signed integers are not supported. Single and double data go through the block unchanged.
Output data type
An arbitrary number of bits to extract may be specified (between 1 and the input data length). If that number is not 8, 16 or 32, or if the “Preserve fixed-point scaling” mode has been chosen, Simulink may generate a fixed-point data type in output. This output data type will be allowed by QGen to be exported and later on converted to an integer (preserving sign and scaling) with a warning. At the model level, the user should enforce the data type conversion of the output to an integer capable of containing the output (preserving sign and scaling) using a Data Type Conversion block, in order to avoid the propagation of the fixed-point data type to the model.
Output Fixed-Point Format
The supported fixed-point data types accepted by QGen as output of this block in the case they are automatically generated have the following format: “sfix{M}_E{N}” or “ufix{M}_E{N}”, where M is the number of bits extracted and N is the offset from the Least Significant Bit.
8.2.3.28. For Each
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
No nested state
A For Each Subsystem cannot contain blocks with state (e.g. Unit Delay).
Parameter Partition
Applying the ForEach operation on mask parameters of the containing subsystem instead of applying it to the subsystem inputs is not supported by QGen.
Supported Dimensions
“Partition Dimension” and “Concatenation Dimension” parameters should be 1 or 2 because QGen only supports 2-D data.
8.2.3.29. For Each Subsystem
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
No nested blocks with state
A For Each Subsystem cannot contain blocks with state (e.g. Unit Delay).
8.2.3.30. For Iterator
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
External Iteration Limit
Input ports (External value for iterator variable or External value for iteration limit) must be connected to an interface port.
8.2.3.31. Function-Call Generator
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Number of iterations must have a scalar value
The value in the ‘Number of Iterations’ field must be a scalar
8.2.3.32. Hit Crossing
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Hit crossing offset dimensions
If the “Hit crossing offset” is non-scalar, it must have the same dimensions as the block’s input.
8.2.3.33. If
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Maximum Number Of Input Ports
The value of the “Number of inputs” parameter should be less or equal to 1024 as QGen does not support more input ports.
8.2.3.34. Inport
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
“Latch input by delaying outside signal” must be off
“Latch input by delaying outside signal” must be turned off.
“Latch input for feedback signals” must be off
“Latch input for feedback signals of function-call subsystem outputs” (“Latch input by copying inside signal” in earlier Simulink versions) must be turned off.
Note: This parameter exists since MATLAB R2011a
“Latch input by copying inside signal” must be off
“Latch input by copying inside signal” must be turned off.
Note: This parameter exists until MATLAB R2010b
8.2.3.35. Interpolation Using Prelookup
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Max two dimensions
The block supports up to two dimensions. The value of parameter “Table” shall be in either a vector or matrix. “NumberOrTableDimensions” shall be 1 or 2
No explicitly selected dimensions
The parameter NumSelectionDims shall be empty
No saturation
The value of SaturateOnIntegerOverflow parameter shall be either empty or “off”
8.2.3.36. Lookup
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Supported Simulink version
The maximum Simulink version supported for this block is R2010b. Use 1-D Lookup table instead from R2011a.
8.2.3.37. Lookup Table (2-D)
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Supported interpolation methods
Flat and Linear interpolation methods are supported. Nearest and Cubic spline methods are not supported.
Supported exrapolation methods
Clip and Linear extrapolation methods are supported. Cubic spline method is not supported.
Maximum number of table dimensions
Table dimensions higher than 2 are not supported.
8.2.3.38. Lookup Table Dynamic
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
No Saturation
The value of DoSatur parameter shall be either empty or “off”
8.2.3.39. MATLAB Function
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Generates a wrapper only
MATLAB functions will only generate a call to a wrapper that needs to be completed by the user.
8.2.3.40. Math Function
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
“magnitude-2”, “conj” and “hermitian” not supported
The complex-valued functions: “magnitude-2”, “conj” and “hermitian” are not supported.
rem and mod semantics
The semantics of “rem” and “mod” changed between versions 2011b and 2012a. QGen implements the semantics of 2012a and later. In version 2011b, mod(4,-4) is -4, while in recent versions the result is 0.
8.2.3.41. Merge
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Non-empty initial output
The initial output parameter must not be empty ([]).
Equal port widths
The parameter “Allow unequal port widths” must be off.
Inputs from atomic subsystems
In case the block inputs come from the same atomic subsystem, the generated Ada code may not be compilable, and the generated C code may have a different behavior than Simulink semantics. One workaround is to merge the signals inside the atomic subsystem instead of outside. Another workaround is to use the
--full-flattening
QGen option to obtain correct Ada and C code generation.
8.2.3.42. Model Info
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
NotGenerated
QGen supports models using this block to provide a seamless experience in Simulink, however no code is generated for this block. The code generated for the model is not affected.
8.2.3.43. Model Variants
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Only Overriding Variants are supported
Model Variant block must have the ‘Override variant conditions and use following variant’ box checked.
8.2.3.44. Multiport Switch
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Input data dimensions
Variable-size output signal is not supported, so the dimensions of multiple input data ports should match.
8.2.3.45. Mux
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Bus signals cannot be used
Bus signals are not allowed at the inputs of this block.
Note: Use BusCreator and BusSelector blocks instead of Mux and Demux to process bus signals, as recommended in the Simulink documentation.
8.2.3.46. Outport
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Inheriting initial value from the input signal is not supported
Parameter ‘Source of initial output value’ must be set to ‘Dialog’.
Initial output must be specified for conditionally executed subsysems
If the underspecified initialization mode of the model is ‘Simplified’ then the ‘Initial output parameter’ of all outports of conditionally executed subsystems must not be unspecified ‘[]’.
8.2.3.47. Product
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Matrix inversion is not supported
This block cannot have one input with the ‘/’ operator if the multiplication type is Matrix(*)
8.2.3.48. S-Function
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
“Legacy function” supported only with a valid function signature
If the type (MaskType) of S-Function is “Legacy function”, the SFunctionSpec parameter must contain a valid function signature. The function signature is expeted to be in form: [<typename> [<varname> ]= ]<function> (<arglist>).
At minimum, a function name or a header file and a function signature must be specified.
At minimum the information we need is the name of the header file of the external library and a function signature specifying the mapping to block ports and data types of each argument.
When function signature is not provided, function call has to be added to wrapper module manually
This option applies when the S-Function block is not generated using the legacy code tool (or one did not provide the full prototype specification). When function prototype specification is not found in the block specification then qgenc will generate a module named <modelname>_wrappers which contains a function for each generated block. An appropriate function call must be added manually in each wrapper function.
8.2.3.49. Saturation Dynamic
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
No saturation
The value of the ‘Saturate on integer overflow’ parameter shall be either empty or ‘off’
8.2.3.50. Scope
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
NotGenerated
QGen supports models using this block to provide a seamless experience in Simulink, however no code is generated for this block. The code generated for the model is not affected.
8.2.3.51. Selector
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Option “Starting and ending indices (port)” not supported
Indexing option “Starting and ending indices (port)” is not supported
Maximum 3 input ports
The maximum number of input ports is three
Maximum 2D input data
Higher than 2-dimensional input data is not supported
Peculiar combination of parameter options
With the combination of indexing option “Starting index (port)” and “Output sizes” parameter that has a value over 1, an overflow condition may occur. Simulink does not catch the overflow and QGenc cannot catch it either. An “Index check failed” error is given at run time (in generated Ada).
8.2.3.52. Shift Arithmetic
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Binary Point Shift
The “Binary points to shift” parameter is ignored by QGen. QGen does not support shifting the binary points for this block as it may generate fixed-point data in output.
No Floating Point
Floating-point data types should not be used as input for dynamic bit shift using input port because they may lead to non-integer values which are not accepted by Simulink for this port.
Supported Size
For non-scalar values, the size of each dimension of the data of the bit shift number input port or the “Bits to shift: number” parameter should be equal to the size of the corresponding input data dimension.
8.2.3.53. Signal Specification
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Check against ‘Dimensions’ parameter not supported
Check against ‘Dimensions’ parameter not supported: all dimensions should be statically known
8.2.3.54. Signal Viewer Scope
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
NotGenerated
QGen supports models using this block to provide a seamless experience in Simulink, however no code is generated for this block. The code generated for the model is not affected.
8.2.3.55. String Constant
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Bounded string types only
The output data type must be a bounded string, defined by stringtype(x)
8.2.3.56. Sum
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
No sum over dimension mode
The Sum over specified dimension mode is not supported.
Matching input/output base types
Base (element) types of all inputs and output must be the same (follows from MISRA AC SLSF 002 Ver 1.0 2009, Section 3.1.2).
Accumulator data type constraint
The accumulator data type must be set to either “Inherit: Same as first input” or “Inherit: Inherit via internal rule” or be the same as the common base type of the inputs and outputs (follows from MISRA AC SLSF 002 Ver 1.0 2009, Section 3.1.2).
8.2.3.57. Terminator
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
NotGenerated
QGen supports models using this block to provide a seamless experience in Simulink but the block does not affect the code generated for the model. No code is generated for this block.
8.2.3.58. To Workspace
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
NotGenerated
QGen supports models using this block to provide a seamless experience in Simulink, however no code is generated for this block. The code generated for the model is not affected.
8.2.3.59. Transfer Fcn First Order
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Boolean and integer inputs not supported
Only floating-point types are supported
8.2.3.60. Transfer Fcn Lead or Lag
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Boolean and integer inputs not supported
Only floating-point types are supported
8.2.3.61. Transfer Fcn Real Zero
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Boolean and integer inputs not supported
Only floating-point types are supported
8.2.3.62. Trigger
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Only function-call triggers are supported in a top-level diagram
A Trigger block with trigger type other than “function-call” (i.e., “rising”, “falling” or “either”) is not supported in a top-level diagram. If such a data-drive Trigger is needed, then a workaround is to wrap the contents of the top-level diagram into a Triggered Subsystem and pass the model-level signal that is designated for triggering the model’s contents through a data port.
Initial trigger signal state must be set to “compatibility (no trigger on first evaluation)”
The property “Initial trigger signal state” must be set to “compatibility (no trigger on first evaluation)”.
Treat as Simulink function must be “off”
The property “Treat as Simulink” function must be “off”.
8.2.3.63. Triggered Subsystem
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Non-scalar input to trigger port is not supported
Non-scalar input to trigger port is not supported.
8.2.3.64. Trigonometric Function
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Complex exponential not supported
Function: “cos + jsin” is not supported (complex-valued operation).
Approximation method not supported
The “Approximation method” option must be set to “None”.
8.2.3.65. Uniform Random Number
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Minimum and Maximum same dimensionality
Parameter “Minimum” must have the same dimensions as parameter “Maximum”.
8.2.3.66. UnitConversion
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Only a subset of units is supported
There is a table in <install_dir>/share/qgen/library/supported_units.txt that contains the supported conversions. Users can add new entries to this table. Every entry contains 6 fields: Dimension, Symbol, SI, Scale, Inverse and Offset, where Dimension is the physical variable (Length, Mass, Time, Temperature, Angle, Velocity), Symbol is the string used in Simulink to represent the unit, SI indicates whether it belongs to the unit the International System of Units, Scale is the conversion factor between the unit and its correspondent unit in the International System, Inverse indicates whether we need to divide instead of multiply, and Offset is the offset to add in the conversion.
8.2.3.67. Wrap To Zero
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
WrapToZero Threshold dimensions
Parameter “Threshold” must have the same same dimensions as input, except if parameter “Threshold” is a scalar.
8.2.3.68. n-D Lookup Table
Links to Mathworks Documentation
Block Type |
Library |
---|---|
QGen Usage Constraints
Supported interpolation methods
Flat and Linear interpolation methods are supported. Nearest and Cubic spline methods are not supported.
Supported extrapolation methods
Clip and Linear extrapolation methods are supported. Cubic spline method is not supported.
Maximum number of table dimensions
Table dimensions higher than 2 are not supported.
8.2.4. Additional Simulink Block Constraints
8.2.4.1. S-Functions and Legacy Code
8.2.4.2. Lookup and Interpolation Blocks
The blocks where interpolation or lookup table are given by input port (Lookup Table Dynamic, Prelookup,Interpolation Using Prelookup) can not appear in a model where the table data is received from a top-level input. This includes models referenced by Model Reference block.
8.3. Other Simulink Constraints
8.3.1. Model Configuration Parameters
8.3.1.1. Solver
Solver type should be discrete, fixed-step.
8.3.1.2. Diagnostics
Model Initialization must be set to “Simplified” or, if it is set to “Classic”, then “Detect multiple driving blocks executing at the same time step” must be set to “error”.
8.3.2. Blocks Configuration
All blocks should have sample time set to “inherited”, except in the case of non-directfeedthrough blocks (UnitDelay, DiscreteTimeIntegrator, …).
8.3.3. Signal Dimensions
Scalar, vectors and two-dimensional matrices are supported. Matrices with more dimensions are not supported.
8.3.4. Data Dictionaries
Data Dictionaries are supported, however it is mandatory to make sure that each data dictionary of a given model references the data dictionaries of its child referenced models in the section below. This was mandatory until R2018b in Simulink but Simulink R2019a is no longer enforcing this behavior, yet QGen still requires data dictionaries to use the reference mechanism.
8.3.5. Library Factorization
QGen can generate a single function that will be called for all instances of an Library Atomic Subsystem that share the same interface. The Atomic subsystem should also not use any Model Workspace or Data Dictionary data in order to be factorized.
8.3.6. Custom Data Types
It is possible to generate code with externally declared datatypes. See Custom Data Types for the details.
8.3.7. Use of Callback Functions
Simulink allows adding callback functions to models, blocks or port. These functions may be there just for documentation purposes. QGenc does not support callbacks functions. It is up to the user to verify they are not present or, if present, they do not affect the model behaviour.
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 QGen.
8.3.8. Real-valued Computations Only
QGen supports only integer and floating point -valued signals and computations. Complex values are not supported.
Fixed-point values are not supported, with an exception when automatically generated by Simulink for the blocks listed below. In such cases, fixed-point data type will be exported to XMI, and later on converted to integer (preserving sign and scaling) in QGen preprocessor.
The supported list of blocks is:
The supported fixed-point formats are types:
starting with the “sfix” or the “ufix” prefix
if scaling is used, containing “E” or/and “n” characters in the encoding suffix
Refer to Mathworks documentation for more information about fixed-point formatting.
Parameters that control the signal type, e.g. “Output signal type” must have value “real” or “auto”.
8.3.9. Bus Signals
QGen supports both virtual and non-virtual buses. For more information about the code generation for buses, see the Custom Data Types section.
Buses are supported at the input-output of following Simulink blocks
Bus Creator
Bus Selector
Bus Assignment
Signal Conversion
Inport
Outport
Unit Delay
Switch
8.3.10. Forwarding Tables in Libraries
Forwarding Tables can be used in Simulink libraries. There are a few restrictions in their use:
Transformation Functions are not supported
The redirection of blocks can only be defined in the library where this block is defined. For example, if we want to map “LibA/BlockA” to “LibB/BlockB”, this redirection can only be defined in “LibA”.
8.3.11. MISRA Simulink Guidelines
QGen automatically checks that the input model conforms to selected MISRA Simulink constraints. QGenc should not be used as a MISRA checker tool. The checks are limited to constructs which directly influence the code generation policy. For full check one should use a dedicated MISRA checker.
Via the –no-misra option, qgenc
can cope with models violating the checked
MISRA constraints. However, we suggest to adopt at minimum the following rules:
Blocks that can be configured to use saturation must have this flag off. The Saturation or Saturation Dynamic blocks should be used, if saturation is needed.
Blocks other than the Rounding block that can be configured to use different rounding options must be set to round towards zero. The only exception is Data Type Conversion, where the rounding option is also supported.
Data type conversion of block input and output should be done using the Data Type Conversion block and not by other blocks with block specific type conversion options.
8.3.12. Simulink Coder(TM) Parameters
qgenc
respects selected parameters from Signal and Parameter objects that
do not influence the model semantics and are intended for tuning the Simulink
Coder behaviour. The semantics may not be necessarily the same as that assumed
by the Simulink coder. Below is the table of supported parameters their values
and impact on the generated code.
Value |
Notes |
Ada |
C |
---|---|---|---|
Auto, Default, Global or SimulinkGlobal |
In case of a Signal object, the variable is defined in module corresponding to containing subsystem. A constant corresponding to a Parameter object is defined in <modelname>_params module. |
|
|
ExportedGlobal |
A constant (in case of Parameter) or variable (in case of Signal) is defined in <modelname>_params module. |
|
|
ExportToFile |
The Header file parameter is obligatory. A constant (in case of Parameter) or variable (in case of Signal) is defined in the module defined in Header file parameter. |
|
|
ImportedExtern |
A constant (in case of Parameter) or variable (in case of Signal) is defined with “extern” qualifier. If Header file parameter has value, with/include statement is generated for this module |
|
|
ImportFromFile |
The Header file parameter is obligatory. With/include statement is generated for this module. When generating ada code and the included module has “.h” extension, an additional import declaration is generates in module <modelname>_params |
|
|
Const |
Applies to Parameter object only. Adds “const” qualifier to generated variable. Has effect only in case of –const-as-vars, as by default all parameters are treated as constants. |
|
|
Volatile |
Adds “volatile” qualifier to generated variable/constant and import statement |
|
|
ConstVolatile |
Applies to Parameter object only. Adds “const” qualifier to generated variable. Has effect only in case of –const-as-vars, as by default all parameters are treated as constants. |
|
|
Define |
Applies to Parameter object only. Adds “const” qualifier to generated variable in case of Ada. In case of c generates a macro definition |
|
|
The Header file parameter is supported for some storage classes as described above. The parameter or signal variable is defined in the module specified by the headerfile attribute. Depending on the storage class the module is either generated (ExportToFile) or assumed to exist (ImportFromFile, Volatile, Const, ConstVolatile).
Note
We recommend that you use a consistent way to assign storage classes, preferably Signals defined in the workspace of your choice. This provides an explicit definition that is easy to track.
8.4. MATLAB
8.4.1. MATLAB .p and .mat Files
MATLAB .p and .mat files are not supported.
8.4.2. MATLAB Code for Parameters in Workspace Containers and Block Parameters
8.4.2.1. Dimensions of data
Scalars, vectors and two-dimensional data (matrices) are supported. Data with more dimensions is not supported.
Non-scalar data should not contain casts as part of the contained elements.
8.4.2.2. Accepted Constructs
QGen will export the data that is used within the set of models targeted by the code generation process, based on the workspace containers specified for each model. To define such data in the base workspace for example, one can use sets of .m files that are manually or automatically loaded as part of the model setup.
Only constant definitions are accepted in .m files. The supported format is:
<identifier> = [<data type> (] <value> [)];
where
<identifier> := <constant name>[.<structure element name>]
<value> := <literal value> | <expression>
Datastructures are defined implicitly by assigning values for each structure element. There is currently no way to attach explicitly defined data type to a constant.
Values can be composed of literal values, references to other constants and expressions including of arithmetic operators and supported functions (see section “MATLAB functions” below).
Annotation delimiter is “%”.
Examples
% Constant definition, implicit data type
MyIntParam = 15;
% Constant definition, explicit data type
MyDoubleParam = double (100);
% Array with explicit data type
MyArrParam = double ([1 2 3]);
% Definition of a constant structure
MyStructParam.Elem1 = 1;
MyStructParam.Elem2 = [1 2 3];
MyStructParam.Elem3 = MyIntParam;
% Expression using other constants
MyIntParam2 = int8 (MyIntParam + MyDoubleParam);
8.4.2.3. Type Definitions
Type definitions are not supported in parameter .m-files. However, QGen supports several ways of using custom data types. See Custom Data Types for further details.
The only exception is an implicit type definition of a structure (record) parameter. QGen infers the type definition from the instance definition in the parameter file. See MATLAB Code for Parameters in Workspace Containers and Block Parameters.
Type definitions should be scalars to be accepted by QGen; arrays containing type definitions are rejected.
8.4.3. MATLAB Operators
The following unary operators are supported:
+ - ~
The following binary operators are supported:
+ - * .* / ./ ^ .^ < <= > >= ~= || && :
Supported values for “:” are detailed in the MATLAB Expressions section below.
8.4.4. MATLAB Functions
The following MATLAB functions are supported in both .m files and Simulink block parameters:
abs, acos, asin, atan, atan2, bin2dec, ceil, cos, cosh, exp, floor,
hex2dec, log, log10, min, max, mod, rem, round, sign, sin, sinh, sqrt, tan,
tanh, isinf, isnan, isfinite.
Explicit typing/casting expressions are supported for:
int8, int16, int32, uint8, uint16, uint32, single, double, logical
In addition to numeric literals, the following literals are supported as well:
Inf
8.4.5. MATLAB Expressions
Expressions containing the colon operator can only be used to get a slice of a vector (without increment value):
mySlice = myVector(3:8);
The following expressions are not supported:
Matrix partial indexing:
myMatrix(:,1);
myMatrix(1:3);
Creation of row vector:
MyVector = [10:20];
Vector slice with increment value:
mySlice = myVector(1:5:20);
In case there is a need for using such subarrays, then you should do the slicing
in MATLAB and feed an appropriate subrarray to qgenc
.
For instance when myMatrix is a two dimensional array and a model contains block parameter with value myMatrix (:,1) (i.e. the parameter is a vector containing the first column from matrix) then:
the original matrix is
myMatrix = [1 2; 3 4];
create a vector variable myVector1 in MATLAB
myVector1 = myMatrix(:,1);
copy the vector value to the .m file that is given as an argument to
qgenc
myVector1 = [1 3];
replace the expression “myMatrix(:,1)” in model with “myVector1”
assign to a structure in array:
myVector1(1,2).member = 1;
8.4.6. MATLAB cell arrays
Cell arrays in MATLAB workspace are not supported. qgen_export_workspace generates warning and array is not exported. When the array is referenced from Simulink model then code generation fails.
8.4.7. Supported Enumerations
Enumerations should all inherit from a signed Integer superclass to be accepted by QGen.
8.4.8. Char Arrays
Char arrays are not supported when defined in any Workspace container. They can however be used in mask parameters, Simulink.Signals or Parameters properties.
8.4.9. Empty Arrays
In most cases empty arrays will be rejected by QGen, and should not be used to initialize values used in the model.
8.4.10. Evaluable Simulink Expressions
Values evaluated with slexpr() are not suppported.
8.5. Stateflow chart modelling rules
Stateflow charts must comply to the following modeling rules and constraints.
8.5.1. Event broadcast for local events shall not to be used
Description: Stateflow event broadcast mechanism for Stateflow local events shall not to be used. Dataflow shall be used for controlling the chart’s mode instead.
Note: An exception is broadcasting external events, i.e. events that are received by other parts of the (Simulink) model than the broadcasting chart itself. Such events do not directly affect the behaviour of the chart. The only affect is changing global data. This kind of broadcasting is allowed. Typically the trigger type of the event/port is in such cases “Function call”.
Justification: Some forms of event broadcast can lead to non-termination. Broadcasting an event in a transition action is one case that can never lead to non-termination by itself. In other cases static checks could be used to detect potentially looping behaviour.
8.5.2. Output event of a chart shall have the “Function call” trigger type
Description: The trigger type property of an output event of a chart shall have be “Function call”.
Justification: Function call events ensure unambiguous and controllable timing of event broadcasts. Output events with edge trigger type can create confusing models, because an event can be triggered several times in Stateflow, but is seen once or not at all in the Simulink part.
Note
Input events having a trigger type “Rising”, “Falling” or “Either” are supported by QGen.
8.5.3. [REMOVED]
This constraint was applicable up to version 2.1.2 of QGen. It was removed in version 17 and is no longer relevant in subsequent versions.
This section is preserved for traceability of constraints across different versions of QGen.
8.5.4. [REMOVED]
This constraint was applicable up to version 1.0.1 of QGen. It was removed in version 2.0.1 and is no longer relevant in subsequent versions.
This section is preserved for traceability of constraints across different versions of QGen.
8.5.5. Transition actions shall not be used in graphical functions and pure flow-graph decompositions. Condition actions shall be used instead.
Description: Transition actions shall not be used in graphical functions and pure flow-graph decompositions.
Note
This rule applies to pure flow-graphs only. It does not concern OR compositions of states, where transition actions are very appropriate.
Justification: This is a robustness constraint against effectively dead modelling constructs. Transition actions are meaningless in the above-mentioned cases since they are executed only when there is a transition from state to state (some versions of Stateflow allow to specify such actions, but they are never executed). In flow-graph networks condition actions should be used instead.
8.5.6. An OR decomposition must always have an unguarded default transition
Description: An OR decomposition must always have an unguarded default transition. Exception: An OR decomposition with only one substate can exist without a default transition. However, when any default transitions are present, then at least one must be unguarded.
Justification: If this condition is not satisfied then a run-time error due to state inconsistency can result, when a decomposition is entered, since it means that a system is in inconsistent state. When the decomposition consists of one substate only, then there is no need for the default transition. However, default transitions might exist, with different transitions specifying different actions. In the last case one of them must be without a guard to avoid confusion reading the model, as in Stateflow the state is nevertheless entered.
8.5.7. [REMOVED]
This constraint was applicable up to version 17.1 of QGen. It was removed in version 17.2 and is no longer relevant in subsequent versions.
This section is preserved for traceability of constraints across different versions of QGen.
8.5.8. Boxes shall only be used for grouping functions
Description: Boxes shall only be used for grouping functions.
Justification: Justification: Using boxes around states or flow-graph networks creates strange and complex scoping. The logical scoping for executing the chart’s sections and the name scopes introduced by boxes do not match. Boxes are fine for grouping graphical functions and truthtable functions.
8.5.9. Only bounded flow-graph loops should be used
Description: Flow-graph loops can cause non-termination of the chart’s execution. The loops should be designed with care and preferrably use a simple for-style pattern.
Note
This rule is currently not checked by QGen.
8.5.10. The transition arc shall not leave its logical parent’s boundary
Description: The transition arc shall not leave the boundary of the logical parent of the transition (the lowest common ancestor of the source and destination states).
Warning
Stateflow issues a warning about such transition arcs when simulating the model. This rule is not checked by QGen. In case such arcs exist the behaviour in Stateflow can have some side-effects that are not taken into account by QGen.
Justification: This is an error-prone pattern. The detailed semantics for such transitions is complicated and unintuitive. Identical or similar behaviour can be obtained by more clear and explicit constructs.
8.5.11. Super step semantics shall not be used
Description: The Stateflow super step semantics is not supported. This option should be turned off in charts supplied to QGen.
8.5.12. Variable-size arrays shall not be used
Description: The variable-size arrays in Stateflow are not supported. This option should be turned off in charts supplied to QGen.
8.5.13. Only C action language shall be used
Description: QGen does not support the MATLAB action language.
8.5.14. Moore charts shall not be used for breaking data loops
Description: It is possible in Simulink/Stateflow to use Moore charts for breaking causality of data feedback loops (algebraic loops). This is currently not supported in QGen.
If a Moore chart is used in a data feedback path make sure there is also some non-direct feedthrough block, such as Unit Delay on the same path.
8.5.15. Simulink functions shall not be used
Description: Using Simulink functions in Stateflow charts is currently not supported by QGen. Similar functionality can be modelled with an external Simulink subsystem that has the necessary data inputs-outputs connected to the chart’s io and that is triggered by a function call event from the chart.
8.5.16. History junctions shall not be used
Description: History junctions are not supported by QGen. Their use is also deprecated by the MISRA AC SLSF guide (rule 046) as it complicates interpretation of the model’s semantics.
The history can be modelled with an explicit local variable and transitions instead.
8.5.17. [CHANGED] Absolute-time temporal logic shall not be used
Description: The Stateflow absolute-time temporal logic operators and events are currently not supported by QGen.
This constraint has been changed in QGen version 18, where the support for event-based temporal logic was added. In earlier versions neither event-based nor absolute-time temporal logic were supported.
8.5.18. Change detection functions shall not be used
Description: The Stateflow change detection functions: ‘hasChanged’, ‘hasChangedFrom’ and ‘hasChangedTo’ are currently not supported by QGen.
8.5.19. ‘in <state>’ operator shall not be used
Description: The ‘in <state>’ operator is currently not supported by QGen.
8.5.20. Data stores shall only be accessed through chart’s I/O
Description: Defining or accessing data stores directly from Stateflow chart is not supported. If referring or modifying a value of a Data Store is needed in Stateflow, create resp. Data Store Read and Write blocks and connect them to the chart’s I/O.
8.5.21. Some C math functions are not supported
Description: Most C math functions are supported. The exceptions are “labs”, “atan2”, “fmod”, “ldexp” and “rand”.
8.5.22. Messages and queued communication are not supported
Description: The Stateflow message objects and queued communication are not supported. If queuing is required, then the necessary mechanism should be explicitly modeled.
8.5.23. An AND decomposition must not contain transitions or junctions
Description: Transitions and junctions have proper semantics only for OR decompositions. In some cases Stateflow allows them also in AND decompositions, but this pattern shouldn’t be used.
8.5.24. Nested graphical functions are not supported
Description: QGen does not support nested graphical functions.
8.5.25. Boxes are not supported in functions
Description: QGen does not support boxes in graphical functions.
8.5.26. Machine-level data are not supported
Description: QGen does not support defining shared data at the Stateflow root level. Data objects must be defined at the level of a chart or below.
8.5.27. Box-level data are not supported
Description: QGen only supports defining functions in boxes. Local or parameter data may be defined at a function level.
Warning
This rule is currently not checked by QGen. The behaviour of simulation and code generated by QGen can be different.
8.5.28. Simulink states are not supported
Description: QGen does not support the state kind ‘Simulink state’.
8.5.29. Custom C code is not supported
Description: QGen ignores any custom code specified in the model and such code cannot be referenced from Stateflow charts.
8.5.30. Literal code (the literal code symbol ‘$’) is not supported
Description: Literal code (the literal code symbol $) is currently not supported in Stateflow actions and guards.
8.5.31. The ‘change’ (‘chg’) event is not supported
Description: The implicit ‘change’ (‘chg’) event is currently not supported.
8.5.32. The time symbol ‘t’ is not supported
Description: The absolute time symbol ‘t’ is not supported by QGen.
8.5.33. The reference ‘*’ and dereference ‘&’ operators are not supported
Description: These operators (i.e. pointers) are not supported in Stateflow guards and actions.
8.5.34. The shorthand notation for combining multiple state action conditions is not supported
Description: QGen doesn’t support the state label notation where multiple action conditions have been combined. E.g., the following are not supported:
en, ex: Out1++
du, on e1: Out2++
Workaround: Specify each action condition separately and duplicate the action.
en: Out1++
ex: Out1++
du: Out2++
on e1: Out2++
8.5.35. Explicit type cast operator ‘cast’ is not supported
Description: QGen doesn’t currently support this operator.
8.5.36. The type reference operator ‘type’ is not supported
Description: QGen doesn’t currently support this operator.
8.5.37. [CHANGED] The ‘bind’ keyword is not supported
Description: QGen does not support the “bind” keyword in state labels.
The constraint is enforced since QGen version 22. In earlier versions the construct was accepted, but ignored by QGen.
8.5.38. The ‘Saturate on integer overflow’ property of a Stateflow chart must be set to “off”
Description: QGen does not support this feature.
8.5.39. The ‘Create output for monitoring’ property of a Stateflow chart or state must be set to “off”
Description: QGen does not support this feature.
8.5.40. Stateflow functions with multiple output data definitions are not supported
Description: QGen does not support multiple output data definitions (formal parameters with direction ‘out’) in Stateflow functions. However, a single non-scalar output is supported. The number of non-scalar input arguments is not limited.
8.5.41. Stateflow functions with non-scalar output must only be used in simple assignments
Description: QGen supports calling Stateflow functions with non-scalar output only from statements of following form:
Y = fun(X)
Combining and/or nesting such calls with other expressions is currently not supported.
8.5.42. Inlining graphical functions is not supported
Description: QGen currently ignores the ‘Function Inline Option’ of Stateflow functions and treats them always as if the option was set to “Function”.
8.5.43. The first index of non-scalar data must be 0 (default)
Description: The ‘First index’ property of any Stateflow data object must be set to 0 or be unset (left to default).
8.5.44. Atomic subcharts are not supported
Description: QGen doesn’t currently support the option ‘Atomic Subchart’ in the ‘Group & Subchart’ properties of state objects. You may, however, use the options ‘Group’ and ‘Subchart’.
Note
This also means that subcharts cannot be referenced from libraries. To reuse charts place the entire chart to a library.
8.5.45. Strong data typing with Simulink I/O must be used
Description: The chart option “Use Strong Data Typing with Simulink I/O” must be set.
8.5.46. Commented out elements are not supported
Description: QGen doesn’t support commented out state chart elements, such as states, transitions, functions and junctions.
8.5.47. Object names must not coincide with keywords
Description: The names of user-defined objects must not coincide with any Stateflow keyword. The list of currently known unsupported names is provided in the following section. In some cases using such a name for a user-defined object is supported in Stateflow, but such models have confusing and error-prone semantics.
Warning
This rule is currently not checked by QGen. The behaviour of simulation and code generated by QGen can be different.
8.5.47.1. Stateflow Keywords
Boolean symbols
true
false
Change detection
hasChanged
hasChangedFrom
hasChangedTo
Complex data
complex
imag
real
Data types
boolean
double
int8
int16
int32
single
uint8
uint16
uint32
Data type operations
cast
fixdt
type
Explicit events
send
Implicit events
change
chg
tick
wakeup
Messages
send
forward
discard
isvalid
length
receive
Literal symbols
inf
t (C charts only)
MATLAB functions and data
matlab
ml
State actions
bind
du
during
en
entry
ex
exit
on
State activity
in
Temporal logic
after
at
before
every
sec
msec
usec
temporalCount
elapsed
t
duration
count
C Math Functions
‘abs’, ‘fabs’, ‘sin’, ‘cos’, ‘tan’, ‘sinh’, ‘cosh’, ‘tanh’,
‘asin’, ‘acos’, ‘atan’, ‘log’, ‘log10’, ‘ceil’, ‘floor’, ‘sqrt’,
‘exp’, ‘pow’, ‘fmod’, ‘labs’, ‘ldexp’, ‘atan2’, ‘rand’
8.5.48. Transition paths involving states must not contain flow-graph loops
Description: Transition paths that start or end in a state must not contain a flow-graph loop, i.e. a loop involving only transitions and junctions, on the transition path.
Note
Transition paths that start and end in the same state, but do not involve a flow-graph loop according to the above criteria are not concerned by the current constraint and are allowed.
Flow-graph loops involving only transitions and junctions are, however, allowed in graphical functions and inner compositions of states. Such graphical functions can, for example, also be called from transition or condition actions of transitions having a path to or from a state.
8.5.49. Atomic boxes are not supported
Description: QGen doesn’t currently support the option ‘Atomic Subchart’ in the ‘Group & Subchart’ properties of box objects. You may, however, use the options ‘Group’ and ‘Subchart’.
Note
This also means that subcharts cannot be referenced from libraries. To reuse charts place the entire chart to a library.
8.5.50. “Data must resolve to signal object” is not supported for local data
Description: QGen doesn’t currently support the option “Data must resolve to signal object” for local data. You may, however, use this option for the chart’s outputs.
8.5.51. “Treat Exported Functions as Globally Visible” option is not supported
Description: QGen doesn’t currently support the chart-level option “Treat Exported Functions as Globally Visible”. Functions exported from a chart must be called using a qualified name.
8.6. Target Languages
8.6.1. Ada / SPARK
QGen generates Ada code compliant with the Ada 83, Ada 95, Ada 2005, Ada 2012 and SPARK 2014 standards.
Generated code might be non-compilable when the source of a Merge block is an atomic subsystem. This limitation will be fixed in a future QGen release.
8.6.2. MISRA-C
QGen generates C code compliant with the C89/C99 ANSI standard and MISRA C:2012 guidelines.
8.7. XMI Support
The XMI importer has the following limitations:
The
xsi:type
of an object is specified using the fully qualified name:<?xml version="1.0" encoding="ASCII"?> <geneauto.emf.models.gacodemodel:GACodeModel ...> <elements xmi:type="geneauto.emf.models.gacodemodel:Module" ... /> <geneauto.emf.models.gacodemodel:GACodeModel>
The
xmi:id
attribute is used to resolve references to elements and is always required for every node. XPath expressions are not (and will not be) supported. For example, the following XMI is acceptable:<expressions xmi:type="geneauto.emf.models.gacodemodel.expression:VariableExpression" xmi:id="830" ... variable="404"/> ... <variables xmi:type="geneauto.emf.models.common:Variable" xmi:id="404" ... />
Where the
variable
attribute in the first node references thexmi:id
of the second node.If two features are one the eOpposite of the other, the values for both need to be included in the XMI file.
These limitations are not planned to be alleviated.