Add AUTOSAR Adaptive Software Compositions and Components
R2026bAfter 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");Add a
SensorsSoftware Composition block to the architecture model. Within the composition, add two Adaptive Component blocks namedLeftDataandRightDatato 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");
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");
Add sender ports to the
Sensorscomposition so that internal sensor components can communicate with other top-level components. Add aBrakeCmdsender 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 theSensorsSoftware Composition block by using theconnectfunction.ports = addPort(sensors,"Sender",{'LeftSensor','RightSensor'}); addPort(arch,"Sender","BrakeCmd"); connect(sensors,leftPort,ports(1)); connect(sensors,rightPort,ports(2));
Add behavior to each Adaptive Component block by using the
linkToModelfunction 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. TheSensorsSoftware Composition block uses multi-instantiation by reusing the software component modeladaptive_SensorSWCto 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");
Signal lines between component models represent AUTOSAR assembly connectors. Add signal lines representing AUTOSAR assembly connectors between software components by using the
connectfunction.connect(arch,sensors,controller); connect(arch,controller,actuator); connect(arch,speedometer,actuator); connect(arch,actuator,[]); layout(arch)

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
autosar.arch.Model|autosar.arch.Composition|autosar.arch.Component|autosar.arch.CompPort|autosar.arch.Connector