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 18.708s
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 12.506s
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 13.264s
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.386s
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 13.404s
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.835s
Exporting dictionary: tpc_interfaces.sldd (1 out of 1)
Exporting dictionary, please wait...
Exported dictionary ARXML files are located in: C:\Users\smcconne\OneDrive - MathWorks\Documents\MATLAB\ExampleManager\smcconne.Bdoc24a.j2460153\autosarblockset-ex12133217\tpc_interfaces.
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 20.379s
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 14.054s
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 14.323s
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 12.133s
Exporting dictionary: tpc_interfaces.sldd (1 out of 1)
Exporting dictionary, please wait...
Exported dictionary ARXML files are located in: C:\Users\smcconne\OneDrive - MathWorks\Documents\MATLAB\ExampleManager\smcconne.Bdoc24a.j2460153\autosarblockset-ex13803922\tpc_interfaces.
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 31.623s
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 26.879s
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 18.36s
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 17.561s
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 19.01s
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 21.271s
Exporting dictionary: tpc_interfaces.sldd (1 out of 1)
Exporting dictionary, please wait...
Exported dictionary ARXML files are located in: C:\Users\smcconne\OneDrive - MathWorks\Documents\MATLAB\ExampleManager\smcconne.Bdoc24a.jan19\autosarblockset-ex37160044\tpc_interfaces.
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 16.046s
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 15.056s
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 13.967s
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 14.015s
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 13.779s
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.93s
Exporting dictionary: tpc_interfaces.sldd (1 out of 1)
Exporting dictionary, please wait...
Exported dictionary ARXML files are located in: C:\Users\smcconne\OneDrive - MathWorks\Documents\MATLAB\ExampleManager\smcconne.Bdoc24a.j2460153\autosarblockset-ex51579616\tpc_interfaces.
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 Package ASAP2 File.

Note

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

Example: 'ExportASAP2File',true

Version History

Introduced in R2020a

expand all