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
. In
autosar_swc_fcncalls
, asynchronous function-call
subsystem SS1 models an AUTOSAR runnable. An
ExternalTriggerOccurredEvent
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.
Expand Trigger Interfaces 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, click the help button in the triggers view.
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 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.
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.