ARXML File Support for CAN in Simulink
Block Enhancements
The CAN Pack and CAN Unpack blocks support more generic ARXML file structures than DBC files offer. An important element that can be modeled in ARXML files but does not have a counterpart in DBC files is the Protocol Data Unit (PDU).
In principle, a frame can contain multiple PDUs, but for CAN specifically, the AUTOSAR standard limits a frame to carry only one PDU. To determine the parameter values for each signal in the frame, the CAN Pack and CAN Unpack blocks use the PDU information available in the file. However, this information is not shown on the block masks.
Functioning of the Blocks
The following figure shows the mask of a CAN Pack block, configured with data read from an example ARXML file. The CAN Unpack block mask looks similar to CAN Pack.
After the file has been parsed, the block processes the information as follows.
The list of CanFrameTriggerings is extracted, and each CanFrameTriggering provides the value of the CAN Identifier and the CAN addressing modes (Identifier type, i.e., standard or extended) for the corresponding frame.
The frame name (appearing in the Message list as well as in the Name field) is that of any frame in the file containing a supported PDU type. Only ISignalIPdus are supported, so any other PDU type is skipped and the corresponding frame does not appear on the drop-down list. The block throws a warning in the Diagnostic Viewer if unsupported PDUs have been identified in the file.
Each CanFrame element in the file provides the Length in bytes.
Remote frame flags are not read from the file and therefore the option is left active for manual specification in the mask.
The Signals table is filled as follows.
Each CanFrame also provides the so-called PduToFrameMapping from which the starting bit and the byte order of the PDU are obtained. This information is used to determine the values of the Start bit and Byte order for each signal with respect to the frame.
From the PduToFrameMapping, the ISignalIPdu is recovered, and from that its ISignalToIPduMappings, which provide the byte order and the start position of each signal in the PDU. In turn, each ISignalToIPduMapping references an ISignal, from which the signal name and bit length are extracted. This allows filling the first four columns of the Signals table. Note that the Start bit is a combination of the PDU start bit (relative to the frame) and signal start bit (relative to the PDU), and it depends on the byte order.
The value in the Data type column is determined as follows:
If the ISignal provides a non-empty networkRepresentationProps field, which defines a baseType, then the baseType is used to determine the Data type following the rules from the standard.
Otherwise, the block callbacks attempt to infer the data type based on the information provided in the CompuMethods.
If the data type cannot be determined, the value
signed
is set by default and a warning is thrown.
The last 4 columns of the Signals table are determined based on the information available in the CompuMethod referenced by the SystemSignal associated with each ISignal.
Only linear scaling (i.e., physical = factor * internal + offset) is supported.
If the CompuMethods are missing or incomplete, the block sets default values corresponding to an identity relation without upper or lower limits, and a warning is thrown.
In general, the block throws a warning if data is missing or incomplete, and will
suggest to switch to Manually specified signals
to modify the
values inferred or set to defaults. In this way, the workflow is not interrupted,
even if the provided file is incomplete.
Limitations
Only ISignalIPdus are supported.
Multiplexing is not supported when using ARXML files. The 'Multiplex type' is set to 'Standard' and the 'Multiplex value' to '0', accordingly.
CompuMethods of
IDENTICAL
,LINEAR
,SCALE_LINEAR
, and empty categories:If the category is
SCALE_LINEAR
, only the case with a single interval (i.e., equivalent toLINEAR
) is supported; otherwise, default values are used and a warning is thrown.If the category is not specified, it is assumed to be
LINEAR
. If the content is not consistent with the assumption, then default values are used and a warning is thrown.