Export AUTOSAR Architecture ECU Extract
You can export ECU extracts from compositions in an AUTOSAR classic architecture model. ECU extracts are an important input to AUTOSAR ECU configuration. In an AUTOSAR classic architecture, a top-level composition can model the software components mapped to one AUTOSAR ECU. To create a software description of the ECU-scoped system, you export an ECU extract from the composition.
Export AUTOSAR Architecture
In an open architecture model, you can export ARXML by using the Simulink® Toolstrip, the software architecture canvas, or the export
function. For example, from the Modeling tab, select Share > Generate Code and Export ARXML. In the Export Composition dialog box, select the option Export
ECU extract. To begin the export, click OK.
To generate the ECU extract, the software automatically maps the software components
in the composition to an ECU. If the composition contains nested compositions, the
software uses a flattened version of the composition hierarchy, containing only
components. For example, programmatically export an ECU extract for the AUTOSAR example
architecture model autosar_tpc_composition
, which contains a nested
composition by using the following commands.
% Open and export AUTOSAR architecture model, generating ECU extract archModel = "autosar_tpc_composition"; openExample(archModel); export(archModel,"ExportECUExtract",true);
ECU Extract File Generation
The export
function call generates the ECU extract into the file
System.arxml
, which is located in the composition folder. The ECU
extract for autosar_tpc_composition
maps components from both the
top-level composition and a nested Sensors
composition to one
ECU.
<SYSTEM UUID="..."> <SHORT-NAME>EcuExtract</SHORT-NAME> <CATEGORY>ECU_EXTRACT</CATEGORY> <MAPPINGS> <SYSTEM-MAPPING UUID="..."> <SHORT-NAME>SystemMapping</SHORT-NAME> <SW-MAPPINGS> <SWC-TO-ECU-MAPPING UUID="..."> <SHORT-NAME>SwcToEcuMapping</SHORT-NAME> <COMPONENT-IREFS> <COMPONENT-IREF> <TARGET-COMPONENT-REF DEST="SW-COMPONENT-PROTOTYPE"> /Components/TPC_Composition/Ctrl </TARGET-COMPONENT-REF> </COMPONENT-IREF> ... <COMPONENT-IREF> <TARGET-COMPONENT-REF DEST="SW-COMPONENT-PROTOTYPE"> /Components/TPC_Composition/PedalSensor </TARGET-COMPONENT-REF> </COMPONENT-IREF> </COMPONENT-IREFS> <ECU-INSTANCE-REF DEST="ECU-INSTANCE"> /System/EcuInstance </ECU-INSTANCE-REF> </SWC-TO-ECU-MAPPING> </SW-MAPPINGS> </SYSTEM-MAPPING> </MAPPINGS> <ROOT-SOFTWARE-COMPOSITIONS> <ROOT-SW-COMPOSITION-PROTOTYPE UUID="..."> <SHORT-NAME>RootSwCompositionPrototype</SHORT-NAME> <SOFTWARE-COMPOSITION-TREF DEST="COMPOSITION-SW-COMPONENT-TYPE"> /Components/TPC_Composition </SOFTWARE-COMPOSITION-TREF> </ROOT-SW-COMPOSITION-PROTOTYPE> </ROOT-SOFTWARE-COMPOSITIONS> </SYSTEM> <ECU-INSTANCE UUID="..."> <SHORT-NAME>EcuInstance</SHORT-NAME> </ECU-INSTANCE>
To specify the AUTOSAR package path for the system package that contains the ECU extract, use the composition XML option System Package. To view the System Package path value, from the Modeling tab, select Share > Configure XML Options.
Alternatively, configure the AUTOSAR system package path by using the AUTOSAR property
functions get
and set
.
openExample("autosar_tpc_composition"); arProps = autosar.api.getAUTOSARProperties("autosar_tpc_composition"); set(arProps,"XmlOptions","SystemPackage","/System"); systemPackage = get(arProps,"XmlOptions","SystemPackage");
For more information about the hierarchical AUTOSAR package structure, see Configure AUTOSAR Packages.