Overview
TheJ1979 class processes and decodes SAE J1979 (OBD-II) diagnostic signals captured from CAN bus traffic. It handles ISO-TP formatted Universal Diagnostic Service (UDS) responses, converting raw byte data into physical units based on standardized Parameter ID (PID) specifications.
J1979 signals serve as ground truth labels during semantic analysis, allowing the pipeline to identify and correlate unknown CAN signals with known diagnostic parameters.
Constructor
Parameter ID value in decimal (e.g., 12 for Engine RPM, 13 for Vehicle Speed). Supported PIDs:
12(0x0C): Engine RPM13(0x0D): Vehicle Speed17(0x11): Throttle Position97(0x61): Demand Torque %98(0x62): Actual Torque %99(0x63): Reference Torque142(0x8E): Engine Friction Torque %
Pandas DataFrame containing ISO-TP UDS response data. Must have columns
['b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7'] representing the 8-byte CAN payload, with timestamps as the index- Validates and stores the PID
- Calls
process_response_data()to decode the payload - Stores decoded values in
dataSeries - Prints confirmation message with PID and title
Instance Attributes
The Parameter ID in decimal (e.g., 12, 13, 17)
Human-readable name of the diagnostic parameter. Set by
process_response_data() based on PID:- PID 12: “Engine RPM”
- PID 13: “Speed km/h”
- PID 17: “Throttle %”
- PID 97: “Demand Torque %”
- PID 98: “Actual Torque %”
- PID 99: “Reference Torque Nm”
- PID 142: “Engine Friction Torque %”
Pandas Series containing the decoded diagnostic values in physical units (RPM, km/h, %, Nm). Index matches the original_data timestamps. Data type varies by PID (float16, uint8, int8, uint16)
Methods
process_response_data
DataFrame with columns
['b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7'] containing decimal byte valuesValueError if the PID is not implemented
ISO-TP UDS Response Format
J1979 responses follow the ISO-TP + UDS protocol structure:The response data is already in decimal format in the DataFrame. Byte b1 should be 0x41 (65 decimal) for successful responses. Other values indicate UDS error codes.
Supported PIDs
PID 0x0C (12) - Engine RPM
“Engine RPM”
float16
Example:
PID 0x0D (13) - Vehicle Speed
“Speed km/h”
uint8
Example:
PID 0x11 (17) - Throttle Position
“Throttle %”
uint8
Example:
PID 0x61 (97) - Demand Torque
“Demand Torque %”
int8
Example:
PID 0x62 (98) - Actual Engine Torque
“Actual Torque %”
int8
Example:
PID 0x63 (99) - Reference Torque
“Reference Torque Nm”
uint16
Example:
PID 0x8E (142) - Engine Friction Torque
“Engine Friction Torque %”
int8
Example:
Usage Example
Pipeline Integration
Pre-Processing Detection
InPreProcessor.generate_arb_id_dictionary():
Semantic Analysis Correlation
InSemanticAnalysis.j1979_signal_labeling():
Visualization
InPlotter.plot_j1979():
Error Handling
Unsupported PID:0x10: General Reject0x11: Service Not Supported0x12: Sub-Function Not Supported0x31: Request Out of Range
Adding New PIDs
To support additional J1979 PIDs:- Add a new
elif self.pid == {decimal_value}:block inprocess_response_data() - Set
self.titlewith a descriptive name - Implement the conversion formula per SAE J1979 specification
- Extract data from appropriate byte positions (b3, b4, etc.)
- Choose appropriate data type (uint8, int8, uint16, float16)
- Return the Series with converted values