{ "info": { "author": "\"Ben Gardiner \", \"Jeremy Daily \"", "author_email": "ben.gardiner@nmfta.org", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# `pretty_j1939`\n\npython3 libs and scripts for pretty-printing J1939 candump logs.\n\nThis package can:\n1. pretty-print J1939 traffic captured in candump logs AND\n1. convert a J1939 Digital Annex (Excel) file into a JSON structure for use in the above \n\n## Some examples of pretty printing\n\n*Formatted* content (one per line) next to candump data:\n\n```bash\n$ pretty_j1939.py --candata=true --format=true --link=true --transport=true example.candump.txt | head\n(1543509533.000838) can0 10FDA300#FFFF07FFFFFFFFFF ; {\n ; \"DA\": \"All(255)\",\n ; \"PGN\": \"EEC6(64931)\",\n ; \"SA\": \"Engine #1( 0)\",\n ; \"Engine Variable Geometry Turbocharger Actuator #1\": \"2.8000000000000003 [%]\"\n ; }\n(1543509533.000915) can0 18FEE000#FFFFFFFFB05C6800 ; {\n ; \"DA\": \"All(255)\",\n ; \"PGN\": \"VD(65248)\",\n ; \"SA\": \"Engine #1( 0)\",\n```\n\nSingle-line contents next to candump data:\n\n```bash\n$ pretty_j1939.py --candata=true --format=false --link=true --transport=true example.candump.txt | head\n(1543509533.000838) can0 10FDA300#FFFF07FFFFFFFFFF ; {\"SA\":\"Engine #1( 0)\",\"DA\":\"All(255)\",\"PGN\":\"EEC6(64931)\",\"Engine Variable Geometry Turbocharger Actuator #1\":\"2.8000000000000003 [%]\"}\n(1543509533.000915) can0 18FEE000#FFFFFFFFB05C6800 ; {\"SA\":\"Engine #1( 0)\",\"DA\":\"All(255)\",\"PGN\":\"VD(65248)\",\"Total Vehicle Distance\":\"854934.0 [m]\"}\n(1543509533.000991) can0 08FE6E0B#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]\"}\n(1543509533.001070) can0 18FDB255#FFFFFFFF0100FFFF ; {\"SA\":\"Diesel Particulate Filter Controller( 85)\",\"DA\":\"All(255)\",\"PGN\":\"AT1IMG(64946)\",\"Aftertreatment 1 Diesel Particulate Filter Differential Pressure\":\"0.1 [kPa]\"}\n(1543509533.001145) can0 0CF00400#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 [%]\"}\n(1543509533.001220) can0 18FF4500#6D00FA00FF00006A ; {\"SA\":\"Engine #1( 0)\",\"DA\":\"All(255)\",\"PGN\":\"PropB_45(65349)\",\"Manufacturer Defined Usage (PropB_PDU2)\":\"0x6d00fa00ff00006a\"}\n(1543509533.001297) can0 18FEDF00#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)\"}\n(1543509533.001372) can0 1CFE9200#FFFFFFFFFFFFFFFF ; {\"SA\":\"Engine #1( 0)\",\"DA\":\"All(255)\",\"PGN\":\"EI1(65170)\"}\n(1543509533.001447) can0 18F00131#FFFFFF3F00FFFFFF ; {\"SA\":\"Cab Controller - Primary( 49)\",\"DA\":\"All(255)\",\"PGN\":\"EBC1(61441)\",\"Accelerator Interlock Switch\":\"0 (00 - Off)\",\"Engine Retarder Selection\":\"0.0 [%]\"}\n(1543509533.001528) can0 18FEF131#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\\\")\"}\n```\n\n*Formatted* contents of the transport SPNs only.\n\n```bash\n$ pretty_j1939.py --candata=false --format=true --link=false --transport=true example.candump.txt |head\n{\n \"Transport PGN\": \"AT1HI1(64920)\",\n \"Aftertreatment 1 Total Fuel Used\": \"227.5 [liters]\",\n \"Aftertreatment 1 DPF Average Time Between Active Regenerations\": \"173933 [Seconds]\",\n \"Aftertreatment 1 DPF Average Distance Between Active Regenerations\": \"1460.5 [m]\"\n}\n{\n \"Transport PGN\": \"AT1HI1(64920)\",\n \"Aftertreatment 1 Total Fuel Used\": \"227.5 [liters]\",\n \"Aftertreatment 1 DPF Average Time Between Active Regenerations\": \"173933 [Seconds]\",\n```\n\n## HOWTO\n\nFirst, obtain a copy of the digital annex, see https://www.sae.org/standards/content/j1939da_201907/ for details.\n\nThen, use the `create_j1939db-json.py` script to convert that Digital Annex into a JSON file e.g.\n\n```bash\ncreate_j1939db-json.py -f tmp/J1939DA_201611.xls -w tmp/J1939DA_201611.json\n```\n\nPlace the resulting JSON file at `J1939db.json` in your working directory and use the pretty-printing script e.g.\n\n```bash\npretty_j1939.py example.candump.txt\n```\n\nThe `pretty_j1939.py` script (and the `describer` in `pretty_j1939/parse.py` that it builds-on) has various levels of\nverbosity available when describing J1939 traffic in candump logs:\n\n```bash\nusage: pretty_j1939.py [-h] [--candata [CANDATA]] [--pgn [PGN]] [--spn [SPN]]\n [--transport [TRANSPORT]] [--link [LINK]]\n [--include-na [INCLUDE_NA]] [--format [FORMAT]]\n candump\n\npretty-printing J1939 candump logs\n\npositional arguments:\n candump candump log\n\noptional arguments:\n -h, --help show this help message and exit\n --candata [CANDATA] print input can data\n --pgn [PGN] print source/destination/type description\n --spn [SPN] print signals description\n --transport [TRANSPORT]\n print details of transport-layer streams found\n --link [LINK] print details of link-layer frames found\n --include-na [INCLUDE_NA]\n inlude not-available (0xff) SPN values\n --format [FORMAT] format each structure (otherwise single-line)\n```\n\n## Installing\n\n```bash\npip3 install pretty_j1939\n```\n\n## Notes on Digital Annex Sources\n\nYou need to obtain a J1939 Digital Annex from the SAE to create a JSON file that can be used by `pretty_j1939.py` see\nhttps://www.sae.org/standards/content/j1939da_201907/ for details.\n\nThere are multiple releases; here are a couple notes to consider when purchasing your copy of the Digital Annex.\n* the 201611 Digital Annex has fewer defined SPNs in it than the 201311 Digital Annex; at some point the owners of the\nDA started migrating 'technical' SPNs (e.g. DMs) to other documents and out of the DA\n* the 201311 Digital Annex has a couple bugs in it that the `create_j1939db-json.py` has workarounds for\n* the `create_j1939db-json.py` can also handle the XLS Export from isobus.net by supplying multiple excel sheets\nas input (with multiple `-f` arguments); however, the isobus.net definitions omit almost all of the commercial vehicle\nSPNs and PGNs so the resulting `J1939db.json` file may not be of great use in examining candump captures from commercial\nvehicles.\n\n## Future Work\n\n* port this functionality to the [python-j1939](https://github.com/milhead2/python-j1939) and \n[python-can](https://github.com/hardbyte/python-can/) projects\n* support for discontiguous SPN fields\n* default JSON database (of limited content) based on public information\n* support for J1939 aspects not encoded in the Digital Annex (ever, or anymore) e.g. Address Claim, DMs\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nmfta-repo/pretty_j1939", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pretty-j1939", "package_url": "https://pypi.org/project/pretty-j1939/", "platform": "", "project_url": "https://pypi.org/project/pretty-j1939/", "project_urls": { "Homepage": "https://github.com/nmfta-repo/pretty_j1939" }, "release_url": "https://pypi.org/project/pretty-j1939/0.0.1/", "requires_dist": [ "asteval", "defusedxml", "unidecode", "xlrd", "bitstring" ], "requires_python": "", "summary": "python libs and scripts for pretty-printing J1939 logs", "version": "0.0.1" }, "last_serial": 5722733, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "9b8719bc1b09518ec7a630dab37a35d7", "sha256": "cb219b7f6c77b26963fb463bdc3f0f8af1a4e00d4f05f22d456257a1026997b2" }, "downloads": -1, "filename": "pretty_j1939-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9b8719bc1b09518ec7a630dab37a35d7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19358, "upload_time": "2019-08-23T20:41:34", "url": "https://files.pythonhosted.org/packages/46/32/8c5938106e447be4d2b125b690db0586974bd1797fe00200b9bf8aced764/pretty_j1939-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d321646996b44e9454322fcd1075b17", "sha256": "c21a6c12aad9e02ffee30e6913b3ca48a144c085afba09ee7a39f19f5317349b" }, "downloads": -1, "filename": "pretty_j1939-0.0.1.tar.gz", "has_sig": false, "md5_digest": "9d321646996b44e9454322fcd1075b17", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14040, "upload_time": "2019-08-23T20:41:37", "url": "https://files.pythonhosted.org/packages/cc/69/8619743427c4ac29ccf4fba5a8662a4f047049450a37d764838b332b94b8/pretty_j1939-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9b8719bc1b09518ec7a630dab37a35d7", "sha256": "cb219b7f6c77b26963fb463bdc3f0f8af1a4e00d4f05f22d456257a1026997b2" }, "downloads": -1, "filename": "pretty_j1939-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9b8719bc1b09518ec7a630dab37a35d7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19358, "upload_time": "2019-08-23T20:41:34", "url": "https://files.pythonhosted.org/packages/46/32/8c5938106e447be4d2b125b690db0586974bd1797fe00200b9bf8aced764/pretty_j1939-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d321646996b44e9454322fcd1075b17", "sha256": "c21a6c12aad9e02ffee30e6913b3ca48a144c085afba09ee7a39f19f5317349b" }, "downloads": -1, "filename": "pretty_j1939-0.0.1.tar.gz", "has_sig": false, "md5_digest": "9d321646996b44e9454322fcd1075b17", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14040, "upload_time": "2019-08-23T20:41:37", "url": "https://files.pythonhosted.org/packages/cc/69/8619743427c4ac29ccf4fba5a8662a4f047049450a37d764838b332b94b8/pretty_j1939-0.0.1.tar.gz" } ] }