Main Content

Configure Calls to AUTOSAR Diagnostic Event Manager Service

For the AUTOSAR Classic Platform, the AUTOSAR standard defines important services as part of Basic Software (BSW) that runs in the AUTOSAR Runtime Environment (RTE). Examples include services provided by the Diagnostic Event Manager (Dem), the Function Inhibition Manager (FiM), and the NVRAM Manager (NvM). In the AUTOSAR RTE, AUTOSAR software components typically access BSW services using client-server or sender-receiver communication.

To support system-level modeling of AUTOSAR components and services, AUTOSAR Blockset provides an AUTOSAR Basic Software block library. The library contains preconfigured blocks for modeling component calls to AUTOSAR BSW services and reference implementations of the BSW services. For information about using the blocks to model client calls to AUTOSAR BSW service interfaces, see Model AUTOSAR Basic Software Service Calls.

For a live-script example of simulating AUTOSAR BSW services, see example Simulate AUTOSAR Basic Software Services and Run-Time Environment.

Here is an example of configuring client calls to Dem service interfaces in your AUTOSAR software component.

  1. Open a model that is configured for AUTOSAR code generation. Using the Library Browser or by typing block names in the model window, add Dem blocks to the model. This example adds the blocks DiagnosticInfoCaller and DiagnosticMonitorCaller to the example model autosar_swc.

    openExample('autosar_swc');

  2. Open each block and examine the parameters, especially Operation. If you select a different operation and click Apply, the software updates the block inputs and outputs to match the arguments of the selected operation.

    This example changes the Operation for the DiagnosticInfoCaller block from GetEventStatus to GetEventFailed. (For an example of using GetEventFailed in a throttle position monitor implementation, see example Simulate AUTOSAR Basic Software Services and Run-Time Environment.) The Operation parameter must be set to an operation supported by the schema currently specified by the model. The list of operations reflects the operations supported by the current schema.

    For some Dem operations, such as GetDTCOfEvent and SetEventStatus, the block parameters dialog box displays a data type parameter. The parameter specifies an enumerated data type for a function input that represents a Dem format type or event status. Default data types are provided, such as Dem_DTCFormatType or Dem_EventStatusType. For more information about format type or event status values, see the AUTOSAR standard Specification of Diagnostic Event Manager.

  3. Open the Code Mappings editor. To update the Simulink® to AUTOSAR mapping of the model with changes to Simulink function callers, click the Update button . The software creates AUTOSAR client-service interfaces, operations, and ports, and maps each Simulink function caller to an AUTOSAR client port and operation.

    For example, for the DiagnosticMonitorCaller block in this example, for which the SetEventStatus operation is selected:

    • The software creates C-S interface DiagnosticMonitor, and under DiagnosticMonitor, its supported operations. For each operation, arguments are provided with read-only properties. Here are the arguments for the DiagnosticMonitor operation SetEventStatus displayed in the AUTOSAR Dictionary.

    • The software creates a client port with the default name DiagnosticMonitor. Unlike the C-S-interface, operation, and argument names, the client port name can be customized. The client port is mapped to the DiagnosticMonitor interface.

    • The Code Mappings editor, Function Callers tab, maps the DiagnosticMonitor function caller block to AUTOSAR client port DiagnosticMonitor and AUTOSAR operation SetEventStatus.

  4. Optionally, build your component model and examine the generated C and ARXML code. The C code includes the client calls to the BSW services, for example:

    /* FunctionCaller: '<Root>/DiagnosticInfoCaller' */
    Rte_Call_DiagnosticInfo_GetEventFailed(&rtb_DiagnosticInfoCaller_o1);
    
    /* FunctionCaller: '<Root>/DiagnosticMonitorCaller' */
    Rte_Call_DiagnosticMonitor_SetEventStatus(DEM_EVENT_STATUS_PASSED);

    Generated RTE include files define the server operation call points, such as Rte_Call_DiagnosticMonitor_SetEventStatus, and argument data types, such as enumeration type Dem_EventStatusType.

    The ARXML code defines the BSW service operations called by the component as server call points, for example:

    <SERVER-CALL-POINTS>
    ...
        <SYNCHRONOUS-SERVER-CALL-POINT UUID="...">
            <SHORT-NAME>SC_DiagnosticMo_334e61e63627b44b</SHORT-NAME>
            <OPERATION-IREF>
                <CONTEXT-R-PORT-REF DEST="R-PORT-PROTOTYPE">
                  /Company/Powertrain/Components/ASWC/DiagnosticMonitor
                </CONTEXT-R-PORT-REF>
                <TARGET-REQUIRED-OPERATION-REF DEST="CLIENT-SERVER-OPERATION">
                  /AUTOSAR/Services/Dem/DiagnosticMonitor/SetEventStatus
                </TARGET-REQUIRED-OPERATION-REF>
            </OPERATION-IREF>
            <TIMEOUT>1.0E-06</TIMEOUT>
        </SYNCHRONOUS-SERVER-CALL-POINT>
    </SERVER-CALL-POINTS>
  5. To simulate the component model, create a containing composition, system, or test harness model. In that containing model, insert reference implementations of the Dem GetEventFailed and GetEventStatus service operations.

    The AUTOSAR Basic Software block library provides a Diagnostic Service Component block, which provides reference implementations of Dem service operations. You can manually insert the block into a containing composition, system, or harness model, or automatically insert the block by creating a Simulink Test™ harness model.

    For more information, see Configure AUTOSAR Basic Software Service Implementations for Simulation and Simulate AUTOSAR Basic Software Services and Run-Time Environment.

See Also

| | | |

Related Examples

More About