Main Content

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");

  • For the architecture model and the component models, set Hardware Implementation > Hardware board to Embedded Coder Linux Docker Container for x86_64 targets and Embedded Coder Linux Docker Container - ARM64 for ARM targets.

  • Set Code Generation > Build process > Toolchain to AUTOSAR Adaptive Linux Executable.

  • For OutdoorLightSensor component, in the Code Generation > Interface > Data exchange interface, select External mode to enable external mode for the component.

  • 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 the OutdoorLightSensor 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 message Head 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.

This video will walk you through the modeling and deployment of AUTOSAR Adaptive Architecture Application using Embedded Coder support package for Linux applications. In this video, we will cover development of service components, configuring the AUTOSAR Adaptive model, deploying the AUTOSAR Adaptive model, calibrating the deployed application.

I want to design an AUTOSAR application which is headlight control system application, where the headlights of a vehicle should turn off when the outside light is high and the headlights of the vehicle should turn on when the outside light is low.

This is AUTOSAR adaptive architecture model for headlight control system. This model has three components. From the left side, the first model is sensor model. Second model is controller model. The third model is actuator model. Two models on the left side communicate with each other using adaptive events. Two models on the right side communicate with each other using adaptive methods.

First model outputs the outdoor light sensor data. Second model receives the outdoor light sensor data. It causes the method from the third model to turn on or turn off the headlight. The sensor model is configured for external mode to tune the outdoor light sensor data in runtime.

This is an outdoor light sensor component. Sensor data is modeled using tunable parameter outdoor light data. It has a knob block to tune the value of sensor data during external mode simulation.

This is headlight controller component. This receives the outside light sensor data when the event is triggered. It causes the method from the third model to turn on or turn off the headlight.

This is headlight actuator component. Setting the headlight status service is modeled using Simulink function. Headlight status value is logged using ara log block.

I am opening the configuration parameters of outdoor light sensor component to enable the external mode and setting the IP address of target machine and port number in XCP server configuration. In order to deploy this architecture model on Linux target, I am opening the configuration parameters of this architecture model to set the hardware board value to Embedded Coder Linux Docker Container.

After setting the hardware board, I am opening Linux runtime manager from Apps gallery. I am entering the IP address, username and password of the Linux target machine in target configuration settings and connecting to the target. Now the target is connected.

Now I am clicking on the Create and deploy application package button and selecting the architecture model to deploy it on the target. Now we can see that the application is deployed. I am selecting the outdoor light sensor component and clicking on Monitor and tune button to start external mode simulation. Now the external mode simulation has been started.

Now to start all other components, I am selecting the headlight control system and clicking on Start application button. Now all three components are running on target. In log viewer we can see that the headlights are turned on. Now I'll tune the value of outdoor light data to a value greater than 5, and we can see that the lights are turned off in the log viewer. If I change the value of outdoor light data to a value less than 5, in the log viewer, we can see that the lights are turned on again.

In summary, we have an AUTOSAR Adaptive Architecture Model which has three components. We deployed it on Linux target using Linux runtime manager, which created three executables, one for each component. The executables communicate with each other using ara com. We performed external mode simulation of outdoor light sensor component to tune the parameter values in runtime.

For more information, go to the documentation of Embedded Coder Support Package for Linux applications.

Video Player is loading.
Current Time 0:00
Duration 4:45
Loaded: 0%
Stream Type LIVE
Remaining Time 4:45
 
1x
  • Chapters
  • descriptions off, selected
  • captions off, selected
  • en (Main), selected

    See Also

    Topics