API

canmatrix.py

exception canmatrix.canmatrix.ArbitrationIdOutOfRange
class canmatrix.canmatrix.CanMatrix(type=<matrix_class.CAN: 1>, attributes=NOTHING, ecus=NOTHING, frames=NOTHING, signal_defines=NOTHING, frame_defines=NOTHING, global_defines=NOTHING, env_defines=NOTHING, ecu_defines=NOTHING, value_tables=NOTHING, env_vars=NOTHING, signals=NOTHING, baudrate=0, fd_baudrate=0, load_errors=NOTHING)

The Can-Matrix-Object attributes (global canmatrix-attributes), ecus (list of ECUs), frames (list of Frames) signal_defines (list of signal-attribute types) frame_defines (list of frame-attribute types) ecu_defines (list of ECU-attribute types) global_defines (list of global attribute types) value_tables (global defined values)

add_attribute(attribute, value)

Add attribute to Matrix attribute-list.

Parameters:
  • attribute (str) – attribute name
  • value – attribute value
add_ecu(ecu)

Add new ECU to the Matrix. Do nothing if ecu with the same name already exists.

Parameters:ecu (Ecu) – ECU name to add
add_ecu_defines(name, definition)

Add Boardunit-attribute definition to canmatrix.

Parameters:
  • name (str) – Boardunit type
  • definition (str) – BU definition as string
add_env_defines(name, definition)

Add enviroment variable-attribute definition to canmatrix.

Parameters:
  • name (str) – enviroment variable type
  • definition (str) – enviroment variable definition as string
add_frame(frame)

Add the Frame to the Matrix.

Parameters:frame (Frame) – Frame to add
Returns:the inserted Frame
add_frame_defines(name, definition)

Add frame-attribute definition to canmatrix.

Parameters:
  • name (str) – frame type
  • definition (str) – frame definition as string
add_frame_receiver(globFrame, ecu)

Add Receiver to all Frames by glob pattern.

Parameters:
  • globFrame (str) – glob pattern for Frame name.
  • ecu (str) – Receiver ECU name
add_frame_transmitter(globFrame, ecu)

Add Transmitter to all Frames by glob pattern.

Parameters:
  • globFrame (str) – glob pattern for Frame name.
  • ecu (str) – Receiver ECU name
add_global_defines(name, definition)

Add global-attribute definition to canmatrix.

Parameters:
  • name (str) – attribute type
  • definition (str) – attribute definition as string
add_signal(signal)

Add Signal to Frame.

Parameters:signal (Signal) – Signal to be added.
Returns:the signal added.
add_signal_defines(type, definition)

Add signal-attribute definition to canmatrix.

Parameters:
  • type (str) – signal type
  • definition (str) – signal-attribute string definition, see class Define
add_signal_receiver(globFrame, globSignal, ecu)

Add Receiver to all Frames and Signals by glob pattern.

Parameters:
  • globFrame (str) – glob pattern for Frame name.
  • globSignal (str) – glob pattern for Signal name. Only signals under globFrame are filtered.
  • ecu (str) – Receiver ECU name
add_value_table(name, valueTable)

Add named value table.

Parameters:
  • name (str) – value table name
  • valueTable – value table itself
attribute(attributeName, default=None)

Return custom Matrix attribute by name.

Parameters:
  • attributeName (str) – attribute name
  • default – default value if given attribute doesn’t exist
Returns:

attribute value or default or None if no such attribute found.

contains_j1939

Check whether the Matrix contains any J1939 Frame.

decode(frame_id, data)

Return OrderedDictionary with Signal Name: object decodedSignal

Parameters:
  • frame_id – frame id
  • data – Iterable or bytes. i.e. (0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8)
Returns:

OrderedDictionary

del_ecu(ecu_or_glob)

Remove ECU from Matrix and all Frames.

Parameters:or Ecu ecu_or_glob (str) – ECU instance or glob pattern to remove from list
del_frame(frame_or_name)

Delete Frame from Matrix.

Parameters:or str frame_or_name (Frame) – Frame or name to delete
del_frame_attributes(unwanted_attributes)

Delete Frame attributes from all Frames.

Parameters:of str unwanted_attributes (list) – List of attributes to remove
del_frame_transmitter(globFrame, ecu)

Delete Transmitter from all Frames by glob pattern.

Parameters:
  • globFrame (str) – glob pattern for Frame name.
  • ecu (str) – Receiver ECU name
del_signal(signal)

Delete Signal from Matrix and all Frames.

Parameters:or str signal (Signal) – Signal instance or glob pattern to be deleted
del_signal_attributes(unwanted_attributes)

Delete Signal attributes from all Signals of all Frames.

Parameters:of str unwanted_attributes (list) – List of attributes to remove
del_signal_receiver(globFrame, globSignal, ecu)

Delete Receiver from all Frames by glob pattern.

Parameters:
  • globFrame (str) – glob pattern for Frame name.
  • globSignal (str) – glob pattern for Signal name. Only signals under globFrame are filtered.
  • ecu (str) – Receiver ECU name
delete_obsolete_defines()

Delete all unused Defines.

Delete them from frame_defines, ecu_defines and signal_defines.

delete_obsolete_ecus()

Delete all unused ECUs

delete_zero_signals()

Delete all signals with zero bit width from all Frames.

ecu_by_name(name)

Returns Boardunit by Name.

Parameters:name (str) – BoardUnit name
Return type:Ecu or None
encode(frame_id, data)

Return a byte string containing the values from data packed according to the frame format.

Parameters:
  • frame_id – frame id
  • data – data dictionary
Returns:

A byte string of the packed values.

frame_by_id(arbitration_id)

Get Frame by its arbitration id.

Parameters:arbitration_id (ArbitrationId) – Frame id as canmatrix.ArbitrationId
Return type:Frame or None
frame_by_name(name)

Get Frame by name.

Parameters:name (str) – Frame name to search for
Return type:Frame or None
frame_by_pgn(pgn)

Get Frame by pgn (j1939).

Parameters:pgn (int) – pgn to search for
Return type:Frame or None
glob_ecus(globStr)

Find ECUs by given glob pattern.

Parameters:globStr – glob pattern to filter BoardUnits. See fnmatch.fnmatchcase.
Return type:list of Ecu
glob_frames(globStr)

Find Frames by given glob pattern.

Parameters:globStr (str) – glob pattern to filter Frames. See fnmatch.fnmatchcase.
Return type:list of Frame
merge(mergeArray)

Merge multiple Matrices to this Matrix.

Try to copy all Frames and all environment variables from source Matrices. Don’t make duplicates. Log collisions.

Parameters:of Matrix mergeArray (list) – list of source CAN Matrices to be merged to to self.
recalc_dlc(strategy)

Recompute DLC of all Frames.

Parameters:strategy (str) – selected strategy, “max” or “force”.
remove_frame(frame)

Remove the Frame from Matrix.

Parameters:frame (Frame) – frame to remove from CAN Matrix
remove_signal(signal)

Remove the Frame from Matrix.

Parameters:signal (Signal) – frame to remove from CAN Matrix
rename_ecu(ecu_or_name, new_name)

Rename ECU in the Matrix. Update references in all Frames.

Parameters:
  • or Ecu ecu_or_name (str) – old name or ECU instance
  • new_name (str) – new name
rename_frame(frame_or_name, new_name)

Rename Frame.

Parameters:
  • or str frame_or_name (Frame) – Old Frame instance or name or part of the name with ‘*’ at the beginning or the end.
  • new_name (str) – new Frame name, suffix or prefix
rename_signal(signal_or_name, new_name)

Rename Signal.

Parameters:
  • or str signal_or_name (Signal) – Old Signal instance or name or part of the name with ‘*’ at the beginning or the end.
  • new_name (str) – new Signal name, suffix or prefix
set_fd_type()

Try to guess and set the CAN type for every frame.

If a Frame is longer than 8 bytes, it must be Flexible Data Rate frame (CAN-FD). If not, the Frame type stays unchanged.

update_ecu_list()

Check all Frames and add unknown ECUs to the Matrix ECU list.

class canmatrix.canmatrix.DecodedSignal(raw_value, signal)

Contains a decoded signal (frame decoding)

  • rawValue : rawValue (value on the bus)
  • physValue: physical Value (the scaled value)
  • namedValue: value of Valuetable
  • signal: pointer signal (object) which was decoded
named_value
Returns:value of Valuetable
Return type:typing.Union[str, int, decimal.Decimal]
phys_value
Returns:physical Value (the scaled value)
Return type:typing.Union[int, decimal.Decimal]
exception canmatrix.canmatrix.DecodingComplexMultiplexed
exception canmatrix.canmatrix.DecodingFrameLength
class canmatrix.canmatrix.Define(definition)

Hold the defines and default-values.

set_default(default)

Set Definition default value.

Parameters:default – default value; number, str or quoted str (“value”)
update()

Update definition string for type ENUM.

For type ENUM rebuild the definition string from current values. Otherwise do nothing.

class canmatrix.canmatrix.Ecu(name, comment=None, attributes=NOTHING)

Represents one ECU.

add_attribute(attribute, value)

Add the Attribute to current ECU. If the attribute already exists, update the value.

Parameters:
  • attribute (str) – Attribute name
  • value (any) – Attribute value
add_comment(comment)

Set ECU comment.

Parameters:comment (str) – BU comment/description.
attribute(attribute_name, db=None, default=None)

Get Board unit attribute by its name.

Parameters:
  • attribute_name (str) – attribute name.
  • db (CanMatrix) – Optional database parameter to get global default attribute value.
  • default – Default value if attribute doesn’t exist.
Returns:

Return the attribute value if found, else default or None

exception canmatrix.canmatrix.EncodingComplexMultiplexed
exception canmatrix.canmatrix.ExceptionTemplate
class canmatrix.canmatrix.Frame(name='', arbitration_id=0, size=0, transmitters=NOTHING, is_complex_multiplexed=False, is_fd=False, comment='', signals=NOTHING, mux_names=NOTHING, attributes=NOTHING, receivers=NOTHING, signalGroups=NOTHING, cycle_time=0, is_j1939=False, pdus=NOTHING, header_id=None)

Represents CAN Frame.

The Frame has following mandatory attributes

  • arbitration_id,
  • name,
  • transmitters (list of ECU names),
  • size (DLC),
  • signals (list of signal-objects),
  • attributes (list of attributes),
  • receivers (list of ECU names),
  • comment

and any custom attributes in attributes dict.

Frame signals can be accessed using the iterator.

add_attribute(attribute, value)

Add the attribute with value to customer Frame attribute-list. If Attribute already exits, modify its value. :param str attribute: Attribute name :param any value: attribute value

add_comment(comment)

Set Frame comment.

Parameters:comment (str) – Frame comment
add_pdu(pdu)

Add Pdu to Frame.

Parameters:pdu (Pdu) – Pdu to be added.
Returns:the pdu added.
add_receiver(receiver)

Add receiver ECU Name to Frame.

Parameters:receiver (str) – receiver name
add_signal(signal)

Add Signal to Frame.

Parameters:signal (Signal) – Signal to be added.
Returns:the signal added.
add_signal_group(Name, Id, signalNames)

Add new SignalGroup to the Frame. Add given signals to the group.

Parameters:
  • Name (str) – Group name
  • Id (int) – Group id
  • of str signalNames (list) – list of Signal names to add. Non existing names are ignored.
add_transmitter(transmitter)

Add transmitter ECU Name to Frame.

Parameters:transmitter (str) – transmitter name
attribute(attribute_name, db=None, default=None)

Get any Frame attribute by its name.

Parameters:
  • attribute_name (str) – attribute name, can be mandatory (ex: id) or optional (customer) attribute.
  • db (CanMatrix) – Optional database parameter to get global default attribute value.
  • default – Default value if attribute doesn’t exist.
Returns:

Return the attribute value if found, else default or None

bitstring_to_signal_list(signals, big, little)

Return OrderedDictionary with Signal Name: object decodedSignal (flat / without support for multiplexed frames)

Parameters:
  • signals – Iterable of signals (class signal) to decode from frame.
  • big – bytearray of bits (big endian).
  • little – bytearray of bits (little endian).
Returns:

array with raw values (same order like signals)

bytes_to_bitstrings(data)

Return two arrays big and little containing bits of given data (bytearray)

Parameters:data – bytearray of bits (little endian). i.e. bytearray([0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8])
Returns:bit arrays in big and little byteorder
calc_dlc()

Compute minimal Frame DLC (length) based on its Signals

Returns:Message DLC
create_dummy_signals()

Create big-endian dummy signals for unused bits.

Names of dummy signals are _Dummy_<frame.name>_<index>

decode(data)

Return OrderedDictionary with Signal Name: object decodedSignal (support for multiplexed frames) decodes only signals matching to muxgroup

Parameters:data – bytearray . i.e. bytearray([0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8])
Returns:OrderedDictionary
del_attribute(attribute)

Remove attribute from customer Frame attribute-list.

Parameters:attribute (str) – Attribute name
del_transmitter(transmitter)

Delete transmitter ECU Name from Frame.

Parameters:transmitter (str) – transmitter name
effective_cycle_time

Calculate effective cycle time for frame, depending on singal cycle times

encode(data=None)

Return a byte string containing the values from data packed according to the frame format.

Parameters:data (dict) – data dictionary
Returns:A byte string of the packed values.
fit_dlc()

Compute next allowed DLC (length) for current Frame

get_frame_layout()

get layout of frame.

Represents the bit usage in the frame by means of a list with n items (n bits of frame length). Every item represents one bit and contains a list of signals (object refs) with each signal, occupying that bit. Bits with empty list are unused.

Example: [[], [], [], [sig1], [sig1], [sig1, sig5], [sig2, sig5], [sig2], []] :return: list of lists with signalnames :rtype: list of lists

get_multiplexer

get multiplexer signal if any in frame.

get_multiplexer_values

get possible multiplexer values.

get_signals_for_multiplexer_value(mux_value)

Find Frame Signals by given muxer value. :param int mux_value: muxer value :return: list of signals relevant for given muxer value. :rtype: list of signals

glob_signals(glob_str)

Find Frame Signals by given glob pattern.

Parameters:glob_str (str) – glob pattern for signal name. See fnmatch.fnmatchcase
Returns:list of Signals by glob pattern.
Return type:list of Signal
is_multiplexed

Frame is multiplexed if at least one of its signals is a multiplexer.

priority

Get J1939 priority.

signal_by_name(name)

Get signal by name.

Parameters:name (str) – signal name to be found.
Returns:signal with given name or None if not found
signal_group_by_name(name)

Get signal group.

Parameters:name (str) – group name
Returns:SignalGroup by name or None if not found.
Return type:SignalGroup
signals_to_bytes(data)

Return a byte string containing the values from data packed according to the frame format.

Parameters:data – data dictionary of signal : rawValue
Returns:A byte string of the packed values.
source

Get J1939 source.

unpack(data, report_error=True)

Return OrderedDictionary with Signal Name: object decodedSignal (flat / without support for multiplexed frames) decodes every signal in signal-list.

Parameters:
  • data – bytearray i.e. bytearray([0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8])
  • report_error – set to False to silence error output
Returns:

OrderedDictionary

update_receiver()

Collect Frame receivers out of receiver given in each signal. Add them to self.receiver list.

exception canmatrix.canmatrix.J1939needsExtendedIdetifier
exception canmatrix.canmatrix.MissingMuxSignal
class canmatrix.canmatrix.Pdu(name='', size=0, triggering_name='', pdu_type='', port_type='', signals=NOTHING, signalGroups=NOTHING)

Represents a PDU.

PDUs are hierarchical groups of signals which are needed to represent Flexray busses Whereas a PDU is the same than a frame on CAN bus, at flexray a frame may consist of multiple PDUs (a bit like multiple signal layout for multiplexed can frames). This class is only used for flexray busses.

add_signal(signal)

Add Signal to Pdu.

Parameters:signal (Signal) – Signal to be added.
Returns:the signal added.
add_signal_group(Name, Id, signalNames)

Add new SignalGroup to the Frame. Add given signals to the group.

Parameters:
  • Name (str) – Group name
  • Id (int) – Group id
  • of str signalNames (list) – list of Signal names to add. Non existing names are ignored.
signal_by_name(name)

Get signal by name.

Parameters:name (str) – signal name to be found.
Returns:signal with given name or None if not found
class canmatrix.canmatrix.Signal(name='', start_bit=0, size=0, is_little_endian=True, is_signed=True, offset=Decimal('0'), factor=Decimal('1'), unit='', receivers=NOTHING, comment=None, multiplex=None, mux_value=None, is_float=False, is_ascii=False, type_label='', enumeration=None, comments=NOTHING, attributes=NOTHING, values=NOTHING, mux_val_grp=NOTHING, muxer_for_signal=None, calc_min_for_none=True, calc_max_for_none=True, cycle_time=0, initial_value=Decimal('0'), min=NOTHING, max=NOTHING)

Represents a Signal in CAN Matrix.

Signal has following attributes:

  • name
  • start_bit (internal start_bit, see get/set_startbit also)
  • size (in Bits)
  • is_little_endian (1: Intel, 0: Motorola)
  • is_signed (bool)
  • factor, offset, min, max
  • receivers (ECU Name)
  • attributes, _values, unit, comment
  • _multiplex (‘Multiplexor’ or Number of Multiplex)
add_attribute(attribute, value)

Add user defined attribute to the Signal. Update the value if the attribute already exists.

Parameters:
  • attribute (str) – attribute name
  • value – attribute value
add_comment(comment)

Set signal description.

Parameters:comment (str) – description
add_receiver(receiver)

Add signal receiver (ECU).

Parameters:receiver (str) – ECU name.
add_values(value, valueName)

Add named Value Description to the Signal.

Parameters:
  • or str value (int) – signal value (0xFF)
  • valueName (str) – Human readable value description (“Init”)
attribute(attributeName, db=None, default=None)

Get any Signal attribute by its name.

Parameters:
  • attributeName (str) – attribute name, can be mandatory (ex: start_bit, size) or optional (customer) attribute.
  • db (CanMatrix) – Optional database parameter to get global default attribute value.
  • default – Default value if attribute doesn’t exist.
Returns:

Return the attribute value if found, else default or None

calc_max()

Compute maximal physical Signal value based on offset, factor and calculate_raw_range.

calc_min()

Compute minimal physical Signal value based on offset and factor and calculate_raw_range.

calculate_raw_range()

Compute raw signal range based on Signal bit width and whether the Signal is signed or not.

Returns:Signal range, i.e. (0, 15) for unsigned 4 bit Signal or (-8, 7) for signed one.
Return type:tuple
del_attribute(attribute)

Remove user defined attribute from Signal.

Parameters:attribute (str) – attribute name
del_receiver(receiver)

Remove receiver (ECU) from signal

Parameters:receiver (str) – ECU name.
float_factory

alias of decimal.Decimal

get_startbit(bit_numbering=None, start_little=None)

Get signal start bit. Handle byte and bit order.

phys2raw(value=None)

Return the raw value (= as is on CAN).

Parameters:value – (scaled) value compatible with decimal or value choice to encode
Returns:raw unscaled value as it appears on the bus
Return type:int or decimal.Decimal
raw2phys(value, decode_to_str=False)

Decode the given raw value (= as is on CAN).

Parameters:
  • value – raw value compatible with decimal.
  • decode_to_str (bool) – If True, try to get value representation as string (‘Init’ etc.)
Returns:

physical value (scaled)

set_max(max=None)

Set maximal signal value.

Parameters:max – minimal physical value. If None and enabled (calc_max_for_none), compute using calc_max
set_min(min=None)

Set minimal physical Signal value.

Parameters:min – minimal physical value. If None and enabled (calc_min_for_none), compute using calc_min
set_startbit(start_bit, bitNumbering=None, startLittle=None)

Set start_bit.

bitNumbering is 1 for LSB0/LSBFirst, 0 for MSB0/MSBFirst. If bit numbering is consistent with byte order (little=LSB0, big=MSB0) (KCD, SYM), start bit unmodified. Otherwise reverse bit numbering. For DBC, ArXML (OSEK), both little endian and big endian use LSB0. If bitNumbering is None, assume consistent with byte order. If startLittle is set, given start_bit is assumed start from lsb bit rather than the start of the signal data in the message data.

spn

Get signal J1939 SPN or None if not defined.

Return type:typing.Optional[int]
class canmatrix.canmatrix.SignalGroup(name, id, signals=NOTHING)

Represents signal-group, containing multiple Signals.

add_signal(signal)

Add a Signal to SignalGroup.

Parameters:signal (Signal) – signal to add
by_name(name)

Find a Signal in the group by Signal name.

Parameters:name (str) – Signal name to find
Returns:signal contained in the group identified by name
Return type:Signal
del_signal(signal)

Remove Signal from SignalGroup.

Parameters:signal (Signal) – signal to remove
exception canmatrix.canmatrix.StartbitLowerZero
canmatrix.canmatrix.arbitration_id_converter(source)

Converter for attrs which accepts ArbitrationId itself or int.

canmatrix.canmatrix.grouper(iterable, n, fillvalue=None)

Collect data into fixed-length chunks or blocks.

class canmatrix.canmatrix.matrix_class

An enumeration.

canmatrix.canmatrix.pack_bitstring(length, is_float, value, signed)

returns a value in bits :param length: length of signal in bits :param is_float: value is float :param value: value to encode :param signed: value is signed :return:

canmatrix.canmatrix.unpack_bitstring(length, is_float, is_signed, bits)

returns a value calculated from bits :param length: length of signal in bits :param is_float: value is float :param bits: value as bits (array/iterable) :param is_signed: value is signed :return:

Represents one ECU.

Represents CAN Frame.

The Frame has following mandatory attributes

  • arbitration_id,
  • name,
  • transmitters (list of ECU names),
  • size (DLC),
  • signals (list of signal-objects),
  • attributes (list of attributes),
  • receivers (list of ECU names),
  • comment

and any custom attributes in attributes dict.

Frame signals can be accessed using the iterator.

canmatrix.Frame.effective_cycle_time

Calculate effective cycle time for frame, depending on singal cycle times

canmatrix.Frame.get_multiplexer

get multiplexer signal if any in frame.

canmatrix.Frame.get_multiplexer_values

get possible multiplexer values.

canmatrix.Frame.is_multiplexed

Frame is multiplexed if at least one of its signals is a multiplexer.

canmatrix.Frame.priority

Get J1939 priority.

canmatrix.Frame.source

Get J1939 source.

Represents a Signal in CAN Matrix.

Signal has following attributes:

  • name
  • start_bit (internal start_bit, see get/set_startbit also)
  • size (in Bits)
  • is_little_endian (1: Intel, 0: Motorola)
  • is_signed (bool)
  • factor, offset, min, max
  • receivers (ECU Name)
  • attributes, _values, unit, comment
  • _multiplex (‘Multiplexor’ or Number of Multiplex)
canmatrix.Signal.spn

Get signal J1939 SPN or None if not defined.

Return type:typing.Optional[int]

Represents signal-group, containing multiple Signals.

Contains a decoded signal (frame decoding)

  • rawValue : rawValue (value on the bus)
  • physValue: physical Value (the scaled value)
  • namedValue: value of Valuetable
  • signal: pointer signal (object) which was decoded
canmatrix.DecodedSignal.named_value
Returns:value of Valuetable
Return type:typing.Union[str, int, decimal.Decimal]
canmatrix.DecodedSignal.phys_value
Returns:physical Value (the scaled value)
Return type:typing.Union[int, decimal.Decimal]

returns a value calculated from bits :param length: length of signal in bits :param is_float: value is float :param bits: value as bits (array/iterable) :param is_signed: value is signed :return:

returns a value in bits :param length: length of signal in bits :param is_float: value is float :param value: value to encode :param signed: value is signed :return:

canmatrix.ArbitrationId.j1939_tuple

Get tuple (destination, PGN, source)

Return type:tuple

Hold the defines and default-values.

cancluster.py

class canmatrix.cancluster.CanCluster(*arg, **kw)
update([E, ]**F) → None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

compare.py

class canmatrix.compare.CompareResult(result=None, type=None, ref=None, changes=None, children=NOTHING)

Hold comparison results in logical tree.

convert.py

copy.py

canmatrix.copy.copy_ecu(ecu_or_glob, source_db, target_db)

Copy ECU(s) identified by Name or as Object from source CAN matrix to target CAN matrix. This function additionally copy all relevant Defines.

Parameters:
  • ecu_or_glob – Ecu instance or glob pattern for Ecu name
  • source_db – Source CAN matrix
  • target_db – Destination CAN matrix
canmatrix.copy.copy_ecu_with_frames(ecu_or_glob, source_db, target_db, rx=True, tx=True, direct_ecu_only=True)

Copy ECU(s) identified by Name or as Object from source CAN matrix to target CAN matrix. This function additionally copy all relevant Frames and Defines.

Parameters:
  • ecu_or_glob – Ecu instance or glob pattern for Ecu name
  • source_db – Source CAN matrix
  • target_db – Destination CAN matrix
  • rx – copy rx-Frames (default: True)
  • tx – copy tx-Frames (default: True)
canmatrix.copy.copy_frame(frame_id, source_db, target_db)

Copy a Frame identified by ArbitrationId from source CAN matrix to target CAN matrix. This function additionally copy all relevant ECUs and Defines.

Parameters:
  • frame_id – Frame arbitration od
  • source_db – Source CAN matrix
  • target_db – Destination CAN matrix
canmatrix.copy.copy_signal(signal_glob, source_db, target_db)

Copy Signals identified by name from source CAN matrix to target CAN matrix. In target CanMatrix the signal is put without frame, just on top level.

Parameters:
  • signal_glob – Signal glob pattern
  • source_db – Source CAN matrix
  • target_db – Destination CAN matrix

j1939_decoder.py

utils.py