armodel 1.7.2__py3-none-any.whl → 1.7.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. armodel/cli/arxml_dump_cli.py +1 -1
  2. armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswBehavior.py +42 -19
  3. armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswInterfaces.py +104 -30
  4. armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswOverview.py +12 -16
  5. armodel/models/M2/AUTOSARTemplates/CommonStructure/FlatMap.py +70 -0
  6. armodel/models/M2/AUTOSARTemplates/CommonStructure/Implementation.py +12 -9
  7. armodel/models/M2/AUTOSARTemplates/CommonStructure/InternalBehavior.py +29 -22
  8. armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/HardwareConfiguration.py +33 -0
  9. armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/HeapUsage.py +10 -0
  10. armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/SoftwareContext.py +23 -0
  11. armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/StackUsage.py +93 -0
  12. armodel/models/M2/AUTOSARTemplates/CommonStructure/ResourceConsumption/__init__.py +39 -5
  13. armodel/models/M2/AUTOSARTemplates/CommonStructure/ServiceNeeds.py +26 -2
  14. armodel/models/M2/AUTOSARTemplates/CommonStructure/SwcBswMapping.py +48 -6
  15. armodel/models/M2/AUTOSARTemplates/GenericStructure/AbstractStructure.py +5 -5
  16. armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/ARPackage.py +21 -1
  17. armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/PrimitiveTypes.py +12 -0
  18. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/Composition/__init__.py +8 -0
  19. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/PortInterface/__init__.py +196 -5
  20. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/ServiceMapping.py +11 -2
  21. armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/__init__.py +36 -21
  22. armodel/models/M2/AUTOSARTemplates/SystemTemplate/DataMapping.py +10 -1
  23. armodel/models/M2/MSR/AsamHdo/ComputationMethod.py +16 -1
  24. armodel/models/M2/MSR/CalibrationData/CalibrationValue.py +34 -3
  25. armodel/models/M2/MSR/DataDictionary/DataDefProperties.py +7 -0
  26. armodel/models/M2/MSR/DataDictionary/ServiceProcessTask.py +33 -0
  27. armodel/models/__init__.py +3 -0
  28. armodel/parser/abstract_arxml_parser.py +4 -14
  29. armodel/parser/arxml_parser.py +347 -180
  30. armodel/tests/test_armodel/models/test_ar_object.py +6 -2
  31. armodel/tests/test_armodel/models/test_port_interface.py +4 -4
  32. armodel/tests/test_armodel/parser/test_parse_bswmd.py +48 -48
  33. armodel/writer/abstract_arxml_writer.py +1 -0
  34. armodel/writer/arxml_writer.py +351 -226
  35. {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/METADATA +15 -2
  36. {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/RECORD +40 -34
  37. {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/LICENSE +0 -0
  38. {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/WHEEL +0 -0
  39. {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/entry_points.txt +0 -0
  40. {armodel-1.7.2.dist-info → armodel-1.7.3.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- from ....models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARFloat, ARLiteral, ARNumerical
1
+ from ....models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARFloat, ARLiteral, ARNumerical, TimeValue
2
2
  from ....models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import ARBoolean
3
3
 
4
4
  class TestARObject:
@@ -148,4 +148,8 @@ class TestARObject:
148
148
  assert(flag.getText() == "100")
149
149
 
150
150
 
151
-
151
+ def test_TimeValue(self):
152
+ value = TimeValue()
153
+ value.setValue("0.01")
154
+ assert(value.getValue() == 0.01)
155
+ assert(value.getText() == "0.01")
@@ -127,10 +127,10 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_PortInterface:
127
127
  assert(isinstance(prototype, Referrable))
128
128
  assert(isinstance(prototype, ArgumentDataPrototype))
129
129
 
130
- assert(prototype.parent == ar_root)
131
- assert(prototype.short_name == "ArgumentDataPrototype")
132
- assert(prototype.direction == "")
133
- assert(prototype.server_argument_impl_policy == "")
130
+ assert(prototype.getParent() == ar_root)
131
+ assert(prototype.getShortName() == "ArgumentDataPrototype")
132
+ assert(prototype.getDirection() == None)
133
+ assert(prototype.getServerArgumentImplPolicy() == None)
134
134
 
135
135
  def test_ApplicationError(self):
136
136
  document = AUTOSAR.getInstance()
@@ -28,14 +28,14 @@ class TestBswMD:
28
28
  document = AUTOSAR.getInstance()
29
29
  root_pkgs = sorted(document.getARPackages(), key = lambda pkg: pkg.short_name)
30
30
  assert(len(root_pkgs) == 2)
31
- assert(root_pkgs[0].short_name == "AUTOSAR_BswM")
32
- assert(root_pkgs[1].short_name == "EB_BswM_TxDxM1I14R0")
31
+ assert(root_pkgs[0].getShortName() == "AUTOSAR_BswM")
32
+ assert(root_pkgs[1].getShortName() == "EB_BswM_TxDxM1I14R0")
33
33
 
34
34
  root_pkg_0_pkgs = sorted(root_pkgs[0].getARPackages(), key = lambda pkg: pkg.short_name)
35
35
  assert(len(root_pkg_0_pkgs) == 3)
36
36
 
37
37
  bsw_module_desc_pkg = root_pkg_0_pkgs[0] # type:ARPackage
38
- assert(bsw_module_desc_pkg.short_name == "BswModuleDescriptions")
38
+ assert(bsw_module_desc_pkg.getShortName() == "BswModuleDescriptions")
39
39
 
40
40
  root_pkg_1_pkgs = root_pkgs[1].getARPackages()
41
41
  assert(len(root_pkg_1_pkgs) == 1)
@@ -48,16 +48,16 @@ class TestBswMD:
48
48
  assert(len(bsw_module_descs) == 1)
49
49
 
50
50
  bsw_module_desc = bsw_module_descs[0]
51
- assert(bsw_module_desc.short_name == "BswM")
52
- assert(bsw_module_desc.module_id.getText() == "34")
53
- assert(bsw_module_desc.module_id.getValue() == 34)
51
+ assert(bsw_module_desc.getShortName() == "BswM")
52
+ assert(bsw_module_desc.moduleId.getText() == "34")
53
+ assert(bsw_module_desc.moduleId.getValue() == 34)
54
54
 
55
55
  # verify the provided entries
56
- assert(len(bsw_module_desc._implementedEntryRefs) == 2)
57
- assert(bsw_module_desc._implementedEntryRefs[0].dest == "BSW-MODULE-ENTRY")
58
- assert(bsw_module_desc._implementedEntryRefs[0].value == "/AUTOSAR_BswM/BswModuleEntrys/BswM_Init")
59
- assert(bsw_module_desc._implementedEntryRefs[1].dest == "BSW-MODULE-ENTRY")
60
- assert(bsw_module_desc._implementedEntryRefs[1].value == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
56
+ assert(len(bsw_module_desc.implementedEntryRefs) == 2)
57
+ assert(bsw_module_desc.implementedEntryRefs[0].getDest() == "BSW-MODULE-ENTRY")
58
+ assert(bsw_module_desc.implementedEntryRefs[0].getValue() == "/AUTOSAR_BswM/BswModuleEntrys/BswM_Init")
59
+ assert(bsw_module_desc.implementedEntryRefs[1].getDest() == "BSW-MODULE-ENTRY")
60
+ assert(bsw_module_desc.implementedEntryRefs[1].getValue() == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
61
61
 
62
62
  assert(len(bsw_module_desc.getBswInternalBehaviors()) == 1)
63
63
  behavior = bsw_module_desc.getBswInternalBehaviors()[0]
@@ -65,8 +65,8 @@ class TestBswMD:
65
65
 
66
66
  assert(len(behavior.getDataTypeMappingRefs()) == 1)
67
67
  data_type_mapping_ref = behavior.getDataTypeMappingRefs()[0]
68
- assert(data_type_mapping_ref.dest == "DATA-TYPE-MAPPING-SET")
69
- assert(data_type_mapping_ref.value == "/BswMMode/DataTypeMappingSets/BswMModeMapping")
68
+ assert(data_type_mapping_ref.getDest() == "DATA-TYPE-MAPPING-SET")
69
+ assert(data_type_mapping_ref.getValue() == "/BswMMode/DataTypeMappingSets/BswMModeMapping")
70
70
 
71
71
  assert(len(behavior.getExclusiveAreas()) == 1)
72
72
  assert(behavior.getExclusiveAreas()[0].short_name == "SCHM_BSWM_EXCLUSIVE_AREA")
@@ -77,16 +77,16 @@ class TestBswMD:
77
77
  assert(entity.minimumStartInterval is not None)
78
78
  assert(entity.minimumStartIntervalMs is not None)
79
79
  assert(len(entity.getCanEnterExclusiveAreaRefs()) == 1)
80
- assert(entity.getCanEnterExclusiveAreaRefs()[0].dest == "EXCLUSIVE-AREA")
81
- assert(entity.getCanEnterExclusiveAreaRefs()[0].value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/SCHM_BSWM_EXCLUSIVE_AREA")
82
- assert(entity.implementedEntryRef.dest == "BSW-MODULE-ENTRY")
83
- assert(entity.implementedEntryRef.value == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
80
+ assert(entity.getCanEnterExclusiveAreaRefs()[0].getDest() == "EXCLUSIVE-AREA")
81
+ assert(entity.getCanEnterExclusiveAreaRefs()[0].getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/SCHM_BSWM_EXCLUSIVE_AREA")
82
+ assert(entity.implementedEntryRef.getDest() == "BSW-MODULE-ENTRY")
83
+ assert(entity.implementedEntryRef.getValue() == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
84
84
 
85
85
  assert(len(behavior.getBswTimingEvents()) == 1)
86
86
  event = behavior.getBswTimingEvents()[0]
87
87
  assert(event.short_name == "TimingEvent_MainFunction")
88
- assert(event.startsOnEventRef.dest == "BSW-SCHEDULABLE-ENTITY")
89
- assert(event.startsOnEventRef.value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
88
+ assert(event.startsOnEventRef.getDest() == "BSW-SCHEDULABLE-ENTITY")
89
+ assert(event.startsOnEventRef.getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
90
90
  assert(event.period.getValue() == 0.02)
91
91
  assert(event.period.getText() == "0.02")
92
92
  assert(event.periodMs == 20)
@@ -98,21 +98,21 @@ class TestBswMD:
98
98
  entries = sorted(pkg.getBswModuleEntries(), key= lambda entry: entry.short_name)
99
99
  assert(len(entries) == 2)
100
100
 
101
- assert(entries[0].short_name == "BswM_Init")
102
- assert(entries[0].service_id._value == 0)
103
- assert(entries[0].is_reentrant.value == False)
104
- assert(entries[0].is_synchronous.value == True)
105
- assert(entries[0].call_type.getText() == "REGULAR")
106
- assert(entries[0].execution_context.getText() == "UNSPECIFIED")
107
- assert(entries[0].sw_service_impl_policy.getText() == "STANDARD")
108
-
109
- assert(entries[1].short_name == "BswM_MainFunction")
110
- assert(entries[1].service_id._value == 3)
111
- assert(entries[1].is_reentrant.value == False)
112
- assert(entries[1].is_synchronous.value == True)
113
- assert(entries[1].call_type.getText() == "SCHEDULED")
114
- assert(entries[1].execution_context.getText() == "TASK")
115
- assert(entries[1].sw_service_impl_policy.getText() == "STANDARD")
101
+ assert(entries[0].getShortName() == "BswM_Init")
102
+ assert(entries[0].getServiceId().getValue() == 0)
103
+ assert(entries[0].getIsReentrant().getValue() == False)
104
+ assert(entries[0].getIsSynchronous().getValue() == True)
105
+ assert(entries[0].getCallType().getText() == "REGULAR")
106
+ assert(entries[0].getExecutionContext().getText() == "UNSPECIFIED")
107
+ assert(entries[0].getSwServiceImplPolicy().getText() == "STANDARD")
108
+
109
+ assert(entries[1].getShortName() == "BswM_MainFunction")
110
+ assert(entries[1].getServiceId().getValue() == 3)
111
+ assert(entries[1].getIsReentrant().getValue() == False)
112
+ assert(entries[1].getIsSynchronous().getValue() == True)
113
+ assert(entries[1].getCallType().getText() == "SCHEDULED")
114
+ assert(entries[1].getExecutionContext().getText() == "TASK")
115
+ assert(entries[1].getSwServiceImplPolicy().getText() == "STANDARD")
116
116
 
117
117
  def test_bsw_module_swc_bsw_mapping(self):
118
118
  document = AUTOSAR.getInstance()
@@ -121,15 +121,15 @@ class TestBswMD:
121
121
  mappings = pkg.getSwcBswMappings()
122
122
  assert(len(mappings) == 1)
123
123
 
124
- assert(mappings[0].bswBehaviorRef.dest == "BSW-INTERNAL-BEHAVIOR")
125
- assert(mappings[0].bswBehaviorRef.value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
124
+ assert(mappings[0].bswBehaviorRef.getDest() == "BSW-INTERNAL-BEHAVIOR")
125
+ assert(mappings[0].bswBehaviorRef.getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
126
126
 
127
127
  assert(len(mappings[0].getRunnableMappings()) == 1)
128
128
  runnable_mapping = mappings[0].getRunnableMappings()[0]
129
- assert(runnable_mapping.bswEntityRef.dest == "BSW-SCHEDULABLE-ENTITY")
130
- assert(runnable_mapping.bswEntityRef.value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
131
- assert(runnable_mapping.swcRunnableRef.dest == "RUNNABLE-ENTITY")
132
- assert(runnable_mapping.swcRunnableRef.value == "/AUTOSAR_BswM/SwComponentTypes/BswM/BswMInternalBehavior/RES_MainFunction")
129
+ assert(runnable_mapping.getBswEntityRef().getDest() == "BSW-SCHEDULABLE-ENTITY")
130
+ assert(runnable_mapping.getBswEntityRef().getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
131
+ assert(runnable_mapping.getSwcRunnableRef().getDest() == "RUNNABLE-ENTITY")
132
+ assert(runnable_mapping.getSwcRunnableRef().getValue() == "/AUTOSAR_BswM/SwComponentTypes/BswM/BswMInternalBehavior/RES_MainFunction")
133
133
 
134
134
  def test_bsw_module_implementation(self):
135
135
  document = AUTOSAR.getInstance()
@@ -161,22 +161,22 @@ class TestBswMD:
161
161
  section = impl.resourceConsumption.getMemorySection("CODE")
162
162
  assert(section.short_name == "CODE")
163
163
  assert(section.alignment == None)
164
- assert(section.swAddrMethodRef.dest == "SW-ADDR-METHOD")
165
- assert(section.swAddrMethodRef.value == "/AUTOSAR_MemMap/SwAddrMethods/CODE")
164
+ assert(section.swAddrMethodRef.getDest() == "SW-ADDR-METHOD")
165
+ assert(section.swAddrMethodRef.getValue() == "/AUTOSAR_MemMap/SwAddrMethods/CODE")
166
166
 
167
167
  section = impl.resourceConsumption.getMemorySection("VAR_NO_INIT_UNSPECIFIED")
168
168
  assert(section.short_name == "VAR_NO_INIT_UNSPECIFIED")
169
169
  assert(section.alignment.getText() == "UNSPECIFIED")
170
- assert(section.swAddrMethodRef.dest == "SW-ADDR-METHOD")
171
- assert(section.swAddrMethodRef.value == "/AUTOSAR_MemMap/SwAddrMethods/VAR_NOINIT")
170
+ assert(section.swAddrMethodRef.getDest() == "SW-ADDR-METHOD")
171
+ assert(section.swAddrMethodRef.getValue() == "/AUTOSAR_MemMap/SwAddrMethods/VAR_NOINIT")
172
172
 
173
173
  assert(impl.vendorId.getValue() == 1)
174
174
  assert(impl.swVersion.getValue() == "1.14.1")
175
- assert(impl.swcBswMappingRef.dest == "SWC-BSW-MAPPING")
176
- assert(impl.swcBswMappingRef.value == "/AUTOSAR_BswM/SwcBswMappings/SwcBswMapping_0")
175
+ assert(impl.swcBswMappingRef.getDest() == "SWC-BSW-MAPPING")
176
+ assert(impl.swcBswMappingRef.getValue() == "/AUTOSAR_BswM/SwcBswMappings/SwcBswMapping_0")
177
177
  assert(impl.arReleaseVersion.getValue() == "4.0.3")
178
- assert(impl.behaviorRef.dest == "BSW-INTERNAL-BEHAVIOR")
179
- assert(impl.behaviorRef.value == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
178
+ assert(impl.behaviorRef.getDest() == "BSW-INTERNAL-BEHAVIOR")
179
+ assert(impl.behaviorRef.getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
180
180
 
181
181
 
182
182
  def test_load_save(self):
@@ -104,6 +104,7 @@ class AbstractARXMLWriter:
104
104
  def setChildElementOptionalFloatValue(self, element: ET.Element, key: str, value: ARFloat):
105
105
  if value is not None:
106
106
  child_element = ET.SubElement(element, key)
107
+ self.setARObjectAttributes(child_element, value)
107
108
  child_element.text = value.getText()
108
109
 
109
110
  def setChildElementOptionalTimeValue(self, element: ET.Element, key: str, value: TimeValue):