Diagnostics Domain

The diagnostics domain API is specifically designed to support diagnostics related use cases. It is available from the com.vector.cfg.automation.scripting.base.IAutomationContext.IDomainApi IDomainApi in the form of the IDiagnosticsApi interface.

getDiagnostics allows accessing the IDiagnosticsApi like a property.

Accessing IDiagnosticsApi as a property
scriptTask('taskName') {
  code {
    // IDiagnosticsApi is available as "diagnostics" property
    def diagnostics = domain.diagnostics
  }
}

diagnostics(Transformer) allows accessing the IDiagnosticsApi in a scope-like way.

Accessing IDiagnosticsApi in a scope-like manner
scriptTask('taskName') {
  code {
    domain.diagnostics {
      // IDiagnosticsApi is available here
    }
  }
}

The following use cases are supported:

Dem Events

The API provides access and creation of IDemEvents in the configuration. See chapter IDemEvent for more details.

Check for OBD II

isObd2Enabled() checks, if OBD II is available in the configuration.

Enable OBD II

setObd2Enabled(boolean) enables or disables OBD II in the configuration. Note, that OBD II can only be enabled, if a valid SIP license was found.

Check for WWH-OBD

isWwhObdEnabled() checks, if WWH-OBD is available in the configuration.

Enable WWH-OBD

setWwhObdEnabled(boolean) enables or disables WWH-OBD in the configuration. Note, that WWH-OBD can only be enabled, if a valid SIP license was found.

DemEvents

An IDemEvent instance represents a diagnostic event and and provides usecase centric functionalities to modify and query diagnostic events.

Accessing Dem Events

getDemEvents() returns a list of all IDemEvents in the configuration.

Creating Dem Events

createDemEvent(Action) is used to create diagnostic events of different kinds.

The method can be configured to create different types of DTCs/Events:

  1. UDS Event: This is the default type of event, when only an 'eventName' and a 'dtc' number is specified. A new DemEventParameter container with the given shortname and a new DemDTCClass with the given DemUdsDTC is created.

    Create a new UDS DTC with event
    scriptTask('taskName') {
        code {
            transaction {
                domain.diagnostics {
    
                    def udsEvent = createDemEvent {
                        eventName = "NewUdsEvent"
                        dtc = 0x30
                    }
    }}}}

  2. OBD II Event: If OBD II is enabled for the loaded configuration, and a 'obd2Dtc' is specified instead of a 'dtc', the method will create an OBD II relevant event. The difference is, that it will set the parameter DemObdDTC instead of DemUdsDTC. It is also possible to specify 'dtc' as well as 'obd2dtc', which will result in both DTC parameters are set.

    Enable OBD II and create a new OBD related DTC with event
    scriptTask('taskName') {
        code {
            transaction {
                domain.diagnostics {
                    // OBD must be enabled and legislation must be OBD2
                    // Enable OBD2
                    obd2Enabled = true
    
                    def obd2Event = createDemEvent {
                        eventName = 'NewOBD2Event'
                        obd2Dtc = 0x40
                    }
    
                    def obd2CombinedEvent = createDemEvent {
                        eventName = 'UDS_OBD2_Combined_Event'
                        dtc = 0x31
                        obd2Dtc = 0x41
                    }
    }}}}

  3. WWH-OBD Event: If WWH-OBD is enabled for the loaded configuration, and a 'wwhObdDtcClass' with a value other than 'NO_CLASS' is specified, the method will create a WWH-OBD relevant event. Note that WWH-OBD relevant events usually du reference the so called MIL indicator, thus this reference will be set by default in the newly created DemEventParameter.

    Enable WWH-OBD and create a new OBD related DTC with event
    scriptTask('taskName') {
        code {
            transaction {
                domain.diagnostics {
                    // OBD must be enabled, and legislation must be WWH-OBD
                    // The parameter '/Dem/DemGeneral/DemMILIndicatorRef' must be set
                    wwhObdEnabled = true
    
                    def wwhObdEvent = createDemEvent {
                        eventName = 'WWHOBD_Event'
                        dtc = 0x50
                        // wwhObdClass != NO_CLASS indicates WWH-OBD event
                        wwhObdDtcClass = CLASS_A
                    }
    }}}}

  4. J1939 Event: The last type of event is a J1939 related event, which can be created when J1939 is licensed and available for the loaded configuration. This is done in a similar way as for UDS events, but additionally specifying 'spn', 'fmi' values as well as the name of the referenced 'nodeAddress'.

    Open a project, enable J1939 and create a new J1939 DTC with event
    scriptTask('taskName') {
        code {
            def nodeAddressContainer = mdfModel(AsrPath.create("/ActiveEcuC/Dem/DemConfigSet/DemJ1939NodeAddress", MIContainer))
    
            transaction {
                domain.diagnostics {
                    // J1939 Event creation
                    // J1939 must be enabled and License must be available.
                    j1939Enabled = true
    
                    def j1939Event = createDemEvent {
                        eventName 'J1939_Event'
                        dtc 0x30
                        spn 90
                        fmi 13
                        nodeAddress nodeAddressContainer
                    }
    }}}}


    Important Note:
    For every DTC numbers apply the rule, that if there are already DemDTCClasses with the given number, they will be used. In such a case, no new DemDTCClass container is created.