Add AUTOSAR Compositions and Components and Link Component Implementations
After you create an AUTOSAR architecture model, you begin authoring the top level of an AUTOSAR software design. Use the composition editor and the Simulink® Toolstrip Modeling tab to add and connect AUTOSAR compositions and components.
In the previous step, you opened a local working example folder and created an empty AUTOSAR architecture model. If necessary, repeat the step to open the working folder and create the empty model.
As you construct a throttle position control application, you can refer to example
autosar_tpc_composition, which shows the end
Add Compositions and Components to Architecture Canvas
Typically, an AUTOSAR composition contains a set of AUTOSAR components and compositions with a shared purpose. As part of constructing a throttle position control application, this tutorial places four sensor components in a sensors composition.
To add the sensors composition and its components to the AUTOSAR architecture model:
In the architecture model canvas, add a Software Composition block and name it Sensors. For example, on the Modeling tab, select Software Composition and insert a Software Composition block in the canvas. In the highlighted name field, enter
To populate a composition, you open the Software Composition block and add Software Component blocks.
Open the Sensors block so that the model canvas shows the composition content. Inside the composition, add AUTOSAR software components named TPS_Primary, TPS_Secondary, Monitor, and PedalSensor. For example, on the Modeling tab, you can select Software Component to create each one.
Next, you add require and provide ports to the components, and then connect the component ports to other component blocks or to composition root ports. To add component require and provide ports, this tutorial links Software Component blocks to implementation models in which the ports are already defined.
Define Component Behavior by Linking Implementation Models
The behavior of an AUTOSAR application is defined by its AUTOSAR software components. After you insert Software Component blocks in an AUTOSAR architecture model, you can add Simulink behavior to the components. For each Software Component block, you can:
Create a model based on the block interface.
Link to an implementation model.
Create a model from an AUTOSAR XML (ARXML) component description.
For convenience, this tutorial provides a Simulink implementation model for each AUTOSAR component:
autosar_tpc_throttle_sensor1.slxfor component TPS_Primary
autosar_tpc_throttle_sensor2.slxfor component TPS_Secondary
autosar_tpc_throttle_sensor_monitor.slxfor component Monitor
autosar_tpc_pedal_sensor.slxfor component PedalSensor
To add Simulink behavior to the components:
In the architecture model, open the Sensors composition block if it is not already open. Inside the composition, link each AUTOSAR sensor component to a Simulink model that implements its behavior.
For example, select the TPS_Primary component block, place your cursor over the displayed ellipsis, and select the cue Link to Model.
In the Link to Model dialog box, browse to the implementation model
To link the component to the implementation model, click OK.
Link components TPS_Secondary, Monitor, and PedalSensor to their implementation models. After you link each model, you can resize the associated component block to better display the component ports.
Linking a Software Component block to a specified implementation model updates the block and model interfaces to match. If you link to a model that uses root Inport and Outport blocks, the software converts the model signal ports to bus ports. To view the model content, open the Software Component block.
Connect the components to each other and to composition root ports.
To interconnect components, drag a line from a component provider port to another component receiver port.
To connect components to Sensors composition root ports, drag from a component port to the Sensors composition boundary.
Optionally, to exactly match the root port naming in example model
autosar_tpc_composition, rename ports
Complete Architecture Model Top Level
To complete the throttle position control application:
Return to the top level of the architecture model. Add two Software Component blocks and name them Ctrl and Actuator.
Link the AUTOSAR components Ctrl and Actuator to their Simulink implementation models,
Connect the Sensors composition, Ctrl component, and Actuator component to each other and to the architecture model boundary.
To check for interface or data type issues, update the architecture model. On the Modeling tab, select Update Model. If any issues are found, compare your model with example model
Save the model with a unique name, such as
Next, simulate the behavior of the aggregated components in the AUTOSAR architecture model.