Main Content

Add AUTOSAR Adaptive Software Compositions and Components

R2026b

After you create an AUTOSAR software architecture model, you use the composition editor and the Simulink® Toolstrip Modeling tab to add and connect AUTOSAR compositions and components. Open a working folder containing the supporting files required for this example by entering this command in your MATLAB® Command Window:

openExample("autosarblockset/AuthorAUTOSARBrakeControlExample");

  1. Add a Sensors Software Composition block to the architecture model. Within the composition, add two Adaptive Component blocks named LeftData and RightData to represent individual sensor software components.

    sensors = addComposition(arch,"Sensors");
    leftSensorSWC = addComponent(sensors,"LeftData",Kind="AdaptiveApplication");
    rightSensorSWC = addComponent(sensors,"RightData",Kind="AdaptiveApplication");
    leftPort = addPort(leftSensorSWC,"Sender","Sensor");
    rightPort = addPort(rightSensorSWC,"Sender","Sensor");
  2. Add Adaptive Component blocks at the top level of the architecture for the actuator, controller, and speedometer.

    actuator = addComponent(arch,"Actuator",Kind="AdaptiveApplication");
    controller = addComponent(arch,"Controller",Kind="AdaptiveApplication");
    speedometer = addComponent(arch,"Speedometer",Kind="AdaptiveApplication");
  3. Add sender ports to the Sensors composition so that internal sensor components can communicate with other top-level components. Add a BrakeCmd sender port to the boundary of the software architecture. Signal lines between software component models and data ports exiting or entering the parent composition represent AUTOSAR delegation connectors. Add signal lines representing AUTOSAR delegation connectors inside the Sensors Software Composition block by using the connect function.

    ports = addPort(sensors,"Sender",{'LeftSensor','RightSensor'});
    addPort(arch,"Sender","BrakeCmd");
    connect(sensors,leftPort,ports(1));
    connect(sensors,rightPort,ports(2));
  4. Add behavior to each Adaptive Component block by using the linkToModel function to link each block to an existing software component model. The software component models used in this architecture have already been created for this example. The Sensors Software Composition block uses multi-instantiation by reusing the software component model adaptive_SensorSWC to handle inputs from multiple sensors.

    linkToModel(leftSensorSWC,"adaptive_SensorSWC");
    linkToModel(rightSensorSWC,"adaptive_SensorSWC");
    linkToModel(actuator,"adaptive_ActuatorSWC");
    linkToModel(controller,"adaptive_ControllerSWC");
    linkToModel(speedometer,"adaptive_SpeedometerSWC");
  5. Signal lines between component models represent AUTOSAR assembly connectors. Add signal lines representing AUTOSAR assembly connectors between software components by using the connect function.

    connect(arch,sensors,controller);
    connect(arch,controller,actuator);
    connect(arch,speedometer,actuator);
    connect(arch,actuator,[]);
    layout(arch)

AUTOSAR Adaptive software architecture model showing Sensors composition, Controller, Actuator, and Speedometer components with connected ports

Next, configure the port interfaces by using interface objects defined in the Architectural Data section of a linked Simulink data dictionary.

See Also

Blocks

Objects

Functions

Topics