SwDataDefProps - Attributes and Use Cases
Data definition properties can be added to data types and data prototypes, to complement their description with various attributes. They play a vital role in the meta-model, providing an enormous amount of information in each meta-class the SwDataDefProps
are aggregated. Therefore, understanding each attribute, applicability for the respective meta-classes and precedence will allow you to tame this small beast and take advantage of the Autosar meta-model.
SwDataDefProps Meta-Class and its Attributes
SwDataDefProps
specify the structure of elements for calibration, implementation aspects for elements, define the access policy for measurement and calibration (MCD), semantics of data elements and the code generation policy.
The attributes englobed by the SwDataDefProps
meta-class are defined below:
-
Annotation
– An aggregation of multipleannotations
, enabling the addition of notes related to this meta-class. -
AdditionalNativeTypeQualifier
– ANativeDeclarationString
used to define a set of native C qualifiers (volatile
,strict
,enum
...) that cannot be deducted via theBaseType
(typical with pointers) or from other more abstract attributes. All the qualifiers need to be provided sequentially. -
BaseType
– A reference to theSwBaseType
associated with the data object. Commonly placed at the implementation data level to build a bridge between it and the C data type generated by the RTE. -
InvalidValue
– The aggregation to an optionalValueSpecification
that defines the invalid value of the data object. -
CompuMethod
– A reference to aCompuMethod
, associated with the data object semantics. -
DataConstr
– A reference toDataConstr
applied to this element. -
DisplayFormat
– ADisplayFormatString
that describes how the data object value should be displayed in documents and MCD tools. -
DisplayPresentation
– An enumeration that defines the way the object is displayed within an MCD tool. The possible values arepresentationContinuous
(forming a continuous plot between each point) orpresentationDiscrete
(a clear separation exists between each plot point). -
ImplementationDataType
– Reference to anAbstractImplementationDataType
, used when the data object does not refer directly to a base type, which can occur the same way it does in the C programming language, for example, when theImplementationDataType
is redefined via a typedef to anotherImplementationDataType
, theSwPointerTarget
, data type of an array or record element within anImplementationDataType
or the data type of anSwServiceArg
does not refer to a base type directly. -
StepSize
– Defines a value that can be added or subtracted to theDataPrototype
when using the plus (+) and minus (-) keys while performing calibration with an MCD tool. -
SwAddrMethod
– A reference that associates aSwAddrMethod
to this data element. This attribute can be used to group severalDataPrototypes
that should be grouped together in the same memory region, without specifying the region itself at this stage of development. This and the next attribute provide valuable information for the Memory Mapping (MemMap) module in the BSW. If you need to learn more about it, check our post Memory Mapping (opens in a new tab). -
SwAlignment
– AnAlignmentType
definition, that indicates the intended alignment for theDataPrototype
. If it is not specified, then the alignment is determined by the size of theswBaseType
and thememoryAllocationKeywordPolicy
present in theswAddrMethod
. The possible values areUNKNOWN
(deprecated, must not be used in new implementations),8
,16
,32
,64
,UNSPECIFIED
,BOOLEAN
orPTR
. -
SwBitRepresentation
– Aggregation of aSwBitRepresentation
. In case of a bit variable, it defines its binary presentation, through the attributesbitPosition
(position within a bigger data objectSwHostVariable
) andnumberOfBits
(the number of bits it occupies within a bigger data object). -
SwCalibrationAccess
– Enumeration that defines the read and write access rights of the MCD tools to this data object. It can benotAccessible
,readOnly
orreadWrite
. -
SwCalprmAxisSet
– Aggregation of aSwCalprmAxisSet
that specifies the axes properties, when dealing withMAPs
,CURVEs
, and other objects of the sort. It is mostly used for calibration parameters. -
SwComparisonVariable
– An aggregation of multipleSwVariableRefProxies
, a set of variables used for comparison in an MCD process. -
SwDataDependency
– Aggregation of a singleSwDataDependency
, that specifies how the MCD system can calculate the value of this object through the value of another data object. -
SwHostVariable
– Reference to aSwVariableRefProxy
that is the bigger object (the host variable) of a bit variable. -
SwImplPolicy
– Enumeration that describes the implementation policy of this data object. It is defined by aSwImplPolicyEnum
which can take one of five possible values:const
(should not be modified by the ECU and results in theconst
modifier in the resulting C code),fixed
(the value will never change and should be implemented as a macro in C),measurementPoint
(value created only for measurement purposes and should never be read directly by the software running in the ECU),queued
(the data element contents should be stored as a queue and processed as a FIFO, and the RTE should implement queuing for this data object) andstandard
(applicable for all types of data objects). -
SwIntendedResolution
– Number that describes the resolution of a data element in a preliminary phase of development, when aCompuMethod
is not defined yet, which ultimately will specify its conversion formula using this value as a suggestion for the expected data resolution. -
SwInterpolationMethod
– Keyword that describes the mathematical method applied for interpolation, related to the interpolation routine that will be invoked. -
SwIsVirtual
–Boolean
that denotes a virtual object, which is not part of the memory, and their derivation is reliant on other objects, requiring aswDataDependency
. -
SwPointerTargetProps
– Aggregation of a singleSwPointerTargetProps
, denoting this element is a pointer to another object. -
SwRecordLayout
– A single referenceSwRecordLayout
related to this data object, which indicates how the data object is stored within the ECU memory. -
SwRefreshTiming
– The aggregation of aMultidimensionalTime
which indicates update frequency for this element. This timing can then be collected by the tasks where this element is written, or it can be used in early development stages to specify a desired refresh timing or later stages to denote the actual timing. -
SwTextProps
– Aggregation of a singleSwTextProps
meta-class, specifying the text-related properties of this element. -
SwValueBlockSize
– If the data object is a value block (VAL_BLK
), it indicates its size. -
SwValueBlockSizeMult
– If the data object is a value block (VAL_BLK
) and has more than one dimension (otherwise it is not defined), it specifies its size throughout each dimension, via mulitple numbers. The sizes should be present from ascending order regarding the dimension. -
Unit
– Reference to a physicalUnit
associated with this data object. It can be used without aCompuMethod
, but if both co-exist and theCompuMethod
specifies a unit, then they must be compatible. -
ValueAxisDataType
– A reference to anApplicationPrimitiveDataType
attribute, which is a primitive data type that defines a set of allowed values and represents the primitive data type of the value axis within a compound data type, such as aCURVE
or aMAP
. It takes precedence over thecompuMethod
,unit
andbaseType
attributes.
Use Cases and Precedence of SwDataDefProps Attributes
Different attributes may be required, optional, ignored or not even defined within one of the classes that aggregates SwDataDefProps
, and upstream attributes can be either overwritten or added to the definition of sub-classes, according to different priority settings.
As you will see, SwDataDefProps
can be defined for a type, prototype, instantiation, data access and calibration support. The normal use case in terms of precedence, the ones closer to the implementation will overwrite the previous elements. Some exceptions apply, as you have seen, but this is the conclusion.
The precedence chain, from lowest to highest is ApplicationDataType
, ImplementationDataType
, DataPrototype
, InstantiationDataDefProps
, ParameterAccess
, FlatInstanceDescriptor
and McDataInstance
.
These relations are outlined in the table below, where the properties not mentioned for the meta-classes that aggregate SwDataDefProps
are considered not applicable:
Attribute | Applicability on Different Meta-Classes |
---|---|
additionalNativeTypeQualifier | Defined on ImplementationDataTypes and SwServiceArgs independently of other definitions. Self-contained definition for McDataInstances . DataPrototypes inherit the definition from ImplementationDataTypes . |
annotation | Defined by ApplicationDataTypes , SwServiceArgs and SwSystemConsts independently from other definitions. ImplementationDataTypes , DataPrototypes , InstantiatonDataDefProps , ParameterAcceses , McDataInstances and ComSpec.NetworkRepresentation add to the definitions of the preceding elements and ApplicationDataTypes . |
baseType | Defined by ImplementationDataTypes , SwServiceArgs and ComSpec.NetworkRepresentation independently from other definitions. Self-contained definition for McDataInstances . DataPrototypes , InstantiationDataDefProps and ParameterAccess inherit the definition from ImplementationDataTypes and their preceding elements. Attribute is ignored for SwSystemConsts . |
compuMethod | Defined for ApplicationDataTypes , SwSystemConsts and ComSpec.networkRepresentations independently from other definitions. Self-contained definition for McDataInstances . DataPrototypes , InstantiationDataDefProps and SwServiceArgs inherit their definitions from their preceding elements. ImplementationDataTypes and FlatInstanceDescriptors inherit the properties from preceding elements (if applicable) and its definition adds additional information. |
dataConstr | Defined for ApplicationDataTypes , DataPrototypes , InstantiationDataDefProps , SwServiceArgs and SwSystemConsts independently from other definitions. ParameterAccesses inherit the element from preceding elements. ImplementationDataTypes using this definition constrain their sub-elements. Self-contained definition for McDataInstances . |
displayFormat | ApplicationDataTypes , ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps , SwServiceArgs and SwSystemConsts define the element independently from other definitions. ParameterAccess inherits the definition from preceding elements. Self-contained definition for McDataInstances . |
displayPresentation | Defined for ApplicationDataTypes , ImplementationDataTypes , DataPrototypes and InstantiationDataDefProps independently from other definitions. Self-contained definition for McDataInstances . |
implementationDataType | ImplementationDataTypes and SwServiceArgs define the element independently from other definitions. DataPrototypes , InstantiationDataDefProps and ParameterAccesses inherit their definition from preceding elements. |
invalidValue | ApplicationDataTypes , ImplementationDataTypes and ComSpec.networkRepresentation define the element independently from other definitions. DataPrototypes and InstantiationDataDefProps inherit their definition from preceding elements. Self-contained definition for McDataInstances . |
stepSize | ApplicationDataTypes , ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps , ParameterAccesses and FlatInstanceDescriptors define the element independently from other definitions. Self-contained definition for McDataInstances . |
swAddrMethod | ApplicationDataTypes , ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps , FlatInstanceDescriptors and PerInstanceMemories define the element independently from other definitions. |
swAlignment | Defined for ImplementationDataTypes , DataPrototypes and InstantiationDataDefProps independently from other elements. |
swBitRepresentation | Defined for McDataInstances independently from other elements. |
swCalibrationAccess | Defined for ApplicationDataTypes , ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps , SwServiceArgs , FlatInstanceDescriptors and SwSystemConsts independently from other elements. Self-contained definition for McDataInstances . |
swCalPrmAxisSet | Defined for ApplicationDataTypes independently from other element definitions (except for the sub-elements swCalprmAxis , swAxisGrouped.swCalprmRef , swCalprmAxisSet.swCalprmAxis and SwAxisIndividual.swVariableRef , which are not defined). Inherited from preceding elements for DataPrototypes , InstantiationDataDefProps and ParameterAccesses . The sub-elements swCalprmAxis , swAxisGrouped.swCalprmRef , swCalprmAxisSet.swCalprmAxis and SwAxisIndividual.swVariableRef are defined for InstantiationDataDefProps and ParameterAccess independently from other definitions. Self-contained definition for McDataInstances . |
swComparisonVariable | Defined for ParameterAccess independently from other elements. Self-contained definition for McDataInstances . |
swDataDependency | Defined for DataPrototypes and InstantiationDataDefProps independently from other elements. Self-contained definition for McDataInstances . |
swHostVariable | Defined for McDataInstances independently from other elements. |
swImplPolicy | Defined for ApplicationDataTypes , ImplementationDataTypes , DataPrototypes and SwServiceArgs independently from other elements. |
swIntendedResolution | Defined for ApplicationDataTypes independently from other elements, but only in early stages of development, as a reference to the development of CompuMethods . |
swInterpolationMethod | Defined for ApplicationDataTypes , DataPrototypes , InstantiationDataDefProps and ParameterAccesses independently from other elements. Definition inherited from preceding elements for ImplementationDataDefProps . Self-contained definition for McDataInstances . |
swIsVirtual | Defined for DataPrototypes and InstantiationDataDefProps independently from other elements. Self-contained definition for McDataInstances . |
swPointerTargetProps | Defined for ImplementationDataTypes and SwServiceArgs independently from other elements. Definition inherited from preceding elements for DataPrototypes . |
swRecordLayout | Defined for ApplicationDataTypes independently from other elements. Definition inherited from preceding elements for DataPrototypes , InstantiationDataDefProps and ParameterAccesses . Self-contained definition for McDataInstances . |
swRefreshTiming | Defined for ApplicationDataTypes , ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps , SwServiceArgs , FlatInstanceDescriptors and McDataInstances independently from other elements. |
swTextProps | Defined for ApplicationDataTypes independently from other elements. Definition inherited for ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps and ParameterAccesses from preceding elements. Self-contained definition for McDataInstances . |
swValueBlockSize | Defined for ApplicationDataTypes independently from other elements. Definition inherited for ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps and ParameterAccesses from preceding elements. Self-contained definition for McDataInstances . |
swValueBlockSizeMult | Defined for ApplicationDataTypes independently from other elements. Definition inherited for ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps and ParameterAccesses from preceding elements. Self-contained definition for McDataInstances . |
Unit | Defined for ApplicationDataTypes independently from other elements. Definition inherited for ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps and ParameterAccesses from preceding elements. Self-contained definition for McDataInstances . |
valueAxisDataType | Defined for ApplicationDataTypes independently from other elements. Definition inherited for ImplementationDataTypes , DataPrototypes , InstantiationDataDefProps and SwServiceArgs from preceding elements. Self-contained definition for McDataInstances . |
Closing Notes
I know, this article hsa been heavy on meta-classes and attributes, which is not always easy to accompany. But in the case of such an important meta-class, such as SwDataDefProps
, which contains (in my opinion, too many) attributes that do not apply to all the meta-classes that aggregate it, things can become confusing. Nonetheless, do not underestimate its potential and keep these rules close by when creating and analysing ARXML models, you will thank me for it.
If you fancy more content of the same kind, have a look into our website. This is an ever-growing library for Autosar. Soon, an eBook will be added into the mix, where much more content like this will take part. Make sure to place yourself on the waiting list!
Author: Micael Coutinho (opens in a new tab)
References:
© AutosarToday —@LinkedIn