Confidential Prerelease Documentation — Subject to Nondisclosure Agreement
Create Simulink® representation of AUTOSAR composition imported from AUTOSAR authoring tool arxml
file
arxml
File to SimulinkHere is an AUTOSAR software composition that implements a throttle position control system. The composition contains six interconnected AUTOSAR software component prototypes -- four sensor/actuator components and two application components.
The composition was created in an AUTOSAR authoring tool and exported to the file ThrottlePositionControlComposition.arxml
. (You can access the arxml
files used in this example in the installed AUTOSAR support package tree, at autosarroot/autosar_examples/ThrottlePositionControlSystem/arxml
.)
Use the MATLAB function createCompositionAsModel
to import the arxml
description and create an initial Simulink representation of the AUTOSAR composition.
addpath(fullfile(autosarroot,'autosar_examples','ThrottlePositionControlSystem','arxml')); ar = arxml.importer('ThrottlePositionControlComposition.arxml'); createCompositionAsModel(ar,'/Company/Components/ThrottlePositionControlComposition');
Creating model 'ThrottlePositionSensor' for component 1 of 5: /Company/Components/ThrottlePositionSensor Creating model 'ThrottlePositionMonitor' for component 2 of 5: /Company/Components/ThrottlePositionMonitor Creating model 'Controller' for component 3 of 5: /Company/Components/Controller Creating model 'AccelerationPedalPositionSensor' for component 4 of 5: /Company/Components/AccelerationPedalPositionSensor Creating model 'ThrottlePositionActuator' for component 5 of 5: /Company/Components/ThrottlePositionActuator Creating model 'ThrottlePositionControlComposition' for composition 1 of 1: /Company/Components/ThrottlePositionControlComposition
The function call creates a composition model that contains six component models, one for each atomic software component in the composition. Simulink inports and outports represent AUTOSAR ports and signal lines represent AUTOSAR component connectors.
After creating an initial Simulink representation of the AUTOSAR composition, you develop each component in the composition. For each component, you refine the AUTOSAR configuration and create algorithmic model content.
For example, the Controller
component model in the ThrottlePositionControlComposition
composition model contains an atomic susbsystem Runnable_Step_sys
, which represents an AUTOSAR periodic runnable. The Runnable_Step_sys
subsystem contains the initial stub implementation of the controller behavior.
Here is a possible implementation of the throttle position controller behavior. The controller component takes input values from an accelerator pedal position (APP) sensor and a throttle position sensor (TPS). The controller translates the values into input values for a throttle actuator. (To explore this implementation, open model Controller.slx
at autosarroot/autosar_examples/ThrottlePositionControlSystem
.)
As you develop AUTOSAR components, you can:
Simulate component models individually or together in a containing composition.
Generate arxml
component description files and algorithmic C code for testing in Simulink or integration into the AUTOSAR Runtime Environment (RTE).
For more information on developing, simulating, and building AUTOSAR components, see example Design AUTOSAR Components, Simulate, and Generate Code.
Suppose that, after you imported the AUTOSAR software composition into Simulink and began developing algorithms, architectural changes were made to the composition in the AUTOSAR authoring tool.
Here is the revised composition. The changes delete a sensor component, add a logger component, and add ports and connections at the composition and component levels. In the AUTOSAR authoring tool, the revised composition is exported to the file ThrottlePositionControlComposition_updated.arxml
.
Use the MATLAB function updateModel
to import the architectural revisions from the arxml
file. The function updates the AUTOSAR composition model with the changes and reports the results.
ar2 = arxml.importer('ThrottlePositionControlComposition_updated.arxml'); updateModel(ar2,'ThrottlePositionControlComposition');
Updating model 'ThrottlePositionSensor' for component 1 of 6: /Company/Components/ThrottlePositionSensor ### Updating model ThrottlePositionSensor ### Saving original model as ThrottlePositionSensor_backup.slx ### Creating HTML report ThrottlePositionSensor_update_report.html Updating model 'ThrottlePositionMonitor' for component 2 of 6: /Company/Components/ThrottlePositionMonitor ### Updating model ThrottlePositionMonitor ### Saving original model as ThrottlePositionMonitor_backup.slx ### Creating HTML report ThrottlePositionMonitor_update_report.html Creating model 'Logger' for component 3 of 6: /Company/Components/Logger Updating model 'Controller' for component 4 of 6: /Company/Components/Controller ### Updating model Controller ### Saving original model as Controller_backup.slx ### Creating HTML report Controller_update_report.html Updating model 'AccelerationPedalPositionSensor' for component 5 of 6: /Company/Components/AccelerationPedalPositionSensor ### Updating model AccelerationPedalPositionSensor ### Saving original model as AccelerationPedalPositionSensor_backup.slx ### Creating HTML report AccelerationPedalPositionSensor_update_report.html Updating model 'ThrottlePositionActuator' for component 6 of 6: /Company/Components/ThrottlePositionActuator ### Updating model ThrottlePositionActuator ### Saving original model as ThrottlePositionActuator_backup.slx ### Creating HTML report ThrottlePositionActuator_update_report.html Updating model 'ThrottlePositionControlComposition' for composition 1 of 1: /Company/Components/ThrottlePositionControlComposition ### Updating model ThrottlePositionControlComposition ### Saving original model as ThrottlePositionControlComposition_backup.slx ### Creating HTML report ThrottlePositionControlComposition_update_report.html
After the update, in the composition model, highlighting indicates where changes occurred.
The function also generates and displays an HTML AUTOSAR update report. The report lists changes that the update made to Simulink and AUTOSAR elements in the composition model. In the report, you can click hyperlinks to navigate from change descriptions to model changes, and to navigate from the main report to individual component reports.