Welcome to py-armodel’s Documentation
py-armodel is a Python library for parsing and generating AUTOSAR ARXML files. It provides comprehensive support for AUTOSAR models including software components, data types, communication patterns, and system configurations.
Current Version: 1.9.0 Python Requirements: >= 3.5 License: MIT
Overview
py-armodel provides a complete ARXML (AUTOSAR XML) file parser and writer, supporting various AUTOSAR elements defined in the AUTOSAR standard. It implements data structures, interfaces, components, and communication patterns specified in AUTOSAR.
Key Features
ARXML Parsing: Parse AUTOSAR XML files with full validation
ARXML Generation: Write AUTOSAR models to XML files
CLI Tools: Multiple command-line tools for processing ARXML files
Data Models: Complete AUTOSAR data model implementation
Connector Management: Import/export software connectors to/from Excel
System Modeling: Support for system signals, mappings, and ECU instances
Diagnostics: Support for diagnostic connections, service tables, and event requirements
Communication Protocols: Support for CAN, LIN, FlexRay, and Ethernet
BSW Support: Complete Basic Software module description support
Quick Start
Installation
Install py-armodel using pip:
pip install armodel
Basic Usage
Parse an ARXML file:
from armodel.parser.arxml_parser import ARXMLParser
parser = ARXMLParser()
autosar_model = parser.parse_from_file('example.arxml')
Access AUTOSAR elements:
# Get all atomic software component types
swcs = autosar_model.getAtomicSwComponentTypes()
# Find a specific component
component = autosar_model.findAtomicSwComponentType('MyComponent')
# Get system signals
signals = autosar_model.getSystemSignals()
Write an ARXML file:
from armodel.writer.arxml_writer import ARXMLWriter
writer = ARXMLWriter()
writer.write_to_file(autosar_model, 'output.arxml')
Documentation Structure
User Guide:
Examples:
- Basic Usage Examples
- Example 1: Parse and Inspect ARXML
- Example 2: Create Simple Component
- Example 3: Add Ports to Component
- Example 4: Find and Access Elements
- Example 5: Iterate Through All Elements
- Example 6: Read and Write ARXML
- Example 7: Error Handling
- Example 8: Working with UUIDs
- Example 9: Format ARXML File
- Example 10: Multiple File Processing
- Working with Components
- Communication Setup Examples
- Diagnostics Examples
- Example 1: Create Diagnostic Connection
- Example 2: Create Diagnostic Service Table
- Example 3: Create Diagnostic Event Needs
- Example 4: Create Diagnostic Communication Manager Needs
- Example 5: Create Diagnostic Routine Needs
- Example 6: List All Diagnostic Elements
- Example 7: Find Diagnostic Elements
- Example 8: Complete Diagnostic Setup
Additional Information:
- Changelog
- Version 1.9.0 (Current)
- Version 1.8.7
- Version 1.8.6
- Version 1.8.5
- Version 1.8.4
- Version 1.8.3
- Version 1.8.2
- Version 1.8.1
- Version 1.8.0
- Version 1.7.9
- Version 1.7.8
- Version 1.7.7
- Version 1.7.6
- Version 1.7.5
- Version 1.7.4
- Version 1.7.3
- Version 1.7.2
- Version 1.7.1
- Version 1.7.0
- Version 1.6.4
- Version 1.6.3
- Version 1.6.2
- Version 1.6.1
- Version 1.6.0
- Version 1.5.0
- Version 1.4.3
- Version 1.4.2
- Version 1.4.1
- Version 1.4.0
- Version 1.3.0
- Version 1.2.0
- Version 1.1.0
- Version 1.0.0
- Version 0.1.3
- Version 0.1.2
- Version 0.1.1
- Contributing to py-armodel
- License
Project Structure
src/armodel/
├── cli/ # Command-line tools
├── data_models/ # Data model definitions
├── lib/ # Library functions
├── models/ # AUTOSAR model definitions
│ └── M2/ # M2 model layer (MSR and AUTOSARTemplates)
├── parser/ # Parser implementations
├── report/ # Report generation
├── transformer/ # Transformers
└── writer/ # Writer implementations
Supported AUTOSAR Elements
Component Types
ApplicationSwComponentType
CompositionSwComponentType
SensorActuatorSwComponentType
ServiceSwComponentType
Port Interfaces
SenderReceiverInterface
ClientServerInterface
ModeSwitchInterface
ParameterInterface
NvDataInterface
Data Types
ApplicationDataType
ImplementationDataType
ApplicationRecordElement
ApplicationArrayElement
CompuMethod
DataConstr
Unit
Communication
AssemblySwConnector
DelegationSwConnector
ServerComSpec
ModeSwitchReceiverComSpec
NvProvideComSpec
NvRequireComSpec
Protocols
CAN (CAN-FRAME, CAN-COMMUNICATION-CONNECTOR)
LIN (LIN-CLUSTER, LIN-UNCONDITIONAL-FRAME)
FlexRay (FLEXRAY-CLUSTER, FLEXRAY-COMMUNICATION-CONNECTOR)
Ethernet (ETHERNET-COMMUNICATION-CONNECTOR, SO-AD-CONFIG)
Behavior
RunnableEntity
InternalBehavior
SwcImplementation
BswImplementation
Events
InitEvent
DataReceiveEvent
SwcModeSwitchEvent
BswBackgroundEvent
BswDataReceivedEvent
Diagnostics
DiagnosticConnection
DiagnosticServiceTable
DiagnosticEventNeeds
System
SystemSignal
SystemSignalGroup
ECU-INSTANCE
SWC-TO-ECU-MAPPING
BSW Modules
BswModuleDescription
BswBehavior
BswSchedulableEntity
BswCalledEntity
ECUC Configuration
EcucValueCollection
EcucModuleConfigurationValues
EcucContainerValue
EcucParameterValue
Command-Line Tools
py-armodel provides several CLI tools for common operations:
arxml-dump- Dump all ARXML data to screenarxml-format- Format ARXML filesarmodel-component- List all software component typesconnector2xlsx- Export connectors to Excelconnector-update- Update connectors from Excelarmodel-system-signal- List all system signalsarmodel-memory-section- Manage memory sectionsarmodel-file-list- List file informationarmodel-uuid-checker- Check for duplicate UUIDsformat-xml- Format XML files
See CLI Tools Reference for detailed usage information.
Contributing
Contributions are welcome! Please see Contributing to py-armodel for guidelines on how to contribute to py-armodel.
License
py-armodel is licensed under the MIT License. See License for details.
Links
AUTOSAR Official Website <https://www.autosar.org/>