Cross-validates AUTOSAR Classic ECU configuration — Com, PduR, CanIf and CanDrv ECUC containers — against a DBC communication matrix. 26 check codes, Python standard library only.
python skills/arxml-dbc-consistency/scripts/arxml_dbc_check.py probe ecuconfig.xml
python skills/arxml-dbc-consistency/scripts/arxml_dbc_check.py check ecuconfig.xml matrix.dbc
python skills/arxml-dbc-consistency/scripts/arxml_dbc_check.py matrix ecuconfig.xml matrix.dbc --csv inventory.csv
python skills/arxml-dbc-consistency/scripts/arxml_dbc_check.py selftest
probe inspects structure first — vendor container names, parameter
names and where signals are mounted vary enormously. check then
compares. Exit code is 1 on error, so it drops straight into CI.
In a real configuration Com and CanIf are not directly connected; the only sound binding key is the CAN ID:
DBC frame ──CanId──> CanIf PDU ──CanIfXxxPduRef──> EcuC Pdu(X)
──PduR routing──> EcuC Pdu(COM_X)
──ComPduIdRef──> Com IPdu
IPDU_COM_TP_Param has nothing name-wise in common with the DBC
frame Diag_CalData, yet they are the same link
(COM_TP_Param → CanTp_TP_Param → 0x9B). Joining by name is
guaranteed wrong.
AUTOSAR's ComBitPosition always stores the signal LSB
(flat numbering, bit 0 = LSB of byte 0), regardless of byte order.
DBC numbers Motorola signals in sawtooth form and stores the MSB, so
first walk back len-1 steps:
def motorola_msb_from_lsb(lsb, length):
pos = lsb
for _ in range(length - 1):
pos = pos - 15 if pos % 8 == 7 else pos + 1
return pos
Measured on a production project: 215/215 signals matched. An earlier version assumed "MSB and LSB schools coexist", tried both and accepted either — that design is wrong: a genuine error gets whitewashed by a coincidental match, and the measured hit rate was only 153/215.
A DBC may describe only this ECU (a dozen frames), or the entire network
(hundreds of frames, many other nodes under BU_:). In the latter,
most frames belong to other parties and this ECU should have no configuration
for them at all. The script decides frame by frame — "sender is this ECU, or
some signal's receiver includes this ECU" — and only raises error
on relevant frames.
An ARXML often drives several CAN buses at once. The script walks back through
CanIfBufferCfg → CanIfHthCfg → CanIfHthCanCtrlIdRef to identify
the bus and computes each bus's hit rate against the DBC: ≥20% is compared
normally, <20% is skipped wholesale with an info line.