J1939 is a high level communication protocol developed by the Society of Automotive Engineers (SAE) and is used as a standard for connection, communication, and diagnostics among different vehicle components and across different manufacturers. J1939 operates on a CAN (Controller Area Network) bus physical and data link layer, in accordance with ISO 11898 standards and the Open Systems Interconnection (OSI) network model. Data is transmitted in the form of message packets, each containing 8 bytes of data and and an identifier known as a Parameter Group Number (PGN), which identifies the message function and parameters needed. The PGN also defines the type of Suspect Parameter Number (SPE) elements which determine the type of data that is transmitted1.
Several AWC application engineers recently assisted a large oilfield services company with an application integrating J1939 with an Siemens S7-300 PLC in a TIA Portal project. This was accomplished through the use of a SIMATIC PN/J1939 LINK gateway that bridges the gap between PROFINET and J1939 networks. Below are some hints on how to integrate J1939 into TIA Portal:
- Make sure to capture all of the pertinent PGN information. In this example, the PGN is 61444 and is 8 bytes in size, and there are several SPNs defined (for instance, SPN 190 is Engine Speed).
- In the device configuration of the TIA Portal project, drop in the PN-J1939 module and start configuring the PGN submodules. Every PGN will need its own submodule, and will need to match the length defined inside the standard.
- When configuring the submodule, the PGN number will need to be converted and then entered into the individual fields in the submodule’s parameters. This can be accomplished using the Windows calculator in Programmer mode.
Enter the PGN into the calculator as a decimal and select HEX
There should be 6 digits but the first two could be truncated and will not appear in the calculator if both are 0
The first digit is the extended data page (0 in this example)
The second digit is the data page (also 0 in this example)
The third and fourth digits correspond to the PDU format (F0 in this example, which is 240 in decimal)
The fifth and sixth digit corresponds to the PDU specific (04 in this example; remember that this is in HEX format!)
The CA source address is the address of the device that data will be read from
Next you need to read the definition of the PGN to see how the SPNs are arranged inside of it. In the above example, PGN61444 contains 8 bytes of information, and Engine Speed is a WORD (2 bytes in size) starting at Byte 4. That value can then be multipled by 0.125 to get the actual engine speed.
For future projects, the AWC application engineering team would recommend creating a user-defined data type (UDT) for each PGN that the PLC will need to access. This would streamline the process of handling the PGN data inside of TIA Portal, because UDTs can be assigned directly to corresponding IO addresses inside the PLC tag table instead of having to parse information from different bytes.
- Julyann Tu – AWC, Inc.