Variant Size for Arrays and Matrices
The size of an array or matrix is determined when the element is created. In addition, ASCET allows the determination of variants in array/matrix sizes via system constants (including user-defined system constants).
The following rules apply:
- Only system constants in the same component as the array/matrix can be used for variant size determination.
- The system constants used for variant size determination must be of type limitInt, wrapInt, sdisc, udisc, or enumeration.
- For an array/matrix of scope exported, system constants of scope exported or imported can be used for variant size determination.
- For an array/matrix of scope local, system constants of scope local or exported or imported can be used for variant size determination.
If you use an array or matrix that has at least one dimension with a system constant size, keep the following in mind:
- Index protection (see Code Generation Options, Protected Vector Indices) uses the value of the system constant instead of the max. size.
- If the Resolve System Constants option in the ASCET options window, "Targets\<target>\Build" node of the selected target, is set to Generation Time, the initial value of the system constant is used to transform the variant-size array/matrix into a fixed-size array/matrix.
If the Resolve System Constants option in the ASCET options window, "Targets\<target>\Build" node of the selected target, is set to Compile Time, the
following constraints are checked and the
following happens.If the Resolve System Constants option in the ASCET options window, "Targets\<target>\Build" node of the selected target, is set to Run Time, the
following happens.- Models that use normal arrays/matrices with variant size can only be exported to ASCET V6.2.0 or newer.
- Models that use arrays/matrices with variant size as messages can only be exported to ASCET V6.4.0 or newer.
- Models that use arrays larger than 2048 elements or matrices with one or both axes larger than 63 can only be exported to ASCET V6.4.3 or newer.
- The generated initialization code for arrays/matrices with variant size is affected by the setting of the Generating Sparse Arrays target option; see Initialization of Composite Elements.
See also
Initialization of Composite Elements
Variable Size for Arrays and Matrices
Constants and System Constants
Project Editor – Code Generation Options
Properties Editor – Editing the Configuration of a Composite Element