Main Content

export

Export AUTOSAR architecture model ARXML, ASAP2 file, and generate component code

Since R2020a

Description

example

export(archCCM) exports ARXML descriptions from AUTOSAR component, composition, or architecture model archCCM. The function also generates code for Simulink® implementation models linked by AUTOSAR components within the export scope and exports ASAP2 file for the component models. The containing architecture model must be open or loaded. The archCCM argument is a component, composition, or architecture model handle returned by a previous call to addComponent, addComposition, autosar.arch.createModel, or autosar.arch.loadModel.

example

export(archCCM,Name,Value) specifies additional export options with one or more Name,Value pair arguments. For example, you can specify a ZIP file in which generated files are packaged.

Examples

collapse all

Export composition XML descriptions and generate component code for an AUTOSAR architecture model.

Load AUTOSAR architecture model

modelName = 'autosar_tpc_composition';
archModel = autosar.arch.loadModel(modelName);

Export composition XML descriptions and generate component code

export(archModel);
Building component: autosar_tpc_actuator (1 out of 6)
### Starting build procedure for: autosar_tpc_actuator
### Generating XML files description for: autosar_tpc_actuator
### Successful completion of code generation for: autosar_tpc_actuator

Build Summary

Top model targets built:

Model                 Action           Rebuild Reason                                    
=========================================================================================
autosar_tpc_actuator  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 22.413s
Building component: autosar_tpc_controller (2 out of 6)
### Starting build procedure for: autosar_tpc_controller
### Generating XML files description for: autosar_tpc_controller
### Successful completion of code generation for: autosar_tpc_controller

Build Summary

Top model targets built:

Model                   Action           Rebuild Reason                                    
===========================================================================================
autosar_tpc_controller  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 11.988s
Building component: autosar_tpc_throttle_sensor_monitor (3 out of 6)
### Starting build procedure for: autosar_tpc_throttle_sensor_monitor
### Generating XML files description for: autosar_tpc_throttle_sensor_monitor
### Successful completion of code generation for: autosar_tpc_throttle_sensor_monitor

Build Summary

Top model targets built:

Model                                Action           Rebuild Reason                                    
========================================================================================================
autosar_tpc_throttle_sensor_monitor  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 14.078s
Building component: autosar_tpc_pedal_sensor (4 out of 6)
### Starting build procedure for: autosar_tpc_pedal_sensor
### Generating XML files description for: autosar_tpc_pedal_sensor
### Successful completion of code generation for: autosar_tpc_pedal_sensor

Build Summary

Top model targets built:

Model                     Action           Rebuild Reason                                    
=============================================================================================
autosar_tpc_pedal_sensor  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 11.369s
Building component: autosar_tpc_throttle_sensor1 (5 out of 6)
### Starting build procedure for: autosar_tpc_throttle_sensor1
### Generating XML files description for: autosar_tpc_throttle_sensor1
### Successful completion of code generation for: autosar_tpc_throttle_sensor1

Build Summary

Top model targets built:

Model                         Action           Rebuild Reason                                    
=================================================================================================
autosar_tpc_throttle_sensor1  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 15.942s
Building component: autosar_tpc_throttle_sensor2 (6 out of 6)
### Starting build procedure for: autosar_tpc_throttle_sensor2
### Generating XML files description for: autosar_tpc_throttle_sensor2
### Successful completion of code generation for: autosar_tpc_throttle_sensor2

Build Summary

Top model targets built:

Model                         Action           Rebuild Reason                                    
=================================================================================================
autosar_tpc_throttle_sensor2  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 11.546s
Exporting composition: autosar_tpc_composition
### Generating XML description files for: autosar_tpc_composition
### Successful completion of export for: autosar_tpc_composition

Export XML descriptions and generate component code for a composition nested in an AUTOSAR architecture model.

Load AUTOSAR architecture model

modelName = 'autosar_tpc_composition';
archModel = autosar.arch.loadModel(modelName);

Export nested Sensors composition

export(archModel.Compositions(1));
Building component: autosar_tpc_throttle_sensor_monitor (1 out of 4)
### Starting build procedure for: autosar_tpc_throttle_sensor_monitor
### Generating XML files description for: autosar_tpc_throttle_sensor_monitor
### Successful completion of code generation for: autosar_tpc_throttle_sensor_monitor

Build Summary

Top model targets built:

Model                                Action           Rebuild Reason                                    
========================================================================================================
autosar_tpc_throttle_sensor_monitor  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 12.803s
Building component: autosar_tpc_pedal_sensor (2 out of 4)
### Starting build procedure for: autosar_tpc_pedal_sensor
### Generating XML files description for: autosar_tpc_pedal_sensor
### Successful completion of code generation for: autosar_tpc_pedal_sensor

Build Summary

Top model targets built:

Model                     Action           Rebuild Reason                                    
=============================================================================================
autosar_tpc_pedal_sensor  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 9.9795s
Building component: autosar_tpc_throttle_sensor1 (3 out of 4)
### Starting build procedure for: autosar_tpc_throttle_sensor1
### Generating XML files description for: autosar_tpc_throttle_sensor1
### Successful completion of code generation for: autosar_tpc_throttle_sensor1

Build Summary

Top model targets built:

Model                         Action           Rebuild Reason                                    
=================================================================================================
autosar_tpc_throttle_sensor1  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 13.029s
Building component: autosar_tpc_throttle_sensor2 (4 out of 4)
### Starting build procedure for: autosar_tpc_throttle_sensor2
### Generating XML files description for: autosar_tpc_throttle_sensor2
### Successful completion of code generation for: autosar_tpc_throttle_sensor2

Build Summary

Top model targets built:

Model                         Action           Rebuild Reason                                    
=================================================================================================
autosar_tpc_throttle_sensor2  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 10.649s
Exporting composition: autosar_tpc_composition/Sensors
### Generating XML description files for: autosar_tpc_composition/Sensors
### Successful completion of export for: autosar_tpc_composition/Sensors

Export XML descriptions and generate component code for an AUTOSAR architecture model. In the PackageCodeAndArxml value argument, specify the name of a ZIP file in which to package the generated files.

Load AUTOSAR architecture model

modelName = 'autosar_tpc_composition';
archModel = autosar.arch.loadModel(modelName);

Export ARXML descriptions and code into ZIP file

export(archModel,'PackageCodeAndARXML','myArchModel.zip');
Building component: autosar_tpc_actuator (1 out of 6)
### Starting build procedure for: autosar_tpc_actuator
### Generating XML files description for: autosar_tpc_actuator
### Successful completion of code generation for: autosar_tpc_actuator

Build Summary

Top model targets built:

Model                 Action           Rebuild Reason                                    
=========================================================================================
autosar_tpc_actuator  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 9.9383s
Building component: autosar_tpc_controller (2 out of 6)
### Starting build procedure for: autosar_tpc_controller
### Generating XML files description for: autosar_tpc_controller
### Successful completion of code generation for: autosar_tpc_controller

Build Summary

Top model targets built:

Model                   Action           Rebuild Reason                                    
===========================================================================================
autosar_tpc_controller  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 11.191s
Building component: autosar_tpc_throttle_sensor_monitor (3 out of 6)
### Starting build procedure for: autosar_tpc_throttle_sensor_monitor
### Generating XML files description for: autosar_tpc_throttle_sensor_monitor
### Successful completion of code generation for: autosar_tpc_throttle_sensor_monitor

Build Summary

Top model targets built:

Model                                Action           Rebuild Reason                                    
========================================================================================================
autosar_tpc_throttle_sensor_monitor  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 11.913s
Building component: autosar_tpc_pedal_sensor (4 out of 6)
### Starting build procedure for: autosar_tpc_pedal_sensor
### Generating XML files description for: autosar_tpc_pedal_sensor
### Successful completion of code generation for: autosar_tpc_pedal_sensor

Build Summary

Top model targets built:

Model                     Action           Rebuild Reason                                    
=============================================================================================
autosar_tpc_pedal_sensor  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 10.091s
Building component: autosar_tpc_throttle_sensor1 (5 out of 6)
### Starting build procedure for: autosar_tpc_throttle_sensor1
### Generating XML files description for: autosar_tpc_throttle_sensor1
### Successful completion of code generation for: autosar_tpc_throttle_sensor1

Build Summary

Top model targets built:

Model                         Action           Rebuild Reason                                    
=================================================================================================
autosar_tpc_throttle_sensor1  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 11.54s
Building component: autosar_tpc_throttle_sensor2 (6 out of 6)
### Starting build procedure for: autosar_tpc_throttle_sensor2
### Generating XML files description for: autosar_tpc_throttle_sensor2
### Successful completion of code generation for: autosar_tpc_throttle_sensor2

Build Summary

Top model targets built:

Model                         Action           Rebuild Reason                                    
=================================================================================================
autosar_tpc_throttle_sensor2  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 14.144s
Exporting composition: autosar_tpc_composition
### Generating XML description files for: autosar_tpc_composition
### Successful completion of export for: autosar_tpc_composition

Export composition XML descriptions and generate component code for an AUTOSAR architecture model. As part of composition XML export, generate an ECU extract into the file System.arxml, which is located in the composition folder. The ECU extract for example model autosar_tpc_composition maps software components from both the top-level composition and a nested Sensors composition to one ECU.

Load AUTOSAR architecture model

modelName = 'autosar_tpc_composition';
archModel = autosar.arch.loadModel(modelName);

Export ECU extract into composition folder

export(archModel,'ExportECUExtract',true);
Building component: autosar_tpc_actuator (1 out of 6)
### Starting build procedure for: autosar_tpc_actuator
### Generating XML files description for: autosar_tpc_actuator
### Successful completion of code generation for: autosar_tpc_actuator

Build Summary

Top model targets built:

Model                 Action           Rebuild Reason                                    
=========================================================================================
autosar_tpc_actuator  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 11.051s
Building component: autosar_tpc_controller (2 out of 6)
### Starting build procedure for: autosar_tpc_controller
### Generating XML files description for: autosar_tpc_controller
### Successful completion of code generation for: autosar_tpc_controller

Build Summary

Top model targets built:

Model                   Action           Rebuild Reason                                    
===========================================================================================
autosar_tpc_controller  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 11.973s
Building component: autosar_tpc_throttle_sensor_monitor (3 out of 6)
### Starting build procedure for: autosar_tpc_throttle_sensor_monitor
### Generating XML files description for: autosar_tpc_throttle_sensor_monitor
### Successful completion of code generation for: autosar_tpc_throttle_sensor_monitor

Build Summary

Top model targets built:

Model                                Action           Rebuild Reason                                    
========================================================================================================
autosar_tpc_throttle_sensor_monitor  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 11.2s
Building component: autosar_tpc_pedal_sensor (4 out of 6)
### Starting build procedure for: autosar_tpc_pedal_sensor
### Generating XML files description for: autosar_tpc_pedal_sensor
### Successful completion of code generation for: autosar_tpc_pedal_sensor

Build Summary

Top model targets built:

Model                     Action           Rebuild Reason                                    
=============================================================================================
autosar_tpc_pedal_sensor  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 9.6256s
Building component: autosar_tpc_throttle_sensor1 (5 out of 6)
### Starting build procedure for: autosar_tpc_throttle_sensor1
### Generating XML files description for: autosar_tpc_throttle_sensor1
### Successful completion of code generation for: autosar_tpc_throttle_sensor1

Build Summary

Top model targets built:

Model                         Action           Rebuild Reason                                    
=================================================================================================
autosar_tpc_throttle_sensor1  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 9.9486s
Building component: autosar_tpc_throttle_sensor2 (6 out of 6)
### Starting build procedure for: autosar_tpc_throttle_sensor2
### Generating XML files description for: autosar_tpc_throttle_sensor2
### Successful completion of code generation for: autosar_tpc_throttle_sensor2

Build Summary

Top model targets built:

Model                         Action           Rebuild Reason                                    
=================================================================================================
autosar_tpc_throttle_sensor2  Code generated.  Code generation information file does not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 9.7187s
Exporting composition: autosar_tpc_composition
### Generating XML description files for: autosar_tpc_composition
### Successful completion of export for: autosar_tpc_composition

Export composition XML descriptions and generate component code for or an AUTOSAR architecture model. As part of composition XML export, export ASAP2 file for the referenced component models and save them in a folder with name asap2.

open_system('autosar_tpc_composition');
autosar.api.export(hModel,'ExportASAP2File',true);

Input Arguments

collapse all

AUTOSAR component, composition, or architecture model for which to export ARXML descriptions and generate component code. The argument is a component, composition, or architecture model handle returned by a previous call to addComponent, addComposition, autosar.arch.createModel, or autosar.arch.loadModel.

Example: archModel

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'PackageCodeAndARXML','SensorsComposition.zip' specifies the name of a ZIP file that packages the generated files.

As part of XML export, generate an ECU extract into the file System.arxml, which is located in the composition folder. The ECU extract for a classic composition or architecture model maps software components from the top composition and any nested compositions to one ECU. For more information, see Export Composition ECU Extract.

Example: 'ExportECUExtract',true

Full path to a folder in which to place exported ARXML description files.

Example: 'ExportedARXMLFolder','C:\temp\arxml'

Enable code generation of client-server connectors that describe the calls between function callers and global Simulink functions across components in an AUTOSAR architecture model.

Example: 'ExportUnmodeledClientServerConnectors', true

Data Types: logical

Name of a ZIP file in which to package the generated files, including generated code and exported ARXML descriptions.

Example: 'PackageCodeAndARXML','SensorsComposition.zip'

Export ASAP2 file while exporting the ARXML and generating component code. The exported ASAP2 file is packed into a folder named asap2. For more information, see Generate and Pack ASAP2 File.

Note

This Name-value argument is not supported on macOS platform.

Example: 'ExportASAP2File',true

Version History

Introduced in R2020a

expand all