Skip to content

OBD Data model

fr3ts0n edited this page Oct 4, 2019 · 1 revision

OBD data model

The OBD data model is split into 2 different files, which are all in tab-delimited csv format:

  • Data conversions
  • Data items / PIDs

Conversions

The conversion data contains all information which is required to convert a incoming data value into a physical, or textual representation value. Since there are multiple methods to convert binary data to meaningful information, several conversion types are supported. Also there are different measurement systems used around the world, so following, most common measurement systems are supported: metric and imperial.

Conversion types

In order to convert protocol data into numerical, or textual values, following conversion types are available:

LINEAR

  • Linear numeric conversion to calculate physical values

HASH

  • Conversion of numeric values to descriptive state messages.
  • Field Parameters needs to contain: #### value*=state text[[;value=state text]...]

BITMAP

  • Conversion of bit masked values to descriptive bit states.
  • Field Parameters needs to contain: #### bit position*=state text[[;bit position=state text]...]

PCODELIST

  • Conversion of OBD P/I-Fault code numbers to it's fault description.
  • Field Parameters: #### name of resource bundle

CODELIST

  • Conversion from any numerical code number to it's fault description.
  • Field Parameters: #### name of resource bundle

ASCII

  • Conversion from protocol buffer to ASCII string

Conversion data fields

CONVERSION_ID

  • Textual ID of this conversion, which is used as reference for data items to be used

TYPE

  • Textual ID of the type of conversion. See description of conversion types below ...

VARIANT

  • ID of variants to the selected conversion type (currently unused, always 0)

SYSTEM

  • System of measurement: METRIC / IMPERIAL.

FACT

  • factor for numeric calculation

DIV

  • divider for numeric calculation

OFFS

  • offset for numeric calculation

PhOf

  • physical offset for numeric calculation

UNIT

  • physical unit representation

Remark

  • remarks to this data conversion

Parameters

  • parameter data for non linear/numeric conversions (like state lists, bit descriptions, etc.)
  • in csv list format: #### key*=value[[;key=value]...]

Linear Numeric conversion calculation

All linear conversion items are calculated using following formula:

physicalValue = (rawValue + #### OFFS** ) * **FACT** / **DIV** + **PhOf

Data items / PIDs

Data item / PID definitions contain all information to extract certain data elements out of the received communication data buffer like OBD service, OBD PID number, item position and length, together with the information of the data content, conversion and limitation to certain MIN/MAX limits.

Since OBD pids may contain more information, than just one measurement, multiple data items may be extracted/displayed fromout one PID data response.

Data items / PIDs data fields

svc

  • OBD service(s), which this data item is valid for. . comma separated list of HEX numbers

pid

  • OBD PID number which this data item is contained.
  • Single HEX PID number

ofs

  • Offset (in bytes) where this data is located within PID response payload data

len

  • Length of data item in bytes within PID response payload data

bit_ofs

  • Bit offset (LSB) of relevant data within above bytes

bit_length

  • Number of relevant bits within above bytes

bit_mask

  • Mask of relevant bits within above bytes

formula

format

  • Data display format definition (printf syntax)

min

  • Minimum limit of value
  • if not specified, limits are calculated automatically from conversion formula

max

  • Maximum limit of value
  • if not specified, limits are calculated automatically from conversion formula

mnemonic

  • name of data item for label text translations (and named responses)

label

  • Description label text for data item display

Data extraction from communication buffer

RAW numeric data is extracted from buffer as follows:

RAW value = (int)( buffer[ofs]...buffer[ofs+len] ) >> bit_ofs & ((1 << bit_len)-1) & bit_mask