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.
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
. Inautosar_swc_fcncalls
, asynchronous function-call subsystemSS1
models an AUTOSAR runnable,Runnable_Trigger
. AnExternalTriggerOccurredEvent
activates the runnable.Open the AUTOSAR Dictionary. Select the Trigger Interfaces view and use the Add button to add a trigger interface to the model.
In the Add Interfaces dialog box, specify the name of the new interface and set Number of Triggers to
1
. Select Add.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.Expand AtomicComponents and expand the component. Select the TriggerReceiverPorts view and use the Add button to add a trigger receiver port to the model.
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.
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 toExternalTriggerOccurredEvent
. 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.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.
Related Examples
- Add Top-Level Asynchronous Trigger to Periodic Rate-Based System
- Import AUTOSAR XML Descriptions Into Simulink
- Configure AUTOSAR Code Generation