AUTOSAR applications use data constraints to implement limits on data types and provide a controlled range of possible values. Internal data constraints represent minimum and maximum values for implementation data types, reflecting the internal or machine view of the data.
By default, code generation does not export internal data constraint information for AUTOSAR implementation data types in ARXML code. If you want to force export of internal data constraints for implementation data types, select the XML option Internal DataConstraints Export.
If you select Internal DataConstraints Export, the exporter
generates internal data constraints into an AUTOSAR package with a default name,
DataConstrs
, at a fixed location under the AUTOSAR data type
package. Optionally, use the XML option Internal DataConstraints
Package to specify a different AUTOSAR package name and path.
To configure export of AUTOSAR internal data constraint information in your model:
Open the AUTOSAR Dictionary. On the AUTOSAR tab, select Settings > AUTOSAR Dictionary.
Select XML Options. In the XML options view, under Additional Options, select Internal DataConstraints Export.
Optionally, under Additional Packages, enter a package path for Internal DataConstraints Package.
Build the model and inspect the generated code. Here is an example of an AUTOSAR internal data constraint exported to ARXML code.
<AR-PACKAGE> <SHORT-NAME>IDC</SHORT-NAME> <ELEMENTS> ... <DATA-CONSTR UUID="..."> <SHORT-NAME>DC_SInt8</SHORT-NAME> <DATA-CONSTR-RULES> <DATA-CONSTR-RULE> <INTERNAL-CONSTRS> <LOWER-LIMIT INTERVAL-TYPE="CLOSED">-128</LOWER-LIMIT> <UPPER-LIMIT INTERVAL-TYPE="CLOSED">127</UPPER-LIMIT> </INTERNAL-CONSTRS> </DATA-CONSTR-RULE> </DATA-CONSTR-RULES> </DATA-CONSTR> </ELEMENTS> </AR-PACKAGE>
Alternatively, you can programmatically configure the AUTOSAR XML options Internal DataConstraints Export and Internal DataConstraints Package. For example:
arProps = autosar.api.getAUTOSARProperties(hModel); set(arProps,'XmlOptions','InternalDataConstraintExport',true); set(arProps,'XmlOptions','InternalDataConstraintPackage','/pkg/misc/IDC');
For more information, see Configure AUTOSAR XML Options.