Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
myFrame2.addSignal(mySignal2)
myFrame2.addSignal(mySignal1)
db.frames.addFrame(myFrame1)
db.frames.addFrame(myFrame2)
db.frames.addFrame(myFrame3)
db.frames.addFrame(myFrame4)
#
#
# export the new (target)-Matrix for example as .dbc:
#
canmatrix.formats.dumpp({"": db}, "testfd.dbc", dbcExportEncoding='iso-8859-1',
dbcExportCommentEncoding='iso-8859-1')
db.ecu_by_name("testBU").add_comment("sender ECU")
db.ecu_by_name("testBU").add_attribute("NetworkNode", 0x111)
db.ecu_by_name("recBU").add_comment("receiver ECU")
db.frame_by_name("testFrame1").cycle_time = 100
db.add_ecu_defines("NetworkNode", 'INT 0 65535')
#
#
# export the new (target)-Matrix for example as .dbc:
#
canmatrix.formats.dumpp({"myMatrix": db}, "test.dbc", dbcExportEncoding='iso-8859-1',
dbcExportCommentEncoding='iso-8859-1')
myFrame2.add_signal(mySignal2)
myFrame2.add_signal(mySignal1)
db.frames.add_frame(myFrame1)
db.frames.add_frame(myFrame2)
db.frames.add_frame(myFrame3)
db.frames.add_frame(myFrame4)
#
#
# export the new (target)-Matrix for example as .dbc:
#
canmatrix.formats.dumpp({"": db}, "testfd.dbc", dbcExportEncoding='iso-8859-1',
dbcExportCommentEncoding='iso-8859-1')
#!/usr/bin/env python3
import canmatrix.formats
from canmatrix.join import join_frame_by_signal_start_bit
files = ["../test/db_B.dbc", "../test/db_A.dbc"]
target = join_frame_by_signal_start_bit(files)
#
# export the new (target)-Matrix for example as .dbc:
#
canmatrix.formats.dumpp(target, "target.dbc")
canmatrix.formats.dumpp(target, "target.xlsx")
name = name.replace(".", "_")
signal = canmatrix.Signal(name,
startBit=var.offset,
signalSize=var.length,
is_signed=is_signed,
is_float=is_float,
factor=var.od.factor,
min=min_value,
max=max_value,
unit=var.od.unit)
for value, desc in var.od.value_descriptions.items():
signal.addValues(value, desc)
frame.addSignal(signal)
frame.calcDLC()
db.frames.addFrame(frame)
formats.dumpp({"": db}, filename)
return db
#
# create frame Node606
#
frame3 = canmatrix.Frame("Node606", j1939_pgn = 0xff02, j1939_prio = 0x6,
j1939_source = 0x80,
comment="J1939 packet containing <8 byte payload")
sig = canmatrix.Signal("ch1", size=32, is_float=True, is_little_endian=False, startBit=0)
frame3.add_signal(sig)
cm.add_frame(frame3)
cm.recalc_dlc("force")
# save dbc
canmatrix.formats.dumpp({"":cm}, "example_j1939.dbc")
canmatrix.copy.copy_frame("Engine_123", db1, db3)
# Copy ECU (with all Frames) "Gateway" from first CAN-Matrix to target-Matrix
canmatrix.copy.copy_ecu_with_frames("Gateway", db1, db3)
#
# -----------------------------------------------------
#
#
#
# export the new (target)-Matrix for example as .dbc:
#
canmatrix.formats.dumpp(db3, "target.dbc")