armodel 1.4.3__py3-none-any.whl → 1.5.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 (36) hide show
  1. armodel/cli/arxml_dump_cli.py +1 -1
  2. armodel/models/ar_package.py +131 -23
  3. armodel/models/ar_ref.py +28 -5
  4. armodel/models/bsw_module_template.py +29 -14
  5. armodel/models/common_structure.py +38 -23
  6. armodel/models/fibex/__init__.py +0 -0
  7. armodel/models/fibex/can_communication.py +6 -0
  8. armodel/models/fibex/fibex_4_multiplatform.py +145 -0
  9. armodel/models/fibex/fibex_core.py +341 -0
  10. armodel/models/fibex/lin_communication.py +17 -0
  11. armodel/models/fibex/lin_topology.py +7 -0
  12. armodel/models/general_structure.py +19 -3
  13. armodel/models/implementation.py +4 -5
  14. armodel/models/internal_behavior.py +63 -0
  15. armodel/models/mode_declaration.py +8 -0
  16. armodel/models/port_prototype.py +20 -2
  17. armodel/models/rpt_scenario.py +20 -0
  18. armodel/models/sw_component.py +99 -36
  19. armodel/models/system_template/__init__.py +0 -0
  20. armodel/models/system_template/network_management.py +7 -0
  21. armodel/models/system_template/transport_protocols.py +7 -0
  22. armodel/models/timing.py +91 -0
  23. armodel/parser/abstract_arxml_parser.py +1 -1
  24. armodel/parser/arxml_parser.py +329 -72
  25. armodel/tests/test_armodel/models/test_data_prototype.py +1 -1
  26. armodel/tests/test_armodel/models/test_datatype.py +7 -7
  27. armodel/tests/test_armodel/models/test_port_interface.py +5 -5
  28. armodel/tests/test_armodel/parser/test_parse_bswmd.py +13 -5
  29. armodel/tests/test_armodel/parser/test_sw_components.py +4 -4
  30. armodel/writer/arxml_writer.py +250 -21
  31. {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/METADATA +25 -1
  32. {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/RECORD +36 -23
  33. {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/LICENSE +0 -0
  34. {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/WHEEL +0 -0
  35. {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/entry_points.txt +0 -0
  36. {armodel-1.4.3.dist-info → armodel-1.5.0.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,27 @@
1
1
  from typing import List, Dict
2
2
  from abc import ABCMeta
3
3
 
4
+ from .rpt_scenario import ModeAccessPointIdent
5
+
6
+ from .internal_behavior import IncludedDataTypeSet, InternalBehavior
4
7
  from .service_mapping import RoleBasedPortAssignment
5
8
  from .per_instance_memory import PerInstanceMemory
6
9
  from .service_needs import NvBlockNeeds, RoleBasedDataAssignment, ServiceNeeds
7
10
  from .ar_object import ARBoolean, ARLiteral
8
11
  from .general_structure import ARElement, Identifiable, ARObject
9
- from .ar_ref import AutosarParameterRef, AutosarVariableRef, InnerPortGroupInCompositionInstanceRef, ParameterInAtomicSWCTypeInstanceRef, POperationInAtomicSwcInstanceRef, ROperationInAtomicSwcInstanceRef, TRefType
12
+ from .ar_ref import AutosarParameterRef, AutosarVariableRef, InnerPortGroupInCompositionInstanceRef, POperationInAtomicSwcInstanceRef, RModeGroupInAtomicSWCInstanceRef, ROperationInAtomicSwcInstanceRef, TRefType
10
13
  from .ar_ref import RefType, PortInCompositionTypeInstanceRef, PPortInCompositionInstanceRef, RPortInCompositionInstanceRef
11
14
  from .ar_ref import RVariableInAtomicSwcInstanceRef, RModeInAtomicSwcInstanceRef
12
15
  from .port_prototype import RPortPrototype, PPortPrototype, PortPrototype
13
16
  from .data_prototype import ParameterDataPrototype, VariableDataPrototype
14
- from .common_structure import ExecutableEntity, InternalBehavior, ValueSpecification
17
+ from .common_structure import ExecutableEntity, ValueSpecification
15
18
 
16
19
  class VariableAccess(Identifiable):
17
20
  def __init__(self, parent: ARObject, short_name):
18
21
  super().__init__(parent, short_name)
19
22
  self.accessed_variable_ref = AutosarVariableRef()
20
23
  self.accessed_variable_ref.parent = self
21
- self.parent = parent
24
+ self._parent = parent
22
25
  self.local_variable_ref = None # type: RefType
23
26
 
24
27
  class AbstractAccessPoint(Identifiable):
@@ -51,7 +54,22 @@ class SynchronousServerCallPoint(ServerCallPoint):
51
54
  def __init__(self, parent: ARObject, short_name: str):
52
55
  super().__init__(parent, short_name)
53
56
 
54
- self.called_from_within_exclusive_area_ref = None # Type: RefType
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
55
73
 
56
74
  class AsynchronousServerCallPoint(ServerCallPoint):
57
75
  def __init__(self, parent: ARObject, short_name: str):
@@ -61,7 +79,15 @@ class AsynchronousServerCallResultPoint(ServerCallPoint):
61
79
  def __init__(self, parent: ARObject, short_name: str):
62
80
  super().__init__(parent, short_name)
63
81
 
64
- self.asynchronous_server_call_point_ref = None # Type:RefType
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
65
91
 
66
92
  class InternalTriggeringPoint(AbstractAccessPoint):
67
93
  def __init__(self, parent: ARObject, short_name: str):
@@ -72,23 +98,31 @@ class InternalTriggeringPoint(AbstractAccessPoint):
72
98
  class RunnableEntity(ExecutableEntity):
73
99
  def __init__(self, parent: ARObject, short_name: str):
74
100
  super().__init__(parent, short_name)
75
- self.can_be_invoked_concurrently = None # Type: ARBoolean
76
- self.data_read_accesses = {} # Type: Dict[str, VariableAccess]
77
- self.data_received_point_by_arguments = {} # Type: Dict[str, VariableAccess]
78
- self.data_received_point_by_values = {} # Type: Dict[str, VariableAccess]
79
- self.data_send_points = {} # Type: Dict[str, VariableAccess]
80
- self.data_write_accesses = {} # Type: Dict[str, VariableAccess]
81
- self.written_local_variables = {} # Type: Dict[str, VariableAccess]
82
- self.read_local_variables = {} # Type: Dict[str, VariableAccess]
83
- self.external_triggering_points = {} # Type: Dict[InternalTriggeringPoint]
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]
84
110
  self.internal_triggering_points = {}
85
- self.mode_access_points = {}
111
+ self.mode_access_points = [] # type: List[ModeAccessPoint]
86
112
  self.mode_switch_points = {}
87
- self.parameter_accesses = {} # Type: Dict[str, ParameterAccess]
88
- self.server_call_points = {} # Type: Dict[str, ServerCallPoint]
89
- self.wait_points = {} # Type: Dict[str, WaitPoint]
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]
90
116
  self.symbol = ""
91
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
+
92
126
  def _createVariableAccess(self, short_name, variable_accesses: Dict[str, VariableAccess]):
93
127
  if (short_name not in variable_accesses):
94
128
  variable_access = VariableAccess(self, short_name)
@@ -175,6 +209,12 @@ class RunnableEntity(ExecutableEntity):
175
209
 
176
210
  def getInternalTriggeringPoints(self) -> List[InternalTriggeringPoint]:
177
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
178
218
 
179
219
  class AbstractEvent(Identifiable):
180
220
  def __init__(self, parent: ARObject, short_name: str):
@@ -209,7 +249,15 @@ class DataReceivedEvent(RTEEvent):
209
249
  def __init__(self, parent: ARObject, short_name: str):
210
250
  super().__init__(parent, short_name)
211
251
 
212
- self.data_iref = None # type: RVariableInAtomicSwcInstanceRef
252
+ self.data_iref = None # type: RVariableInAtomicSwcInstanceRef
253
+
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
213
261
 
214
262
  class SwcModeSwitchEvent(RTEEvent):
215
263
  def __init__(self, parent: ARObject, short_name: str):
@@ -248,6 +296,14 @@ class OperationInvokedEvent(RTEEvent):
248
296
  super().__init__(parent, short_name)
249
297
  self.operation_iref = None # type: POperationInAtomicSwcInstanceRef
250
298
 
299
+ @property
300
+ def operationIRef(self) -> POperationInAtomicSwcInstanceRef:
301
+ return self.operation_iref
302
+
303
+ @operationIRef.setter
304
+ def operationIRef(self, value: POperationInAtomicSwcInstanceRef):
305
+ self.operation_iref = value
306
+
251
307
  class InitEvent(RTEEvent):
252
308
  def __init__(self, parent: ARObject, short_name: str):
253
309
  super().__init__(parent, short_name)
@@ -334,30 +390,37 @@ class SwcInternalBehavior(InternalBehavior):
334
390
 
335
391
  self.handle_termination_and_restart = None # type: str
336
392
  self.supports_multiple_instantiation = None # type: ARBoolean
337
- self._explicit_inter_runnable_variables = [] # type: List[VariableDataPrototype]
338
- self._implicit_inter_runnable_variables = [] # type: List[VariableDataPrototype]
339
- self._per_instance_memories = [] # type: List[PerInstanceMemory]
340
- self._per_instance_parameters = [] # type: List[ParameterDataPrototype]
341
- self._port_api_options = [] # type: List[PortAPIOption]
393
+ self.explicit_inter_runnable_variables = [] # type: List[VariableDataPrototype]
394
+ self.implicit_inter_runnable_variables = [] # type: List[VariableDataPrototype]
395
+ self.per_instance_memories = [] # type: List[PerInstanceMemory]
396
+ self.per_instance_parameters = [] # type: List[ParameterDataPrototype]
397
+ self.port_api_options = [] # type: List[PortAPIOption]
398
+ self.included_data_type_sets = [] # type: List[IncludedDataTypeSet]
342
399
 
343
400
  def getExplicitInterRunnableVariables(self) -> List[VariableDataPrototype]:
344
- return self._explicit_inter_runnable_variables
401
+ return self.explicit_inter_runnable_variables
345
402
 
346
403
  def getImplicitInterRunnableVariables(self) -> List[VariableDataPrototype]:
347
- return self._implicit_inter_runnable_variables
404
+ return self.implicit_inter_runnable_variables
348
405
 
349
406
  def getPerInstanceMemories(self) -> List[PerInstanceMemory]:
350
- return self._per_instance_memories
407
+ return self.per_instance_memories
351
408
 
352
- def getParameterDataPrototypes(self) -> List[ParameterDataPrototype]:
353
- return self._per_instance_parameters
409
+ def getPerInstanceParameters(self) -> List[ParameterDataPrototype]:
410
+ return self.per_instance_parameters
354
411
 
355
412
  def addPortAPIOption(self, option: PortAPIOption):
356
- self._port_api_options.append(option)
413
+ self.port_api_options.append(option)
357
414
 
358
415
  def getPortAPIOptions(self) -> List[PortAPIOption]:
359
- return self._port_api_options
416
+ return self.port_api_options
417
+
418
+ def addIncludedDataTypeSet(self, set: IncludedDataTypeSet):
419
+ self.included_data_type_sets.append(set)
360
420
 
421
+ def getIncludedDataTypeSets(self) -> List[IncludedDataTypeSet]:
422
+ return self.included_data_type_sets
423
+
361
424
  def createOperationInvokedEvent(self, short_name: str) -> OperationInvokedEvent:
362
425
  if (short_name not in self.elements):
363
426
  event = OperationInvokedEvent(self, short_name)
@@ -433,28 +496,28 @@ class SwcInternalBehavior(InternalBehavior):
433
496
  if (short_name not in self.elements):
434
497
  prototype = VariableDataPrototype(self, short_name)
435
498
  self.elements[short_name] = prototype
436
- self._explicit_inter_runnable_variables.append(prototype)
499
+ self.explicit_inter_runnable_variables.append(prototype)
437
500
  return self.elements[short_name]
438
501
 
439
502
  def createImplicitInterRunnableVariable(self, short_name: str) -> VariableDataPrototype:
440
503
  if (short_name not in self.elements):
441
504
  prototype = VariableDataPrototype(self, short_name)
442
505
  self.elements[short_name] = prototype
443
- self._implicit_inter_runnable_variables.append(prototype)
506
+ self.implicit_inter_runnable_variables.append(prototype)
444
507
  return self.elements[short_name]
445
508
 
446
509
  def createPerInstanceMemory(self, short_name: str) -> PerInstanceMemory:
447
510
  if (short_name not in self.elements):
448
511
  memory = PerInstanceMemory(self, short_name)
449
512
  self.elements[short_name] = memory
450
- self._per_instance_memories.append(memory)
513
+ self.per_instance_memories.append(memory)
451
514
  return self.elements[short_name]
452
515
 
453
- def createParameterDataPrototype(self, short_name: str) -> ParameterDataPrototype:
516
+ def createPerInstanceParameter(self, short_name: str) -> ParameterDataPrototype:
454
517
  if (short_name not in self.elements):
455
518
  prototype = ParameterDataPrototype(self, short_name)
456
519
  self.elements[short_name] = prototype
457
- self._per_instance_parameters.append(prototype)
520
+ self.per_instance_parameters.append(prototype)
458
521
  return self.elements[short_name]
459
522
 
460
523
  def getVariableDataPrototypes(self) -> List[VariableDataPrototype]:
File without changes
@@ -0,0 +1,7 @@
1
+
2
+ from ..ar_object import ARObject
3
+ from ..fibex.fibex_core import FibexElement
4
+
5
+ class NmConfig(FibexElement):
6
+ def __init__(self, parent: ARObject, short_name: str):
7
+ super().__init__(parent, short_name)
@@ -0,0 +1,7 @@
1
+
2
+ from ..ar_object import ARObject
3
+ from ..fibex.fibex_core import FibexElement
4
+
5
+ class CanTpConfig(FibexElement):
6
+ def __init__(self, parent: ARObject, short_name: str):
7
+ super().__init__(parent, short_name)
@@ -0,0 +1,91 @@
1
+
2
+ from abc import ABCMeta
3
+ from typing import List
4
+
5
+ from armodel.models.ar_ref import RefType
6
+
7
+ from ..models.general_structure import Identifiable
8
+ from ..models.ar_object import ARObject
9
+
10
+ class EOCExecutableEntityRefAbstract(Identifiable):
11
+ __metaclass__ = ABCMeta
12
+
13
+ def __init__(self, parent: ARObject, short_name: str):
14
+ if type(self) == TimingConstraint:
15
+ raise NotImplementedError("TimingExtension is an abstract class.")
16
+
17
+ super().__init__(parent, short_name)
18
+
19
+ class EOCExecutableEntityRef(EOCExecutableEntityRefAbstract):
20
+ def __init__(self, parent: ARObject, short_name: str):
21
+ super().__init__(parent, short_name)
22
+
23
+ self.successor_refs = [] # List[RefType]
24
+
25
+ def addSuccessorRef(self, ref: RefType):
26
+ self.successor_refs.append(ref)
27
+
28
+ def getSuccessorRefs(self) -> List[RefType]:
29
+ return self.successor_refs
30
+
31
+ class TimingConstraint(Identifiable):
32
+ __metaclass__ = ABCMeta
33
+
34
+ def __init__(self, parent: ARObject, short_name: str):
35
+ if type(self) == TimingConstraint:
36
+ raise NotImplementedError("TimingExtension is an abstract class.")
37
+
38
+ super().__init__(parent, short_name)
39
+
40
+ self.timing_condition_ref = None # type: RefType
41
+
42
+ @property
43
+ def timingConditionRef(self) -> RefType:
44
+ return self.timing_condition_ref
45
+
46
+ @timingConditionRef.setter
47
+ def timingConditionRef(self, ref: RefType):
48
+ self.timing_condition_ref = ref
49
+
50
+ class ExecutionOrderConstraint(TimingConstraint):
51
+ def __init__(self, parent: ARObject, short_name: str):
52
+ super().__init__(parent, short_name)
53
+
54
+ self.ordered_elements = [] # type: List[EOCExecutableEntityRefAbstract]
55
+
56
+ def createEOCExecutableEntityRef(self, short_name: str)-> EOCExecutableEntityRef:
57
+ if short_name not in self.elements:
58
+ entity_ref = EOCExecutableEntityRef(self, short_name)
59
+ self.elements[short_name] = entity_ref
60
+ self.ordered_elements.append(entity_ref)
61
+ return self.elements[short_name]
62
+
63
+ def getOrderedElements(self) -> List[EOCExecutableEntityRefAbstract]:
64
+ return self.ordered_elements
65
+
66
+ class TimingExtension(Identifiable):
67
+ __metaclass__ = ABCMeta
68
+
69
+ def __init__(self, parent: ARObject, short_name: str):
70
+ if type(self) == TimingExtension:
71
+ raise NotImplementedError("TimingExtension is an abstract class.")
72
+
73
+ super().__init__(parent, short_name)
74
+
75
+ self.timing_requirements = [] # Type: List[TimingConstraint]
76
+
77
+ def createExecutionOrderConstraint(self, short_name: str)-> ExecutionOrderConstraint:
78
+ if short_name not in self.elements:
79
+ constraint = ExecutionOrderConstraint(self, short_name)
80
+ self.elements[short_name] = constraint
81
+ self.timing_requirements.append(constraint)
82
+ return self.elements[short_name]
83
+
84
+ def getTimingRequirements(self) -> List[TimingConstraint]:
85
+ return self.timing_requirements
86
+
87
+ class SwcTiming(TimingExtension):
88
+ def __init__(self, parent: ARObject, short_name: str):
89
+ super().__init__(parent, short_name)
90
+
91
+
@@ -204,7 +204,7 @@ class AbstractARXMLParser:
204
204
  return None
205
205
 
206
206
  def getChildElementRefTypeList(self, element: ET.Element, key: str) -> List[RefType]:
207
- child_elements = element.findall("./xmlns:%s" % key, self.nsmap)
207
+ child_elements = self.findall(element, key)
208
208
  results = []
209
209
  for child_element in child_elements:
210
210
  ref = RefType()