Main Content

Configure Receiver for AUTOSAR External Trigger Event Communication

The AUTOSAR standard defines external trigger event communication, in which an AUTOSAR software component or service signals an external trigger occurred event (ExternalTriggerOccurredEvent) to another component. The receiving component activates a runnable in response to the event.

In Simulink®, you can model the receiver portion of AUTOSAR external trigger event communication. Select a component that you want to react to an external trigger. In the component, you create a trigger interface, a trigger receiver port to receive an ExternalTriggerOccurredEvent, and a runnable that the event activates.

This example shows how to configure an AUTOSAR software component as a receiver for external trigger event communication.

  1. Open a model configured for AUTOSAR code generation, in which you want to activate a runnable based on receiving an AUTOSAR ExternalTriggerOccurredEvent.

    For a sample model that uses external trigger event communication, see autosar_swc_fcncalls. In autosar_swc_fcncalls, asynchronous function-call subsystem SS1 models an AUTOSAR runnable, Runnable_Trigger. An ExternalTriggerOccurredEvent activates the runnable.

    Subsystem Runnable_trigger.

  2. Open the AUTOSAR Dictionary. Select the Trigger Interfaces view and use the Add button to add a trigger interface to the model.

    Trigger Interfaces view of AUTOSAR Dictionary.

  3. In the Add Interfaces dialog box, specify the name of the new interface and set Number of Triggers to 1. Select Add.

    Add Interfaces dialog box.

  4. Expand the Trigger Interfaces view, then expand the new trigger interface you just created, and select the Triggers view. Examine the properties of the associated trigger. For an asynchronous (nonperiodic) trigger, set CseCode to None, indicating an unspecified trigger period. For more information about specifying trigger periods see, Trigger Interfaces.

    Triggers view in AUTOSAR Dictionary.

  5. Expand AtomicComponents and expand the component. Select the TriggerReceiverPorts view and use the Add button to add a trigger receiver port to the model.

    Trigger Receiver Ports view in AUTOSAR Dictionary.

  6. In the Add Ports dialog box, specify the name of the new port and set Interface to the name of the trigger interface you created. Select Add.

    Add ports dialog box.

  7. Select the Runnables view and select the runnable that you want to activate based on receiving an AUTOSAR ExternalTriggerOccurredEvent. In the Events subpane, set Event Type to ExternalTriggerOccurredEvent. To display event properties, select the event name. For Trigger, select the value corresponding to the trigger receiver port and trigger you created. Select Apply.

    Runnables events view in AUTOSAR Dictionary.

  8. To complete the trigger receiver configuration, open the Code Mappings editor and select the Functions tab. Select the Simulink entry-point function for the subsystem that models the AUTOSAR ExternalTriggerOccurredEvent runnable. In the Runnable field, select the runnable name.

    Functions tab of Code Mappings Editor expanded with Runnable_Trigger selected.

Related Examples

More About