SAFETY_DATA_GROUP_SAFE (STRUCT) ¶ TYPE SAFETY_DATA_GROUP_SAFE : STRUCT J1939 Safety Data Group (SDG) information provided by a J1939SafetySafe.Safe_SDG_Producer. Intended sequence of operation on update: SDG data, SHM and SDM CAN message, are updated and valid SDG_Cnt is incremented InOut: Name Type Initial Comment S_udiSDG_Cnt UDINT 0 Number of produced SDG’s S_SHM CAN_MESSAGE Produced SHM CAN message S_SDM CAN_MESSAGE Produced SDM CAN message
SAFETY_DATA_GROUP_UNSAFE (STRUCT) ¶ TYPE SAFETY_DATA_GROUP_UNSAFE : STRUCT J1939 Safety Data Group (SDG) information provided by a J1939SafetyStd.Unsafe_SDG_Receiver. Intended sequence of operation on update of SHM: SHM CAN message and SHM tmestamp is set SHM_RecvCnt is incremented Intended sequence of operation on update of SDM: SDM CAN message and SDM timestamp is set SDM_RecvCnt is incremented InOut: Name Type Initial Comment SHM CAN_MESSAGE Received SHM CAN message udiSHM_RecvCnt UDINT 0 Number of received SHM’s udiSHM_Timestamp UDINT 0 SHM capture timestamp in microseconds SDM CAN_MESSAGE Received SDM CAN message udiSDM_RecvCnt UDINT 0 Number of received SDM’s udiSDM_Timestamp UDINT 0 SDM capture timestamp in microseconds
File and Project Information ¶ Scope Name Type Content FileHeader creationDateTime date 15.06.2023, 14:48:31 companyName string 3S-Smart Software Solutions GmbH libraryFile J1939Safety_Itfs.library primaryProject True productName CODESYS productProfile CODESYS V3.5 SP16 Patch 3 contentFile J1939Safety_Itfs.clean.json version version 2.0.0.0 ProjectInformation AutoResolveUnbound bool True IsEndUserLibrary False IsInterfaceLibrary True Released True SIL2 True SourceLibrary False LastModificationDateTime date 15.06.2023, 14:48:30 LibraryCategories library-category-list Application|Safety SIL2 Author string 3S - Smart Software Solutions GmbH Company 3S - Smart Software Solutions GmbH CompiledLibraryCompatibilityVersion CODESYS V3.5 SP16 Patch 3 DefaultNamespace J1939SafetyItf Description See: Description DocFormat reStructuredText LanguageModelAttribute qualified-access-only Project J1939Safety_Itfs Title J1939 Safety Interfaces Version version 4.1.0.0
Library Reference ¶ This is a dictionary of all referenced libraries and their name spaces.
J1939 Safety ¶ Enums ERROR (Enum) Function Blocks Safe_SDG_Consumer (FunctionBlock) Safe_SDG_Producer (FunctionBlock)
ERROR (ENUM) ¶ TYPE ERROR : This data type describes errors which can occure using CODESYS J1939 Safety library. Attributes: qualified_only InOut: Name Initial Comment NO_ERROR 16#0 No error occurred CALLER_CONTEXT 16#10 Function block was called in the wrong contex. PARAM_PRIO 16#20 Parameter SHM and SDM priority error PARAM_REFRESH_TIME 16#21 Parameter refresh time invalid PARAM_DATA_LENGTH 16#22 Parameter data length invalid PARAM_SCT 16#23 Parameter SCT invalid PARAM_SRVT 16#24 Parameter SRVT invalid PARAM_PGN 16#25 Parameter PGN invalid COMM_CORRUPTION 16#30 SDG safety error - message corruption. Messages may be corrupted due to errors within a bus participant, due to errors on the transmission medium, or due to message interference. COMM_SCT 16#31 SDG safety error - unacceptable delay (SCT - SHM not arrived in time). COMM_SRVT 16#32 SDG safety error - unacceptable delay (SRVT - SDM not arrived in time). COMM_UNINTENDED_REPETITION 16#33 SDG safety error - unintended repetition of SHM message. Old not-updated messages may be repeated at an incorrect point in time. COMM_SEQNUM_ORDER 16#34 SDG safety error - incorrect SHM sequence number order, e.g. SHM message lost. COMM_SEQ_SHM_SDM 16#35 SDG safety error - incorrect sequence, SDM before SHM received. COMM_SHM_DATA_LENGTH 16#80 SDG safety error - received SHM data length incorrect, 8 expected. COMM_SHM_DATA_PAGE 16#81 SDG safety error - received SHM id Data Page incorrect, 0 expected. COMM_SHM_EXT_DATA_PAGE 16#82 SDG safety error - received SHM id Extended Data Page incorrect, 0 expected. COMM_SHM_PDU_SPECIFIC 16#83 SDG safety error - received SHM id PDU specific value incorrect. COMM_SHM_PDU_FORMAT 16#84 SDG safety error - received SHM id PDU format value incorrect, 14 expected. COMM_SHM_SRC_ADDR 16#85 SDG safety error - received SHM id source address incorrect. COMM_SHMDATA_INV_DATA_PAGE 16#90 SDG safety error - received SHM data inverted SDM Data Page incorrect. COMM_SHMDATA_INV_EXT_DATA_PAGE 16#91 SDG safety error - received SHM data inverted SDM Extended Data Page incorrect. COMM_SHMDATA_INV_PDU_FORMAT 16#92 SDG safety error - received SHM data inverted SDM PDU format incorrect. COMM_SHMDATA_INV_PDU_SPECIFIC 16#93 SDG safety error - received SHM data inverted SDM PDU specific incorrect. COMM_SHMDATA_INV_SRC_ADDR 16#94 SDG safety error - received SHM data inverted SDM souce address incorrect. COMM_SHMDATA_RESBIT 16#95 SDG safety error - received SHM data reserved data bit invalid. COMM_SDM_EXT_DATA_PAGE 16#A0 SDG safety error - received SDM id Extended Data Page incorrect, check the intended connection. COMM_SDM_DATA_PAGE 16#A1 SDG safety error - received SDM id Data Page incorrect, check the intended connection. COMM_SDM_PDU_SPECIFIC 16#A2 SDG safety error - received SDM id PDU specific value incorrect, check the intended connection. COMM_SDM_PDU_FORMAT 16#A3 SDG safety error - received SDM id PDU format value incorrect, check the intended connection. COMM_SDM_SRC_ADDR 16#A4 SDG safety error - received SDM id souce address incorrect, check the intended connection. COMM_SDM_DATA_LENGTH 16#A5 SDG safety error - received SDM data length incorrect, must be 0 < len <= 8.
Function Blocks ¶ Safe_SDG_Consumer (FunctionBlock) Safe_SDG_Producer (FunctionBlock)
Safe_SDG_Consumer (FB) ¶ FUNCTION_BLOCK Safe_SDG_Consumer Safe_SDG_Consumer consumes unsafe J1939-76 SDG data provided by a J1939SafetyStd.Unsafe_SDG_Receiver. Safe_SDG_Consumer is relying on a sequence of operation on update of SHM / SDM done by J1939SafetyStd.Unsafe_SDG_Receiver. Please refer to the documentation of J1939SafetyStd.Unsafe_SDG_Receiver or J1939SafetyItf.SAFETY_DATA_GROUP_UNSAFE. The inputs S_dwPGN, S_tTransmissionRate, S_usiSrcAddr, S_tSCT and S_tSRVT get sampled at xEnable rising edge. In cyclic operation, after a complete SDG has been received, the safety-relevant diagnostics are performed by the Safe_SDG_Consumer FB block to validate the received data. For all checks it applies that in the event of an error the S_xBusy output remains to true and the S_xError output changes to true to signal an communiction error. The respective specific error is returned for further diagnosis with the S_eErrorID output. The user data at the output of the function block are not updated in the error state and retain their previous value. For the restart of the function block, no reset is necessary on the part of the application, as specified by the J1939-76 protocol specification. The error state is exited again after the second received and valid SDG and the user data are updated again accordingly. For an overview of general data flow see the library main documentation and the J1939 Safety example.project. InOut: Scope Name Type Initial Comment Input xEnable BOOL FALSE Enable SDG consumption. The inputs S_PGN, S_usiSrcAddr, S_tSCT and S_tSRVT are sampled with a rising edge. S_dwPGN DWORD 0 Parameter Group Number (PGN). S_tTransmissionRate TIME TIME#0ms Transmission rate of sent SDG data. S_usiSrcAddr USINT 0 Source Address. S_tSCT TIME TIME#0ms Safety Cycle Time (SCT). SCT is the period of time that transpires between reception of successive SDM instances of the same Safety Data Group series. The maximum SCT for an SDG shall be based upon the SDG timing basis for the SAE J1939 PG of the SDM. For SDG timing basis less than or equal to 200 ms the maximum SCT is 150 percent of the SDG timing basis. For SDG timing basis greater than 200 ms the maximum SCT is the SDG timing basis plus 100 ms. S_tSRVT TIME TIME#0ms Safety-Relevant Validation Time (SRVT). SRVT is the time transpired between SHM reception and corresponding SDM reception of the same Safety Data Group instance. The maximum SRVT for an SDG shall be based upon the SDG timing basis for the SAE J1939 PG of the SDM. For SDG timing basis less than or equal to 200 ms the maximum SRVT is 50 percent of the SDG timing basis. For SDG timing basis greater than 200 ms the maximum SRVT is 100 ms. SDGU REFERENCE TO J1939SafetyItf.SAFETY_DATA_GROUP_UNSAFE Unsafe SDG data to consume. Output S_xBusy BOOL FALSE In operation. S_xError BOOL FALSE Error occured. S_eErrorID ERROR ERROR.NO_ERROR Error identification. S_udiSDGcnt UDINT 0 Number of consumed SDG. S_abyData ARRAY [0..7] OF SAFEBYTE Transmitted SDG data. Initial the data field is set to the “not available” value 16#FF. S_usiDataLength SAFEUSINT (0..8) 0 Length of transmitted SDG data.
Safe_SDG_Producer (FB) ¶ FUNCTION_BLOCK Safe_SDG_Producer Safe_SDG_Producer does produce a J1939 Safety SDG supposed to be send via a J1939SafetyStd.Unsafe_SDG_Sender. The inputs S_usiSHMPriority, S_usiSDMPriority, S_dwPGN, S_tTransmissionRate and S_usiSrcAddr get sampled at xEnable rising edge. The inputs S_abyData and S_usiDataLength can be set any time. For an overview of general data flow view see the library main documentation and the J1939 Safety example.project. InOut: Scope Name Type Initial Comment Input xEnable BOOL FALSE Enable SDG production. The inputs S_usiSHMprio, S_usiSDMprio, S_PGN, S_usiSrcAddr and S_tRefreshTime are sampled with a rising edge. S_usiSHMPriority SAFEUSINT (0..J1939_CONSTANTS.usiMAX_PRIORITY) 1 SHM send priority: 0-7: priority (0: high, 7: low) Note: The SHM priority shall be a value with the same or higher priority (lower value) as the SDM priority. S_usiSDMPriority SAFEUSINT (0..J1939_CONSTANTS.usiMAX_PRIORITY) 1 SDM send priority: 0-7: priority (0: high, 7: low); S_dwPGN DWORD 0 Parameter Group Number (PGN). S_tTransmissionRate TIME TIME#0ms Transmission rate to send the SDG data. S_usiSrcAddr USINT 0 Source Address. S_abyData ARRAY [0..(J1939_CONSTANTS.usiSDM_MAX_DATALENGTH - 1)] OF SAFEBYTE [0, 0, 0, 0, 0, 0, 0, 0] SDG data to transmit. S_usiDataLength SAFEUSINT (0..J1939_CONSTANTS.usiSDM_MAX_DATALENGTH) 0 Length of SDG data to transmit. Output S_xBusy BOOL FALSE In operation. S_xError BOOL FALSE Error occured. S_eErrorID ERROR ERROR.NO_ERROR Error status. S_SDGS J1939SafetyItf.SAFETY_DATA_GROUP_SAFE SDG data to be send by a J1939SafetyUnsafe.Unsafe_SDG_Sender.