armodel 1.2.0__py3-none-any.whl → 1.4.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 (54) hide show
  1. armodel/cli/arxml_dump_cli.py +8 -8
  2. armodel/cli/connector2xlsx_cli.py +75 -0
  3. armodel/cli/connector_update_cli.py +70 -0
  4. armodel/cli/swc_list_cli.py +81 -0
  5. armodel/lib/__init__.py +3 -0
  6. armodel/lib/cli_args_parser.py +36 -0
  7. armodel/lib/data_analyzer.py +34 -0
  8. armodel/lib/sw_component.py +34 -0
  9. armodel/models/__init__.py +6 -1
  10. armodel/models/ar_object.py +40 -1
  11. armodel/models/ar_package.py +35 -1
  12. armodel/models/ar_ref.py +12 -2
  13. armodel/models/bsw_module_template.py +3 -2
  14. armodel/models/calibration.py +16 -0
  15. armodel/models/common_structure.py +92 -0
  16. armodel/models/communication.py +8 -0
  17. armodel/models/datatype.py +23 -5
  18. armodel/models/general_structure.py +48 -3
  19. armodel/models/global_constraints.py +40 -0
  20. armodel/models/m2_msr.py +76 -2
  21. armodel/models/port_prototype.py +21 -16
  22. armodel/models/sw_component.py +49 -18
  23. armodel/models/unit.py +14 -0
  24. armodel/parser/arxml_parser.py +595 -151
  25. armodel/parser/excel_parser.py +0 -0
  26. armodel/report/__init__.py +1 -0
  27. armodel/report/connector_xls_report.py +76 -0
  28. armodel/report/excel_report.py +42 -0
  29. armodel/tests/__init__.py +0 -0
  30. armodel/tests/test_armodel/__init__.py +0 -0
  31. armodel/tests/test_armodel/models/__init__.py +0 -0
  32. armodel/tests/test_armodel/models/test_ar_package.py +294 -0
  33. armodel/tests/test_armodel/models/test_ar_ref.py +74 -0
  34. armodel/tests/test_armodel/models/test_bsw_module_template.py +46 -0
  35. armodel/tests/test_armodel/models/test_common_structure.py +73 -0
  36. armodel/tests/test_armodel/models/test_data_dictionary.py +29 -0
  37. armodel/tests/test_armodel/models/test_data_prototype.py +86 -0
  38. armodel/tests/test_armodel/models/test_datatype.py +239 -0
  39. armodel/tests/test_armodel/models/test_general_structure.py +50 -0
  40. armodel/tests/test_armodel/models/test_m2_msr.py +77 -0
  41. armodel/tests/test_armodel/models/test_port_interface.py +198 -0
  42. armodel/tests/test_armodel/models/test_port_prototype.py +14 -0
  43. armodel/tests/test_armodel/parser/__init__.py +0 -0
  44. armodel/tests/test_armodel/parser/test_parse_bswmd.py +168 -0
  45. armodel/writer/__init__.py +1 -0
  46. armodel/writer/arxml_writer.py +641 -0
  47. {armodel-1.2.0.dist-info → armodel-1.4.0.dist-info}/METADATA +69 -5
  48. armodel-1.4.0.dist-info/RECORD +60 -0
  49. {armodel-1.2.0.dist-info → armodel-1.4.0.dist-info}/WHEEL +1 -1
  50. armodel-1.4.0.dist-info/entry_points.txt +5 -0
  51. armodel-1.2.0.dist-info/RECORD +0 -27
  52. armodel-1.2.0.dist-info/entry_points.txt +0 -3
  53. {armodel-1.2.0.dist-info → armodel-1.4.0.dist-info}/LICENSE +0 -0
  54. {armodel-1.2.0.dist-info → armodel-1.4.0.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,9 @@
1
1
  from abc import ABCMeta
2
2
  from typing import List
3
- from .general_structure import ARElement, Referrable, ARObject
4
- from .data_prototype import ApplicationArrayElement, ApplicationRecordElement
3
+
4
+ from .ar_package import Referrable
5
+ from .general_structure import ARElement, ARObject
6
+ from .data_prototype import ApplicationRecordElement
5
7
  from .data_dictionary import SwDataDefProps
6
8
  from .common_structure import ImplementationDataTypeElement
7
9
 
@@ -14,11 +16,23 @@ class ImplementationProps(Referrable, metaclass=ABCMeta):
14
16
  super().__init__(parent, short_name)
15
17
  self.symbol = ""
16
18
 
17
-
18
19
  class SymbolProps(ImplementationProps):
19
20
  def __init__(self, parent: ARObject, short_name: str):
20
21
  super().__init__(parent, short_name)
21
22
 
23
+ class BaseTypeDefinition(ARObject):
24
+ def __init__(self):
25
+ super().__init__()
26
+
27
+ class BaseTypeDirectDefinition(BaseTypeDefinition):
28
+ def __init__(self):
29
+ super().__init__()
30
+
31
+ self.base_type_encoding = None
32
+ self.base_type_size = None # type: int
33
+ self.byte_order = None # type: str
34
+ self.mem_alignment = None
35
+ self.native_declaration = None
22
36
 
23
37
  class BaseType(ARElement, metaclass=ABCMeta):
24
38
  def __init__(self, parent: ARObject, short_name: str):
@@ -26,14 +40,13 @@ class BaseType(ARElement, metaclass=ABCMeta):
26
40
  raise NotImplementedError("BaseType is an abstract class.")
27
41
 
28
42
  super().__init__(parent, short_name)
29
- self.base_type_definition = None # Type: BaseTypeDefinition
30
43
 
44
+ self.base_type_definition = BaseTypeDirectDefinition()
31
45
 
32
46
  class SwBaseType(BaseType):
33
47
  def __init__(self, parent: ARObject, short_name: str):
34
48
  super().__init__(parent, short_name)
35
49
 
36
-
37
50
  class AtpType(ARElement, metaclass=ABCMeta):
38
51
  def __init__(self, parent: ARObject, short_name: str):
39
52
  if type(self) == AtpType:
@@ -84,12 +97,17 @@ class ApplicationRecordDataType(ApplicationCompositeDataType):
84
97
  def __init__(self, parent: ARObject, short_name: str):
85
98
  super().__init__(parent, short_name)
86
99
 
100
+ self.record_elements = []
101
+
87
102
  def createApplicationRecordElement(self, short_name: str) -> ApplicationRecordElement:
88
103
  if (short_name not in self.elements):
89
104
  record_element = ApplicationRecordElement(self, short_name)
90
105
  self.elements[short_name] = record_element
106
+ self.record_elements.append(self.elements[short_name])
91
107
  return self.elements[short_name]
92
108
 
109
+ def getApplicationRecordElements(self) -> List[ApplicationRecordElement]:
110
+ return self.record_elements
93
111
 
94
112
  class AbstractImplementationDataType(AutosarDataType, metaclass=ABCMeta):
95
113
  def __init__(self, parent: ARObject, short_name: str):
@@ -1,13 +1,52 @@
1
1
  from abc import ABCMeta
2
2
  from typing import List
3
+
3
4
  from .ar_object import ARObject
4
- from .ar_ref import RefType
5
5
 
6
6
 
7
+ class Sd(ARObject):
8
+ def __init__(self):
9
+ super().__init__()
10
+
11
+ self.gid = ""
12
+ self.value = ""
13
+
14
+ class Sdg(ARObject):
15
+ def __init__(self):
16
+ super().__init__()
17
+
18
+ self.gid = ""
19
+ self.sd = [] # type: List[Sd]
20
+ self.sdg_caption = None
21
+ self.sdg_contents_type = None
22
+
23
+ def addSd(self, sd: Sd):
24
+ self.sd.append(sd)
25
+
26
+ def getSds(self) -> List[Sd]:
27
+ return self.sd
28
+
29
+ class AdminData(ARObject):
30
+ def __init__(self):
31
+ super().__init__()
32
+
33
+ self.doc_revision = []
34
+ self.language = None
35
+ self.sdg = []
36
+ self.used_languages = None
37
+
38
+ def addSdg(self, sdg: Sdg):
39
+ self.sdg.append(sdg)
40
+
41
+ def getSdgs(self) -> List[Sdg]:
42
+ return self.sdg
43
+
7
44
  class Referrable(ARObject, metaclass=ABCMeta):
8
45
  def __init__(self, parent: ARObject, short_name: str):
9
46
  if type(self) == Referrable:
10
47
  raise NotImplementedError("Referrable is an abstract class.")
48
+ ARObject.__init__(self)
49
+
11
50
  self.parent = parent
12
51
  self.short_name = short_name
13
52
 
@@ -23,11 +62,15 @@ class MultilanguageReferrable(Referrable, metaclass=ABCMeta):
23
62
  self.parent = parent
24
63
  self.long_name = None
25
64
 
26
- class CollectableElement(metaclass=ABCMeta):
65
+ class CollectableElement(ARObject, metaclass=ABCMeta):
27
66
  def __init__(self):
28
67
  if type(self) == CollectableElement:
29
68
  raise NotImplementedError("CollectableElement is an abstract class.")
30
- self.elements = {} # type: dict(PackageableElement)
69
+ self.elements = {} # type: dict[str, PackageableElement]
70
+
71
+ def getTotalElement(self) -> int:
72
+ #return len(list(filter(lambda a: not isinstance(a, ARPackage) , self.elements.values())))
73
+ return len(self.elements.values())
31
74
 
32
75
  def getElements(self):
33
76
  return self.elements.values()
@@ -44,6 +87,7 @@ class Identifiable(MultilanguageReferrable, CollectableElement, metaclass=ABCMet
44
87
  MultilanguageReferrable.__init__(self, parent, short_name)
45
88
  CollectableElement.__init__(self)
46
89
 
90
+ self.admin_data = None # type: AdminData
47
91
  self._category = None
48
92
  self.desc = None
49
93
 
@@ -102,6 +146,7 @@ class ARElement(PackageableElement, metaclass=ABCMeta):
102
146
  if type(self) == ARElement:
103
147
  raise NotImplementedError("ARElement is an abstract class.")
104
148
  super().__init__(parent, short_name)
149
+
105
150
 
106
151
  class AtpStructureElement(AtpFeature, metaclass=ABCMeta):
107
152
  def __init__(self, parent: ARObject, short_name: str):
@@ -0,0 +1,40 @@
1
+ from .ar_ref import RefType
2
+ from .ar_object import ARObject
3
+ from .general_structure import Identifiable, Limit
4
+
5
+ from typing import List
6
+
7
+ class InternalConstrs(ARObject):
8
+ def __init__(self):
9
+ super().__init__()
10
+
11
+ self.lower_limit = None # type: Limit
12
+ self.upper_limit = None # type: Limit
13
+
14
+ class PhysConstrs(ARObject):
15
+ def __init__(self):
16
+ super().__init__()
17
+
18
+ self.lower_limit = None # type: Limit
19
+ self.upper_limit = None # type: Limit
20
+ self.unit_ref = None # type: RefType
21
+
22
+ class DataConstrRule(ARObject):
23
+ def __init__(self):
24
+ super().__init__()
25
+
26
+ self.constr_level = None # type: int
27
+ self.internal_constrs = None # type: InternalConstrs
28
+ self.phys_constrs = None # type: PhysConstrs
29
+
30
+ class DataConstr(Identifiable):
31
+ def __init__(self, parent: ARObject, short_name: str):
32
+ super().__init__(parent, short_name)
33
+
34
+ self.data_constr_rule = [] # type: List[DataConstrRule]
35
+
36
+ def addDataConstrRule(self, rule: DataConstrRule):
37
+ self.data_constr_rule.append(rule)
38
+
39
+ def getDataConstrRules(self) -> List[DataConstrRule]:
40
+ return self.data_constr_rule
armodel/models/m2_msr.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from .general_structure import ARObject, ARElement, Limit
2
+ from .ar_ref import RefType
2
3
  from abc import ABCMeta
3
4
  from typing import List
4
5
 
@@ -6,6 +7,7 @@ class CompuContent(ARObject, metaclass=ABCMeta):
6
7
  def __init__(self):
7
8
  if type(self) == CompuContent:
8
9
  raise NotImplementedError("CompuContent is an abstract class.")
10
+
9
11
  super().__init__()
10
12
 
11
13
  class Compu(ARObject):
@@ -18,28 +20,99 @@ class Compu(ARObject):
18
20
  '''optional'''
19
21
  self.compu_default_value = None # type: CompuConst
20
22
 
21
- class CompuConstContent(ARObject):
23
+ class CompuConstContent(ARObject, metaclass=ABCMeta):
24
+ '''
25
+ This meta-class represents the fact that the constant value of the computation method can be numerical or textual.
26
+ Base : ARObject
27
+ Subclasses : CompuConstFormulaContent, CompuConstNumericContent, CompuConstTextContent
28
+ Aggregated by : CompuConst.compuConstContentType
29
+ '''
22
30
  def __init__(self):
31
+ if type(self) == CompuConstContent:
32
+ raise NotImplementedError("CompuConstContent is an abstract class.")
33
+
23
34
  super().__init__()
24
35
 
25
36
  class CompuConstTextContent(CompuConstContent):
37
+ '''
38
+ This meta-class represents the textual content of a scale.
39
+ Base: ARObject, CompuConstContent
40
+ Aggregated by: CompuConst.compuConstContentType
41
+ '''
26
42
  def __init__(self):
27
43
  super().__init__()
28
44
 
29
45
  self.vt = None
30
46
 
31
47
  class CompuConstNumericContent(CompuConstContent):
48
+
32
49
  def __init__(self):
33
50
  super().__init__()
34
51
 
35
52
  self.v = None
36
53
 
37
54
  class CompuConst(ARObject):
55
+ '''
56
+ This meta-class represents the fact that the value of a computation method scale is constant.
57
+ Base : ARObject
58
+ Aggregated by : Compu.compuDefaultValue, CompuScale.compuInverseValue, CompuScaleConstantContents.compuCons
59
+ '''
38
60
  def __init__(self):
39
61
  super().__init__()
40
62
 
41
63
  self.compu_const_content_type = None # type: CompuConstContent
42
64
 
65
+ class CompuScaleContents(ARObject, metaclass=ABCMeta):
66
+ def __init__(self):
67
+ if type(self) == CompuScaleContents:
68
+ raise NotImplementedError("CompuScaleContents is an abstract class.")
69
+
70
+ super().__init__()
71
+
72
+ class CompuScaleConstantContents(CompuScaleContents):
73
+ def __init__(self):
74
+ super().__init__()
75
+
76
+ self.compu_const = None # type: CompuConst
77
+
78
+ class CompuScaleRationalFormula(CompuScaleContents):
79
+ '''
80
+ This meta-class represents the fact that the computation in this scale is represented as rational term.
81
+ '''
82
+ def __init__(self):
83
+ super().__init__()
84
+
85
+ self.compu_rational_coeffs = None # type: CompuRationalCoeffs
86
+
87
+ class CompuNominatorDenominator(ARObject):
88
+ '''
89
+ This class represents the ability to express a polynomial either as Nominator or as Denominator.
90
+ Base : ARObject
91
+ Aggregated by : CompuRationalCoeffs.compuDenominator, CompuRationalCoeffs.compuNumerator
92
+ '''
93
+ def __init__(self):
94
+ super().__init__()
95
+
96
+ self.v = [] # type List[float]
97
+
98
+ def add_v(self, v: float):
99
+ self.v.append(v)
100
+
101
+ def get_vs(self) -> List[float]:
102
+ return self.v
103
+
104
+ class CompuRationalCoeffs(ARObject):
105
+ '''
106
+ This meta-class represents the ability to express a rational function by specifying the coefficients of nominator and denominator.
107
+ Base : ARObject
108
+ Aggregated by : CompuScaleRationalFormula.compuRationalCoeffs
109
+ '''
110
+ def __init__(self):
111
+ super().__init__()
112
+
113
+ self.compu_denominator = None # type: CompuNominatorDenominator
114
+ self.compu_numerator = None # type: CompuNominatorDenominator
115
+
43
116
  class CompuScale(Compu):
44
117
  def __init__(self):
45
118
  super().__init__()
@@ -69,4 +142,5 @@ class CompuMethod(ARElement):
69
142
 
70
143
  self.compu_internal_to_phys = None # type: Compu
71
144
  self.compu_phys_to_internal = None # type: Compu
72
- self.display_format = None # type: DisplayFormatString
145
+ self.display_format = None # type: DisplayFormatString
146
+ self.unit_ref = None # type: RefType
@@ -1,6 +1,10 @@
1
- from typing import List, Dict
1
+ from typing import List
2
+
3
+ from .data_dictionary import SwDataDefProps
2
4
  from .general_structure import ARObject, Identifiable
3
5
  from .ar_ref import RefType, TRefType
6
+ from .communication import TransmissionAcknowledgementRequest
7
+ from .common_structure import ValueSpecification
4
8
 
5
9
  from abc import ABCMeta
6
10
 
@@ -68,9 +72,10 @@ class ReceiverComSpec(RPortComSpec):
68
72
  super().__init__()
69
73
 
70
74
  self.data_element_ref = None # type: RefType
71
- self.handle_out_of_range = ""
72
- self.uses_end_to_end_protection = False
73
-
75
+ self.network_representation = None # type: SwDataDefProps
76
+ self.handle_out_of_range = None # type: HandleOutOfRangeStatusEnum
77
+ self.uses_end_to_end_protection = False
78
+
74
79
 
75
80
  class ModeSwitchSenderComSpec(RPortComSpec):
76
81
  def __init__(self):
@@ -87,11 +92,12 @@ class SenderComSpec(PPortComSpec):
87
92
 
88
93
  def __init__(self):
89
94
  super().__init__()
90
- self.data_element_ref = None # type: RefType
95
+ self.data_element_ref = None # type: RefType
96
+ self.network_representation = None # type: SwDataDefProps
91
97
  self.handle_out_of_range = ""
98
+ self.transmission_acknowledge = None # type: TransmissionAcknowledgementRequest
92
99
  self.uses_end_to_end_protection = False
93
100
 
94
-
95
101
  class QueuedSenderComSpec(PPortComSpec):
96
102
  def __init__(self):
97
103
  super().__init__()
@@ -116,12 +122,12 @@ class NonqueuedReceiverComSpec(ReceiverComSpec):
116
122
 
117
123
  self.alive_timeout = 0
118
124
  self.enable_updated = False
119
- self.filter = None # type: DataFilter
120
- self.handle_data_status = None # type: boolean
125
+ self.filter = None # type: DataFilter
126
+ self.handle_data_status = None # type: bool
121
127
  self.handle_never_received = False
122
128
  self.handel_timeout_type = ""
123
- self.init_value = None # type: ValueSpecification
124
- self.timeout_substitution = None # type: ValueSpecification
129
+ self.init_value = None # type: ValueSpecification
130
+ self.timeout_substitution = None # type: ValueSpecification
125
131
 
126
132
  class QueuedReceiverComSpec(ReceiverComSpec):
127
133
  def __init__(self):
@@ -134,12 +140,11 @@ class PortPrototype(Identifiable):
134
140
  def __init__(self, parent: ARObject, short_name: str):
135
141
  super().__init__(parent, short_name)
136
142
 
137
-
138
143
  class AbstractProvidedPortPrototype(PortPrototype):
139
144
  def __init__(self, parent: ARObject, short_name: str):
140
145
  super().__init__(parent, short_name)
141
146
 
142
- self.provided_com_specs = [] # type: Dict[PPortComSpec]
147
+ self.provided_com_specs = [] # type: List[PPortComSpec]
143
148
 
144
149
  def _validateRPortComSpec(self, com_spec: PPortComSpec):
145
150
  if (isinstance(com_spec, NonqueuedSenderComSpec)):
@@ -160,14 +165,14 @@ class AbstractProvidedPortPrototype(PortPrototype):
160
165
  return self.provided_com_specs
161
166
 
162
167
  def getNonqueuedSenderComSpecs(self) -> List[NonqueuedSenderComSpec]:
163
- return list(filter(lambda c: isinstance(c, NonqueuedSenderComSpec), self.provided_com_specs))
168
+ return filter(lambda c: isinstance(c, NonqueuedSenderComSpec), self.provided_com_specs)
164
169
 
165
170
 
166
171
  class AbstractRequiredPortPrototype(PortPrototype):
167
172
  def __init__(self, parent: ARObject, short_name: str):
168
173
  super().__init__(parent, short_name)
169
174
 
170
- self.required_com_specs = [] # type: Dict[RPortComSpec]
175
+ self.required_com_specs = [] # type: List[RPortComSpec]
171
176
 
172
177
  def _validateRPortComSpec(self, com_spec: RPortComSpec):
173
178
  if (isinstance(com_spec, ClientComSpec)):
@@ -194,10 +199,10 @@ class AbstractRequiredPortPrototype(PortPrototype):
194
199
  return self.required_com_specs
195
200
 
196
201
  def getClientComSpecs(self) -> List[ClientComSpec]:
197
- return list(filter(lambda c: isinstance(c, ClientComSpec), self.required_com_specs))
202
+ return filter(lambda c: isinstance(c, ClientComSpec), self.required_com_specs)
198
203
 
199
204
  def getNonqueuedReceiverComSpecs(self) -> List[NonqueuedReceiverComSpec]:
200
- return list(filter(lambda c: isinstance(c, NonqueuedReceiverComSpec), self.required_com_specs))
205
+ return filter(lambda c: isinstance(c, NonqueuedReceiverComSpec), self.required_com_specs)
201
206
 
202
207
 
203
208
  class PPortPrototype(AbstractProvidedPortPrototype):
@@ -1,9 +1,10 @@
1
1
  from typing import List, Dict
2
2
  from abc import ABCMeta
3
3
  from .general_structure import ARElement, Identifiable, ARObject
4
- from .ar_ref import AutosarVariableRef, RefType, POperationInAtomicSwcInstanceRef, ROperationInAtomicSwcInstanceRef, ProvidedPortPrototypeInstanceRef
5
- from .ar_ref import RequiredPortPrototypeInstanceRef, RVariableInAtomicSwcInstanceRef, RModeInAtomicSwcInstanceRef
6
- from .port_prototype import RPortPrototype, PPortPrototype
4
+ from .ar_ref import AutosarVariableRef, RefType, POperationInAtomicSwcInstanceRef, ROperationInAtomicSwcInstanceRef
5
+ from .ar_ref import PortInCompositionTypeInstanceRef, PPortInCompositionInstanceRef, RPortInCompositionInstanceRef
6
+ from .ar_ref import RVariableInAtomicSwcInstanceRef, RModeInAtomicSwcInstanceRef
7
+ from .port_prototype import RPortPrototype, PPortPrototype, PortPrototype
7
8
  from .data_prototype import VariableDataPrototype
8
9
  from .common_structure import ExecutableEntity, InternalBehavior
9
10
 
@@ -11,6 +12,8 @@ class VariableAccess(Identifiable):
11
12
  def __init__(self, parent: ARObject, short_name):
12
13
  super().__init__(parent, short_name)
13
14
  self.accessed_variable_ref = AutosarVariableRef()
15
+ self.accessed_variable_ref.parent = self
16
+ self.parent = parent
14
17
  self.local_variable_ref = None # type: RefType
15
18
 
16
19
  class ExecutableEntity(Identifiable):
@@ -319,23 +322,33 @@ class SwComponentType(ARElement):
319
322
  def __init__(self, parent: ARObject, short_name: str):
320
323
  super().__init__(parent, short_name)
321
324
 
325
+ self.ports = [] # List[PortPrototype]
326
+
322
327
  def createPPortPrototype(self, short_name: str) -> PPortPrototype:
328
+ prototype = PPortPrototype(self, short_name)
329
+ self.ports.append(prototype)
323
330
  if (short_name not in self.elements):
324
- prototype = PPortPrototype(self, short_name)
325
331
  self.elements[short_name] = prototype
326
332
  return self.elements[short_name]
327
333
 
328
334
  def createRPortPrototype(self, short_name) -> RPortPrototype:
335
+ prototype = RPortPrototype(self, short_name)
336
+ self.ports.append(prototype)
329
337
  if (short_name not in self.elements):
330
- prototype = RPortPrototype(self, short_name)
331
338
  self.elements[short_name] = prototype
332
339
  return self.elements[short_name]
333
340
 
334
341
  def getPPortPrototypes(self) -> List[PPortPrototype]:
335
- return list(filter(lambda c: isinstance(c, PPortPrototype), self.elements.values()))
342
+ #return list(sorted(filter(lambda c: isinstance(c, PPortPrototype), self.elements.values()), key= lambda o: o.short_name))
343
+ return list(sorted(filter(lambda c: isinstance(c, PPortPrototype), self.ports), key= lambda o: o.short_name))
336
344
 
337
345
  def getRPortPrototypes(self) -> List[RPortPrototype]:
338
- return list(filter(lambda c: isinstance(c, RPortPrototype), self.elements.values()))
346
+ #return list(sorted(filter(lambda c: isinstance(c, RPortPrototype), self.elements.values()), key= lambda o: o.short_name))
347
+ return list(sorted(filter(lambda c: isinstance(c, RPortPrototype), self.ports), key= lambda o: o.short_name))
348
+
349
+ def getPortPrototype(self) -> List[PortPrototype]:
350
+ #return list(sorted(filter(lambda c: isinstance(c, PortPrototype), self.elements.values()), key= lambda o: o.short_name))
351
+ return list(sorted(self.ports, key= lambda o: o.short_name))
339
352
 
340
353
  class AtomicSwComponentType(SwComponentType):
341
354
  __metaclass__ = ABCMeta
@@ -395,22 +408,22 @@ class AssemblySwConnector(SwConnector):
395
408
  def __init__(self, parent: ARObject, short_name: str):
396
409
  super().__init__(parent, short_name)
397
410
 
398
- self.provider_iref = None # type: ProvidedPortPrototypeInstanceRef
399
- self.requester_iref = None # type: RequiredPortPrototypeInstanceRef
411
+ self.provider_iref = None # type: PPortInCompositionInstanceRef
412
+ self.requester_iref = None # type: RPortInCompositionInstanceRef
400
413
 
401
414
  class DelegationSwConnector(SwConnector):
402
415
  def __init__(self, parent: ARObject, short_name: str):
403
416
  super().__init__(parent, short_name)
404
417
 
405
- self.inner_port_iref = None # type: RefType
406
- self.outer_port_iref = None # type: RefType
418
+ self.inner_port_iref = None # type: PortInCompositionInstanceRef
419
+ self.outer_port_ref = None # type: RefType
407
420
 
408
421
  class PassThroughSwConnector(SwConnector):
409
422
  def __init__(self, parent: ARObject, short_name: str):
410
423
  super().__init__(parent, short_name)
411
424
 
412
- self.provided_outer_port_iref = None # type: RefType
413
- self.required_outer_port_iref = None # type: RefType
425
+ self.provided_outer_port_ref = None # type: RefType
426
+ self.required_outer_port_ref = None # type: RefType
414
427
 
415
428
  class SwComponentPrototype(Identifiable):
416
429
  def __init__(self, parent: ARObject, short_name: str):
@@ -423,18 +436,30 @@ class CompositionSwComponentType(SwComponentType):
423
436
  super().__init__(parent, short_name)
424
437
 
425
438
  self.constant_value_mapping_refs = [] # type: List[RefType]
426
- self.data_type_mapping_refs = [] # type: List[RefType]
439
+ self._data_type_mapping_refs = [] # type: List[RefType]
427
440
  self.instantiation_rte_event_props = [] # type: List[InstantiationRTEEventProps]
428
441
 
429
442
  def createAssemblySwConnector(self, short_name: str) -> AssemblySwConnector:
430
443
  if (short_name not in self.elements):
431
444
  connector = AssemblySwConnector(self, short_name)
432
445
  self.elements[short_name] = connector
433
- return self.elements[short_name]
446
+ return self.elements[short_name]
447
+
448
+ def createDelegationSwConnector(self, short_name: str) -> DelegationSwConnector:
449
+ if short_name not in self.elements:
450
+ connector = DelegationSwConnector(self, short_name)
451
+ self.elements[short_name] = connector
452
+ return self.elements[short_name]
434
453
 
435
454
  def getAssemblySwConnectors(self) -> List[AssemblySwConnector]:
436
- return list(filter(lambda e: isinstance(e, AssemblySwConnector), self.elements.values()))
437
-
455
+ return list(sorted(filter(lambda e: isinstance(e, AssemblySwConnector), self.elements.values()), key = lambda c: c.short_name))
456
+
457
+ def getDelegationSwConnectors(self) -> List[DelegationSwConnector]:
458
+ return list(sorted(filter(lambda e: isinstance(e, DelegationSwConnector), self.elements.values()), key = lambda c: c.short_name))
459
+
460
+ def getSwConnectors(self) -> List[SwConnector]:
461
+ return list(sorted(filter(lambda e: isinstance(e, SwConnector), self.elements.values()), key = lambda c: c.short_name))
462
+
438
463
  def createSwComponentPrototype(self, short_name: str) -> SwComponentPrototype:
439
464
  if (short_name not in self.elements):
440
465
  connector = SwComponentPrototype(self, short_name)
@@ -442,4 +467,10 @@ class CompositionSwComponentType(SwComponentType):
442
467
  return self.elements[short_name]
443
468
 
444
469
  def getSwComponentPrototypes(self) -> List[SwComponentPrototype]:
445
- return list(filter(lambda e: isinstance(e, SwComponentPrototype), self.elements.values()))
470
+ return list(filter(lambda e: isinstance(e, SwComponentPrototype), self.elements.values()))
471
+
472
+ def addDataTypeMapping(self, data_type_mapping_ref: RefType):
473
+ self._data_type_mapping_refs.append(data_type_mapping_ref)
474
+
475
+ def getDataTypeMappings(self) -> List[RefType]:
476
+ return self._data_type_mapping_refs
armodel/models/unit.py ADDED
@@ -0,0 +1,14 @@
1
+
2
+ from .ar_object import ARLiteral, ARObject
3
+ from .general_structure import ARElement
4
+
5
+
6
+ class SingleLanguageUnitNames(ARLiteral):
7
+ def __init__(self) -> None:
8
+ super().__init__()
9
+
10
+ class Unit(ARElement):
11
+ def __init__(self, parent: ARObject, short_name: str):
12
+ super().__init__(parent, short_name)
13
+
14
+ self.display_name = None # type: SingleLanguageUnitNames