5.1.38. DTC diagnostic trouble code (pdtc_DiagnosticTroubleCode)

Set the state and auxiliary data about a diagnostic trouble code.

5.1.38.1. Supported targets

All targets

5.1.38.2. Required license

None (Main library). (See Section 2.3, “Licensed Features”.)

5.1.38.3. Description

A diagnostic trouble code (DTC) is a unique indicator used to remember the state of a fault. The model determines if the conditions for signalling the fault are satisfied or not, and passes this information to the pdtc_DiagnosticTroubleCode block. Whether the fault is active or not, is maintained by the block while the model is running and across power cycles (see the pdtc_Memory block for more details).

There is only one type of DTC at the moment, more may be added in the future.

J1939 DTC

The J1939 DTC maintains a fault state and a count of the how many times the DTC has become active. The J1939 DTC states follow this state diagram:

Figure 5.3. J1939 DTC states

J1939 DTC states

The DTC starts in the clear state (or whichever state was recalled from non-volatile memory during power up, see the pdtc_Memory block for more details), and remains in this state until the inport active becomes 1. The block then changes the DTC state to active and remains in this state until the inport active becomes zero. And so on.

Outwith this diagram pictured above, the DTC state can be forcefully set to clear through the use of the pdtc_ClearAll block, or pdtc_ClearAllIfActive block, or pdtc_ClearAllIfInactive block.

If the DTC cannot be recalled from non-volatile memory (which includes the first time the ECU is powered up), then the J1939 DTC is initialised as follows:

DTC informationInitial value
StateClear
Count0
Lamp malfunction3
Lamp red3
Lamp amber3
Lamp protect3

5.1.38.4. Inports

  • active

    Set to 1 if the dtc is active, set to zero otherwise. Available only if the parameter DTC type is J1939 DTC.

    Range: 0 or 1

    Value type:Boolean
  • lamp_malfunction

    Set to desired lamp state (0 is Slow Flash, 1 is Fast Flash, 2 is On, 3 is Off). Available only if the parameter DTC type is J1939 DTC.

    Range: [0, 3]

    Value type:Integer
  • lamp_red

    Set to desired lamp state (0 is Slow Flash, 1 is Fast Flash, 2 is On, 3 is Off). Available only if the parameter DTC type is J1939 DTC.

    Range: [0, 3]

    Value type:Boolean
  • lamp_amber

    Set to desired lamp state (0 is Slow Flash, 1 is Fast Flash, 2 is On, 3 is Off). Available only if the parameter DTC type is J1939 DTC.

    Range: [0, 3]

    Value type:Boolean
  • lamp_protect

    Set to desired lamp state (0 is Slow Flash, 1 is Fast Flash, 2 is On, 3 is Off). Available only if the parameter DTC type is J1939 DTC.

    Range: [0, 3]

    Value type:Boolean

5.1.38.5. Outports

  • active.

    Set to 1 if the dtc is in the active state, set to zero otherwise. Available only if the parameter DTC type is J1939 DTC.

    Value type:Boolean
  • state

    Set to the value of the current DTC state (see the DTC types descriptions for a list of states and values). Available only if the parameter DTC type is J1939 DTC.

    Value type:List
  • count

    A count of the number of times a DTC has changed to the active state. Available only if the parameter DTC type is J1939 DTC.

    Range: [0, 127]

    Value type:Integer

5.1.38.6. Mask parameters

5.1.38.7. Notes

None.