Package: pretty-j1939
pretty_j1939python3 libs and scripts for pretty-printing J1939 candump logs.This package can:pretty-print J1939 traffic captured in candump logs ANDconvert a J1939 Digital Annex (Excel) file into a JSON structure for use in the aboveSome examples of pretty printingFormattedcontent (one per line) next to candump data:$pretty_j1939.py--candata=true--format=true--link=true--transport=trueexample.candump.txt|head(1543509533.000838)can010FDA300#FFFF07FFFFFFFFFF;{;"DA":"All(255)",;"PGN":"EEC6(64931)",;"SA":"Engine #1(  0)",;"Engine Variable Geometry Turbocharger Actuator #1":"2.8000000000000003 [%]";}(1543509533.000915)can018FEE000#FFFFFFFFB05C6800;{;"DA":"All(255)",;"PGN":"VD(65248)",;"SA":"Engine #1(  0)",Single-line contents next to candump data:$pretty_j1939.py--candata=true--format=false--link=true--transport=trueexample.candump.txt|head(1543509533.000838)can010FDA300#FFFF07FFFFFFFFFF;{"SA":"Engine #1(  0)","DA":"All(255)","PGN":"EEC6(64931)","Engine Variable Geometry Turbocharger Actuator #1":"2.8000000000000003 [%]"}(1543509533.000915)can018FEE000#FFFFFFFFB05C6800;{"SA":"Engine #1(  0)","DA":"All(255)","PGN":"VD(65248)","Total Vehicle Distance":"854934.0 [m]"}(1543509533.000991)can008FE6E0B#0000000000000000;{"SA":"Brakes - System Controller( 11)","DA":"All(255)","PGN":"HRW(65134)","Front Axle, Left Wheel Speed":"0.0 [kph]","Front axle, right wheel speed":"0.0 [kph]","Rear axle, left wheel speed":"0.0 [kph]","Rear axle, right wheel speed":"0.0 [kph]"}(1543509533.001070)can018FDB255#FFFFFFFF0100FFFF;{"SA":"Diesel Particulate Filter Controller( 85)","DA":"All(255)","PGN":"AT1IMG(64946)","Aftertreatment 1 Diesel Particulate Filter Differential Pressure":"0.1 [kPa]"}(1543509533.001145)can00CF00400#207D87481400F087;{"SA":"Engine #1(  0)","DA":"All(255)","PGN":"EEC1(61444)","Engine Torque Mode":"2 (Unknown)","Actual Engine - Percent Torque (Fractional)":"0.0 [%]","Driver's Demand Engine - Percent Torque":"0 [%]","Actual Engine - Percent Torque":"10 [%]","Engine Speed":"649.0 [rpm]","Source Address of Controlling Device for Engine Control":"0 [SA]","Engine Demand - Percent Torque":"10 [%]"}(1543509533.001220)can018FF4500#6D00FA00FF00006A;{"SA":"Engine #1(  0)","DA":"All(255)","PGN":"PropB_45(65349)","Manufacturer Defined Usage (PropB_PDU2)":"0x6d00fa00ff00006a"}(1543509533.001297)can018FEDF00#82FFFFFF7DE70300;{"SA":"Engine #1(  0)","DA":"All(255)","PGN":"EEC3(65247)","Nominal Friction - Percent Torque":"5 [%]","Estimated Engine Parasitic Losses - Percent Torque":"0 [%]","Aftertreatment 1 Exhaust Gas Mass Flow Rate":"199.8 [kg/h]","Aftertreatment 1 Intake Dew Point":"0 (00 - Not exceeded the dew point)","Aftertreatment 1 Exhaust Dew Point":"0 (00 - Not exceeded the dew point)","Aftertreatment 2 Intake Dew Point":"0 (00 - Not exceeded the dew point)","Aftertreatment 2 Exhaust Dew Point":"0 (00 - Not exceeded the dew point)"}(1543509533.001372)can01CFE9200#FFFFFFFFFFFFFFFF;{"SA":"Engine #1(  0)","DA":"All(255)","PGN":"EI1(65170)"}(1543509533.001447)can018F00131#FFFFFF3F00FFFFFF;{"SA":"Cab Controller - Primary( 49)","DA":"All(255)","PGN":"EBC1(61441)","Accelerator Interlock Switch":"0 (00 - Off)","Engine Retarder Selection":"0.0 [%]"}(1543509533.001528)can018FEF131#F7FFFF07CCFFFFFF;{"SA":"Cab Controller - Primary( 49)","DA":"All(255)","PGN":"CCVS1(65265)","Cruise Control Pause Switch":"1 (01 - On)","Cruise Control Active":"0 (00 - Cruise control switched off)","Cruise Control Enable Switch":"0 (00 - Cruise control disabled)","Brake Switch":"1 (01 - Brake pedal depressed)","Cruise Control Coast (Decelerate) Switch":"0 (00 - Cruise control activator not in the position \"coast\")","Cruise Control Accelerate Switch":"0 (00 - Cruise control activator not in the position \"accelerate\")"}Formattedcontents of the transport SPNs only.$pretty_j1939.py--candata=false--format=true--link=false--transport=trueexample.candump.txt|head{"Transport PGN":"AT1HI1(64920)","Aftertreatment 1 Total Fuel Used":"227.5 [liters]","Aftertreatment 1 DPF Average Time Between Active Regenerations":"173933 [Seconds]","Aftertreatment 1 DPF Average Distance Between Active Regenerations":"1460.5 [m]"}{"Transport PGN":"AT1HI1(64920)","Aftertreatment 1 Total Fuel Used":"227.5 [liters]","Aftertreatment 1 DPF Average Time Between Active Regenerations":"173933 [Seconds]",HOWTOFirst, obtain a copy of the digital annex, seehttps://www.sae.org/standards/content/j1939da_201907/for details.Then, use thecreate_j1939db-json.pyscript to convert that Digital Annex into a JSON file e.g.create_j1939db-json.py-ftmp/J1939DA_201611.xls-wtmp/J1939DA_201611.jsonPlace the resulting JSON file atJ1939db.jsonin your working directory and use the pretty-printing script e.g.pretty_j1939.pyexample.candump.txtThepretty_j1939.pyscript (and thedescriberinpretty_j1939/parse.pythat it builds-on) has various levels of
verbosity available when describing J1939 traffic in candump logs:usage:pretty_j1939.py[-h][--candata[CANDATA]][--pgn[PGN]][--spn[SPN]][--transport[TRANSPORT]][--link[LINK]][--include-na[INCLUDE_NA]][--format[FORMAT]]candump

pretty-printingJ1939candumplogs

positionalarguments:candumpcandumplog

optionalarguments:-h,--helpshowthishelpmessageandexit--candata[CANDATA]printinputcandata--pgn[PGN]printsource/destination/typedescription--spn[SPN]printsignalsdescription--transport[TRANSPORT]printdetailsoftransport-layerstreamsfound--link[LINK]printdetailsoflink-layerframesfound--include-na[INCLUDE_NA]inludenot-available(0xff)SPNvalues--format[FORMAT]formateachstructure(otherwisesingle-line)Installingpip3installpretty_j1939Notes on Digital Annex SourcesYou need to obtain a J1939 Digital Annex from the SAE to create a JSON file that can be used bypretty_j1939.pyseehttps://www.sae.org/standards/content/j1939da_201907/for details.There are multiple releases; here are a couple notes to consider when purchasing your copy of the Digital Annex.the 201611 Digital Annex has fewer defined SPNs in it than the 201311 Digital Annex; at some point the owners of the
DA started migrating 'technical' SPNs (e.g. DMs) to other documents and out of the DAthe 201311 Digital Annex has a couple bugs in it that thecreate_j1939db-json.pyhas workarounds forthecreate_j1939db-json.pycan also handle the XLS Export from isobus.net by supplying multiple excel sheets
as input (with multiple-farguments); however, the isobus.net definitions omit almost all of the commercial vehicle
SPNs and PGNs so the resultingJ1939db.jsonfile may not be of great use in examining candump captures from commercial
vehicles.Future Workport this functionality to thepython-j1939andpython-canprojectssupport for discontiguous SPN fieldsdefault JSON database (of limited content) based on public informationsupport for J1939 aspects not encoded in the Digital Annex (ever, or anymore) e.g. Address Claim, DMs