armodel 1.5.0__py3-none-any.whl → 1.6.0__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 (76) hide show
  1. armodel/cli/arxml_dump_cli.py +13 -13
  2. armodel/cli/memory_section_cli.py +76 -0
  3. armodel/cli/system_signal_cli.py +74 -0
  4. armodel/lib/__init__.py +2 -1
  5. armodel/lib/system_signal.py +37 -0
  6. armodel/models/__init__.py +6 -3
  7. armodel/models/annotation.py +27 -3
  8. armodel/models/ar_object.py +18 -6
  9. armodel/models/ar_package.py +124 -14
  10. armodel/models/ar_ref.py +109 -62
  11. armodel/models/bsw_module_template.py +37 -14
  12. armodel/models/common_structure.py +132 -147
  13. armodel/models/communication.py +1 -1
  14. armodel/models/data_prototype.py +41 -6
  15. armodel/models/datatype.py +11 -5
  16. armodel/models/fibex/can_communication.py +119 -3
  17. armodel/models/fibex/fibex_4_can/__init__.py +0 -0
  18. armodel/models/fibex/fibex_4_lin/__init__.py +0 -0
  19. armodel/models/fibex/fibex_4_multiplatform.py +81 -88
  20. armodel/models/fibex/fibex_core/__init__.py +0 -0
  21. armodel/models/fibex/fibex_core/core_communication.py +627 -0
  22. armodel/models/fibex/fibex_core/core_topology.py +180 -0
  23. armodel/models/fibex/lin_communication.py +24 -3
  24. armodel/models/general_structure.py +101 -8
  25. armodel/models/m2/__init__.py +0 -0
  26. armodel/models/m2/autosar_templates/__init__.py +0 -0
  27. armodel/models/m2/autosar_templates/common_structure/__init__.py +188 -0
  28. armodel/models/m2/autosar_templates/common_structure/constants.py +0 -0
  29. armodel/models/m2/autosar_templates/ecuc_description_template.py +268 -0
  30. armodel/models/m2/autosar_templates/sw_component_template/__init__.py +0 -0
  31. armodel/models/m2/autosar_templates/sw_component_template/communication.py +316 -0
  32. armodel/models/m2/autosar_templates/sw_component_template/components/__init__.py +0 -0
  33. armodel/models/m2/autosar_templates/sw_component_template/components/instance_refs.py +149 -0
  34. armodel/models/m2/autosar_templates/sw_component_template/port_interface.py +236 -0
  35. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/__init__.py +203 -0
  36. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/access_count.py +13 -0
  37. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/data_elements.py +54 -0
  38. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/mode_declaration_group.py +39 -0
  39. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py +26 -0
  40. armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/trigger.py +10 -0
  41. armodel/models/m2/autosar_templates/system_template/__init__.py +321 -0
  42. armodel/models/m2/autosar_templates/system_template/data_mapping.py +88 -0
  43. armodel/models/m2/autosar_templates/system_template/network_management.py +554 -0
  44. armodel/models/m2/autosar_templates/system_template/transport_protocols.py +7 -0
  45. armodel/models/m2/msr/__init__.py +0 -0
  46. armodel/models/m2/msr/asam_hdo/__init__.py +0 -0
  47. armodel/models/m2/msr/asam_hdo/units.py +105 -0
  48. armodel/models/m2/msr/data_dictionary/__init__.py +0 -0
  49. armodel/models/m2/msr/data_dictionary/auxillary_objects.py +42 -0
  50. armodel/models/m2/msr/data_dictionary/data_def_properties.py +295 -0
  51. armodel/models/m2/msr/documentation/__init__.py +0 -0
  52. armodel/models/m2/msr/documentation/block_elements.py +18 -0
  53. armodel/models/multilanguage_data.py +15 -0
  54. armodel/models/per_instance_memory.py +34 -6
  55. armodel/models/port_prototype.py +12 -174
  56. armodel/models/sw_component.py +14 -216
  57. armodel/parser/abstract_arxml_parser.py +10 -1
  58. armodel/parser/arxml_parser.py +803 -186
  59. armodel/tests/test_armodel/models/test_ar_package.py +1 -1
  60. armodel/tests/test_armodel/models/test_ar_ref.py +3 -3
  61. armodel/tests/test_armodel/models/test_bsw_module_template.py +5 -5
  62. armodel/tests/test_armodel/models/test_common_structure.py +3 -3
  63. armodel/tests/test_armodel/models/test_data_dictionary.py +5 -5
  64. armodel/tests/test_armodel/models/test_data_prototype.py +1 -1
  65. armodel/tests/test_armodel/models/test_datatype.py +1 -1
  66. armodel/tests/test_armodel/models/test_port_interface.py +1 -1
  67. armodel/tests/test_armodel/parser/test_parse_bswmd.py +3 -3
  68. armodel/tests/test_armodel/parser/test_sw_components.py +2 -2
  69. armodel/writer/arxml_writer.py +832 -196
  70. {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/METADATA +24 -1
  71. armodel-1.6.0.dist-info/RECORD +127 -0
  72. {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/entry_points.txt +3 -1
  73. armodel-1.5.0.dist-info/RECORD +0 -91
  74. {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/LICENSE +0 -0
  75. {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/WHEEL +0 -0
  76. {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/top_level.txt +0 -0
@@ -1,220 +1,19 @@
1
- from typing import List, Dict
1
+ from typing import List
2
2
  from abc import ABCMeta
3
3
 
4
- from .rpt_scenario import ModeAccessPointIdent
5
-
4
+ from .m2.autosar_templates.sw_component_template.components.instance_refs import RModeInAtomicSwcInstanceRef, RVariableInAtomicSwcInstanceRef
5
+ from .m2.autosar_templates.sw_component_template.swc_internal_behavior import RunnableEntity
6
6
  from .internal_behavior import IncludedDataTypeSet, InternalBehavior
7
7
  from .service_mapping import RoleBasedPortAssignment
8
8
  from .per_instance_memory import PerInstanceMemory
9
9
  from .service_needs import NvBlockNeeds, RoleBasedDataAssignment, ServiceNeeds
10
10
  from .ar_object import ARBoolean, ARLiteral
11
11
  from .general_structure import ARElement, Identifiable, ARObject
12
- from .ar_ref import AutosarParameterRef, AutosarVariableRef, InnerPortGroupInCompositionInstanceRef, POperationInAtomicSwcInstanceRef, RModeGroupInAtomicSWCInstanceRef, ROperationInAtomicSwcInstanceRef, TRefType
12
+ from .ar_ref import InnerPortGroupInCompositionInstanceRef, POperationInAtomicSwcInstanceRef, TRefType
13
13
  from .ar_ref import RefType, PortInCompositionTypeInstanceRef, PPortInCompositionInstanceRef, RPortInCompositionInstanceRef
14
- from .ar_ref import RVariableInAtomicSwcInstanceRef, RModeInAtomicSwcInstanceRef
15
14
  from .port_prototype import RPortPrototype, PPortPrototype, PortPrototype
16
15
  from .data_prototype import ParameterDataPrototype, VariableDataPrototype
17
- from .common_structure import ExecutableEntity, ValueSpecification
18
-
19
- class VariableAccess(Identifiable):
20
- def __init__(self, parent: ARObject, short_name):
21
- super().__init__(parent, short_name)
22
- self.accessed_variable_ref = AutosarVariableRef()
23
- self.accessed_variable_ref.parent = self
24
- self._parent = parent
25
- self.local_variable_ref = None # type: RefType
26
-
27
- class AbstractAccessPoint(Identifiable):
28
- __metaclass__ = ABCMeta
29
-
30
- def __init__(self, parent: ARObject, short_name: str):
31
- if type(self) == AbstractAccessPoint:
32
- raise NotImplementedError("ARObject is an abstract class.")
33
-
34
- super().__init__(parent, short_name)
35
-
36
- self.return_value_provision = None
37
-
38
- class ParameterAccess(AbstractAccessPoint):
39
- def __init__(self, parent: ARObject, short_name: str):
40
- super().__init__(parent, short_name)
41
-
42
- self.accessed_parameter = None # type: AutosarParameterRef
43
- self.sw_data_def_props = None #
44
-
45
- class ServerCallPoint(AbstractAccessPoint):
46
- __metaclass__ = ABCMeta
47
-
48
- def __init__(self, parent: ARObject, short_name: str):
49
- super().__init__(parent, short_name)
50
- self.operation_iref = None # type: ROperationInAtomicSwcInstanceRef
51
- self.timeout = None # type: float
52
-
53
- class SynchronousServerCallPoint(ServerCallPoint):
54
- def __init__(self, parent: ARObject, short_name: str):
55
- super().__init__(parent, short_name)
56
-
57
- self.called_from_within_exclusive_area_ref = None # type: RefType
58
-
59
- class ModeAccessPoint(ARObject):
60
- def __init__(self):
61
- super().__init__()
62
-
63
- self.ident = None # type: ModeAccessPointIdent
64
- self.mode_group_iref = None # type: RModeGroupInAtomicSWCInstanceRef
65
-
66
- @property
67
- def modeGroupIRef(self) -> RModeGroupInAtomicSWCInstanceRef:
68
- return self.mode_group_iref
69
-
70
- @modeGroupIRef.setter
71
- def modeGroupIRef(self, value: RModeGroupInAtomicSWCInstanceRef):
72
- self.mode_group_iref = value
73
-
74
- class AsynchronousServerCallPoint(ServerCallPoint):
75
- def __init__(self, parent: ARObject, short_name: str):
76
- super().__init__(parent, short_name)
77
-
78
- class AsynchronousServerCallResultPoint(ServerCallPoint):
79
- def __init__(self, parent: ARObject, short_name: str):
80
- super().__init__(parent, short_name)
81
-
82
- self.asynchronous_server_call_point_ref = None # type: RefType
83
-
84
- @property
85
- def asynchronousServerCallPointRef(self) -> RefType:
86
- return self.asynchronous_server_call_point_ref
87
-
88
- @asynchronousServerCallPointRef.setter
89
- def asynchronousServerCallPointRef(self, value: RefType):
90
- self.asynchronous_server_call_point_ref = value
91
-
92
- class InternalTriggeringPoint(AbstractAccessPoint):
93
- def __init__(self, parent: ARObject, short_name: str):
94
- super().__init__(parent, short_name)
95
-
96
- self.sw_impl_policy = None
97
-
98
- class RunnableEntity(ExecutableEntity):
99
- def __init__(self, parent: ARObject, short_name: str):
100
- super().__init__(parent, short_name)
101
- self.can_be_invoked_concurrently = None # type: ARBoolean
102
- self.data_read_accesses = {} # type: Dict[str, VariableAccess]
103
- self.data_received_point_by_arguments = {} # type: Dict[str, VariableAccess]
104
- self.data_received_point_by_values = {} # type: Dict[str, VariableAccess]
105
- self.data_send_points = {} # type: Dict[str, VariableAccess]
106
- self.data_write_accesses = {} # type: Dict[str, VariableAccess]
107
- self.written_local_variables = {} # type: Dict[str, VariableAccess]
108
- self.read_local_variables = {} # type: Dict[str, VariableAccess]
109
- self.external_triggering_points = {} # type: Dict[InternalTriggeringPoint]
110
- self.internal_triggering_points = {}
111
- self.mode_access_points = [] # type: List[ModeAccessPoint]
112
- self.mode_switch_points = {}
113
- self.parameter_accesses = {} # type: Dict[str, ParameterAccess]
114
- self.server_call_points = {} # type: Dict[str, ServerCallPoint]
115
- self.wait_points = {} # type: Dict[str, WaitPoint]
116
- self.symbol = ""
117
-
118
- @property
119
- def canBeInvokedConcurrently(self) -> ARBoolean:
120
- return self.can_be_invoked_concurrently
121
-
122
- @canBeInvokedConcurrently.setter
123
- def canBeInvokedConcurrently(self, value: ARBoolean):
124
- self.can_be_invoked_concurrently = value
125
-
126
- def _createVariableAccess(self, short_name, variable_accesses: Dict[str, VariableAccess]):
127
- if (short_name not in variable_accesses):
128
- variable_access = VariableAccess(self, short_name)
129
- variable_accesses[short_name] = variable_access
130
- return variable_accesses[short_name]
131
-
132
- def createDataReadAccess(self, short_name: str) -> VariableAccess:
133
- return self._createVariableAccess(short_name, self.data_read_accesses)
134
-
135
- def getDataReadAccesses(self) -> List[VariableAccess]:
136
- return sorted(self.data_read_accesses.values(), key=lambda v: v.short_name)
137
-
138
- def createDataWriteAccess(self, short_name: str) -> VariableAccess:
139
- return self._createVariableAccess(short_name, self.data_write_accesses)
140
-
141
- def getDataWriteAccesses(self) -> List[VariableAccess]:
142
- return sorted(self.data_write_accesses.values(), key=lambda v: v.short_name)
143
-
144
- def createDataReceivePointByArgument(self, short_name: str) -> VariableAccess:
145
- return self._createVariableAccess(short_name, self.data_received_point_by_arguments)
146
-
147
- def getDataReceivePointByArguments(self) -> List[VariableAccess]:
148
- return sorted(self.data_received_point_by_arguments.values(), key=lambda v: v.short_name)
149
-
150
- def createDataReceivePointByValue(self, short_name: str) -> VariableAccess:
151
- return self._createVariableAccess(short_name, self.data_received_point_by_values)
152
-
153
- def getDataReceivePointByValues(self) -> List[VariableAccess]:
154
- return sorted(self.data_received_point_by_values.values(), key=lambda v: v.short_name)
155
-
156
- def createDataSendPoint(self, short_name: str) -> VariableAccess:
157
- return self._createVariableAccess(short_name, self.data_send_points)
158
-
159
- def getDataSendPoints(self) -> List[VariableAccess]:
160
- return sorted(self.data_send_points.values(), key=lambda v: v.short_name)
161
-
162
- def createReadLocalVariable(self, short_name: str) -> VariableAccess:
163
- return self._createVariableAccess(short_name, self.read_local_variables)
164
-
165
- def getReadLocalVariables(self) -> List[VariableAccess]:
166
- return sorted(self.read_local_variables.values(), key=lambda v: v.short_name)
167
-
168
- def createWrittenLocalVariable(self, short_name: str) -> VariableAccess:
169
- return self._createVariableAccess(short_name, self.written_local_variables)
170
-
171
- def getWrittenLocalVariables(self) -> List[VariableAccess]:
172
- return sorted(self.written_local_variables.values(), key=lambda v: v.short_name)
173
-
174
- def createParameterAccess(self, short_name: str) -> ParameterAccess:
175
- if (short_name not in self.server_call_points):
176
- parameter_access = ParameterAccess(self, short_name)
177
- self.parameter_accesses[short_name] = parameter_access
178
- return self.parameter_accesses[short_name]
179
-
180
- def getParameterAccesses(self) -> List[ParameterAccess]:
181
- return sorted(self.parameter_accesses.values(), key= lambda o: o.short_name)
182
-
183
- def createSynchronousServerCallPoint(self, short_name: str) -> SynchronousServerCallPoint:
184
- if (short_name not in self.server_call_points):
185
- server_call_point = SynchronousServerCallPoint(self, short_name)
186
- self.server_call_points[short_name] = server_call_point
187
- return self.server_call_points[short_name]
188
-
189
- def createAsynchronousServerCallPoint(self, short_name: str) -> AsynchronousServerCallPoint:
190
- if (short_name not in self.server_call_points):
191
- server_call_point = AsynchronousServerCallPoint(self, short_name)
192
- self.server_call_points[short_name] = server_call_point
193
- return self.server_call_points[short_name]
194
-
195
- def getSynchronousServerCallPoint(self) -> List[ServerCallPoint]:
196
- return filter(lambda o: isinstance(o, SynchronousServerCallPoint), self.getServerCallPoints())
197
-
198
- def getAsynchronousServerCallPoint(self) -> List[ServerCallPoint]:
199
- return filter(lambda o: isinstance(o, AsynchronousServerCallPoint), self.getServerCallPoints())
200
-
201
- def getServerCallPoints(self) -> List[ServerCallPoint]:
202
- return sorted(self.server_call_points.values(), key=lambda v: v.short_name)
203
-
204
- def createInternalTriggeringPoint(self, short_name: str) -> InternalTriggeringPoint:
205
- if (short_name not in self.elements):
206
- point = InternalTriggeringPoint(self, short_name)
207
- self.elements[point.short_name] = point
208
- return self.elements[point.short_name]
209
-
210
- def getInternalTriggeringPoints(self) -> List[InternalTriggeringPoint]:
211
- return filter(lambda o: isinstance(o, InternalTriggeringPoint), self.elements)
212
-
213
- def addModeAccessPoint(self, point: ModeAccessPoint):
214
- self.mode_access_points.append(point)
215
-
216
- def getModeAccessPoints(self) -> List[ModeAccessPoint]:
217
- return self.mode_access_points
16
+ from .m2.autosar_templates.common_structure import ValueSpecification
218
17
 
219
18
  class AbstractEvent(Identifiable):
220
19
  def __init__(self, parent: ARObject, short_name: str):
@@ -224,8 +23,8 @@ class RTEEvent(AbstractEvent):
224
23
  def __init__(self, parent: ARObject, short_name: str):
225
24
  super().__init__(parent, short_name)
226
25
 
227
- self.start_on_event_ref = None # type: RefType
228
- self.disabled_mode_irefs = [] # type: List[RModeInAtomicSwcInstanceRef]
26
+ self.start_on_event_ref = None # type: RefType
27
+ self.disabled_mode_irefs = [] # type: List[RModeInAtomicSwcInstanceRef]
229
28
 
230
29
  def addDisabledModeIRef(self, iref: RModeInAtomicSwcInstanceRef):
231
30
  self.disabled_mode_irefs.append(iref)
@@ -249,15 +48,14 @@ class DataReceivedEvent(RTEEvent):
249
48
  def __init__(self, parent: ARObject, short_name: str):
250
49
  super().__init__(parent, short_name)
251
50
 
252
- self.data_iref = None # type: RVariableInAtomicSwcInstanceRef
51
+ self.dataIRef = None # type: RVariableInAtomicSwcInstanceRef
253
52
 
254
- @property
255
- def dataIRef(self) -> RVariableInAtomicSwcInstanceRef:
256
- return self.data_iref
257
-
258
- @dataIRef.setter
259
- def dataIRef(self, value: RVariableInAtomicSwcInstanceRef):
260
- self.data_iref = value
53
+ def getDataIRef(self):
54
+ return self.dataIRef
55
+
56
+ def setDataIRef(self, value):
57
+ self.dataIRef = value
58
+ return self
261
59
 
262
60
  class SwcModeSwitchEvent(RTEEvent):
263
61
  def __init__(self, parent: ARObject, short_name: str):
@@ -45,6 +45,9 @@ class AbstractARXMLParser:
45
45
  else:
46
46
  raise ValueError(error_msg)
47
47
 
48
+ def _raiseWarning(self, error_msg):
49
+ self.logger.warning(error_msg)
50
+
48
51
  def getPureTagName(self, tag):
49
52
  return re.sub(r'\{[\w:\/.]+\}(\w+)', r'\1', tag)
50
53
 
@@ -105,7 +108,7 @@ class AbstractARXMLParser:
105
108
  def getChildElementOptionalFloatValue(self, element: ET.Element, key: str) -> ARFloat:
106
109
  child_element = element.find("./xmlns:%s" % key, self.nsmap)
107
110
  float_value = None
108
- if (child_element is not None):
111
+ if (child_element is not None) and (child_element.text is not None):
109
112
  float_value = ARFloat()
110
113
  float_value.setValue(child_element.text)
111
114
  return float_value
@@ -234,6 +237,12 @@ class AbstractARXMLParser:
234
237
 
235
238
  self.logger.debug("schemaLocation %s" % document.schema_location)
236
239
 
240
+ def getShortName(self, element: ET.Element) -> str:
241
+ child_element = self.find(element, "SHORT-NAME")
242
+ if child_element is None:
243
+ raise ValueError("Short Name is required")
244
+ return child_element.text
245
+
237
246
  def convert_find_key(self, key: str) -> str:
238
247
  keys = key.split("/")
239
248
  for idx, item in enumerate(keys):