Event Communication Between AUTOSAR Adaptive Applications Using Message Triggering
This example shows how to deploy two AUTOSAR adaptive applications that use events to communicate with each other in message triggering mode.
AUTOSAR Blockset supports Polling mode and event-driven approach to access data.
Event-driven approach is used when an application expects data and response at a trigger of some event or action. Event does not trigger at regular intervals. Event-driven approach provides reaction to a service method faster, but the rate of context switches might be high and non-deterministic. Event-driven approach is more used where there is no real-time requirements. In Simulink we can model event-driven behaviour with Export Function style only.
The sender application transmits the data of a sine wave periodically based on the sample time. The receiver application checks the message availability from the other application when ever the message triggering is invoked and receives messages when they are available.
Open the Models
This example uses the
adaptive_msg_event_driven_receiver AUTOSAR Adaptive models.
adaptive_msg_sender model sends the data of a sine wave and uses arn are log block to log the data using ara::log messages.
adaptive_msg_event_driven_receiver model receives the data of a sine wave and uses an ara log block to log the received data using ara::log messages.
Deploy the Models
Open the Linux Runtime Manager application by clicking Apps > Linux Runtime Manager from the model toolstrip.
Connect to a Linux target computer by following instructions in Setup Linux Target Computer (Embedded Coder).
Deploy both the models on Linux target computer by following instructions in Build Simulink Model and Deploy Application (Embedded Coder).
After you deploy the applications, the Linux Runtime Manager app displays them in the Targets Tree pane.
adaptive_msg_senderapplication and click Linux Target > Run On Target > Start Application to launch the application on the target.
adaptive_msg_event_driven_receiverapplication and click Linux Target > Run On Target > Start Application to launch the application on the target.
The app displays ara::log messages that the deployed applications generate in the Log Viewer pane, which indicates that the applications are communicating.
To stop the
adaptive_msg_senderapplication, select it and click Linux Target > Run On Target > Stop Application.
To stop the
adaptive_msg_event_driven_receiverapplication, select it and click Linux Target > Run On Target > Stop Application.
deployApplicationPackage (Embedded Coder)