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.