Deploy AUTOSAR Adaptive Architecture Model
This example shows how to deploy a Simulink® System Composer™ (architecture) model as an AUTOSAR adaptive application using Embedded Coder® Support Package for Linux Applications. This example demonstrates adaptive communication using events and methods.
The architecture model used in this example has three components, OutdoorLightSensor
, HeadLightController
, and HeadLightActuator
. OutdoorLightSensor
processes the data received from sensor and sends the data to HeadLightController
by using adaptive events. HeadLightController
calls the method from HeadLightActuator
to turn on or off the headlight using adaptive methods. HeadLightActuator
turns the car head light on or off based on the input received from HeadLightController
.
You can use the Embedded Coder Support Package for Linux Applications to generate the code, create executables from the architecture model, perform external mode simulation of an AUTOSAR adaptive model and run and stop the application on the target environment. The OutdoorLightSensor
component in the architecture model used in this example is configured for external mode. The configuration parameter Hardware Board in the Hardware Implementation section is set to Embedded Coder Linux Docker Container
for the architecture model and its component models. For more information about external mode simulation, see External Mode Simulation of Deployed Applications.
Build and Deploy the Application
Open the
HeadLightControlSystem
model.
open_system("HeadLightControlSystem");
Warning: Unrecognized function or variable 'CloneDetectionUI.internal.CloneDetectionPerspective.register'.
Open the Linux Runtime Manager app by clicking Apps > Linux Runtime Manager from the model toolstrip.
Connect to a target computer. For more information on setting up the target computer, see Setup Linux Target Computer.
Deploy the
HeadLightControlSystem
model to the target by clicking Linux Target > Prepare > Create & Deploy Application Package and selecting the model. For more information, see Build Simulink Model and Deploy Application.
After the model is built and the adaptive application is successfully deployed on the target, you can see the deployed application including the executables in the Targets Tree.
Launch and Calibrate the Application
Select the
OutdoorLightSensor
executable in the Targets Tree and click Linux Target > Calibrate > Monitor & Tune to start the external mode simulation of theOutdoorLightSensor
executable.Select the
HeadLightControlSystem
in the Targets Tree and click Linux Target > Run On Target > Start Application to launch the remaining executables of the adaptive application on the target.
Now all the three executables are running on the target and you can see Head light status: 1 in the Log Viewer section of the Linux Runtime Manager app indicating that the headlights are on.
On the
OutdoorLightSensor
model, rotate the knob to a value greater than 5. You can see the messageHead light status: 0
indicating that the headlights are turned off.Rotate the knob back to a value less than 5. You can see the message
Head light status: 1
indicating that the headlights are turned on.Stop the application by clicking Linux Target > Run On Target > Stop Application.
Video Walkthrough
For a walkthrough of the example, play the video.