armodel 1.3.0__py3-none-any.whl → 1.4.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.
- armodel/__init__.py +2 -1
- armodel/cli/arxml_dump_cli.py +8 -6
- armodel/cli/arxml_format_cli.py +72 -0
- armodel/cli/connector2xlsx_cli.py +75 -0
- armodel/cli/connector_update_cli.py +77 -0
- armodel/cli/swc_list_cli.py +2 -2
- armodel/data_models/__init__.py +0 -0
- armodel/data_models/sw_connector.py +22 -0
- armodel/lib/__init__.py +1 -1
- armodel/lib/sw_component.py +34 -0
- armodel/models/__init__.py +8 -2
- armodel/models/annotation.py +20 -0
- armodel/models/ar_object.py +184 -0
- armodel/models/ar_package.py +144 -14
- armodel/models/ar_ref.py +74 -8
- armodel/models/bsw_module_template.py +97 -25
- armodel/models/calibration.py +119 -0
- armodel/models/common_structure.py +203 -36
- armodel/models/communication.py +17 -0
- armodel/models/data_def_properties.py +16 -0
- armodel/models/data_dictionary.py +46 -9
- armodel/models/data_prototype.py +24 -5
- armodel/models/datatype.py +86 -19
- armodel/models/end_to_end_protection.py +67 -0
- armodel/models/general_structure.py +72 -17
- armodel/models/global_constraints.py +40 -0
- armodel/models/implementation.py +80 -32
- armodel/models/m2_msr.py +82 -6
- armodel/models/multilanguage_data.py +42 -0
- armodel/models/per_instance_memory.py +14 -0
- armodel/models/port_interface.py +27 -4
- armodel/models/port_prototype.py +48 -23
- armodel/models/record_layout.py +118 -0
- armodel/models/service_mapping.py +11 -0
- armodel/models/service_needs.py +48 -0
- armodel/models/sw_component.py +257 -43
- armodel/models/unit.py +14 -0
- armodel/parser/abstract_arxml_parser.py +248 -0
- armodel/parser/arxml_parser.py +1550 -648
- armodel/parser/connector_xlsx_parser.py +190 -0
- armodel/parser/excel_parser.py +18 -0
- armodel/report/__init__.py +1 -0
- armodel/report/connector_xls_report.py +76 -0
- armodel/report/excel_report.py +42 -0
- armodel/tests/__init__.py +0 -0
- armodel/tests/test_armodel/__init__.py +0 -0
- armodel/tests/test_armodel/models/__init__.py +0 -0
- armodel/tests/test_armodel/models/test_ar_object.py +152 -0
- armodel/tests/test_armodel/models/test_ar_package.py +294 -0
- armodel/tests/test_armodel/models/test_ar_ref.py +74 -0
- armodel/tests/test_armodel/models/test_bsw_module_template.py +46 -0
- armodel/tests/test_armodel/models/test_common_structure.py +73 -0
- armodel/tests/test_armodel/models/test_data_dictionary.py +29 -0
- armodel/tests/test_armodel/models/test_data_prototype.py +86 -0
- armodel/tests/test_armodel/models/test_datatype.py +239 -0
- armodel/tests/test_armodel/models/test_general_structure.py +50 -0
- armodel/tests/test_armodel/models/test_implementation.py +26 -0
- armodel/tests/test_armodel/models/test_m2_msr.py +77 -0
- armodel/tests/test_armodel/models/test_port_interface.py +198 -0
- armodel/tests/test_armodel/models/test_port_prototype.py +14 -0
- armodel/tests/test_armodel/parser/__init__.py +0 -0
- armodel/tests/test_armodel/parser/test_arxml_parser.py +15 -0
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +192 -0
- armodel/tests/test_armodel/parser/test_sw_components.py +93 -0
- armodel/writer/__init__.py +1 -0
- armodel/writer/abstract_arxml_writer.py +123 -0
- armodel/writer/arxml_writer.py +1755 -0
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/METADATA +124 -4
- armodel-1.4.3.dist-info/RECORD +78 -0
- armodel-1.4.3.dist-info/entry_points.txt +7 -0
- armodel-1.3.0.dist-info/RECORD +0 -31
- armodel-1.3.0.dist-info/entry_points.txt +0 -4
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/LICENSE +0 -0
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/WHEEL +0 -0
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/top_level.txt +0 -0
armodel/models/ar_package.py
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
|
-
from typing import List
|
|
1
|
+
from typing import Dict, List
|
|
2
|
+
|
|
3
|
+
from .data_dictionary import SwAddrMethod
|
|
4
|
+
from .record_layout import SwRecordLayout
|
|
5
|
+
from .end_to_end_protection import EndToEndProtectionSet
|
|
6
|
+
from .unit import Unit
|
|
2
7
|
from .general_structure import Identifiable, ARObject, Referrable, CollectableElement, SwcBswMapping
|
|
3
|
-
from .port_interface import SenderReceiverInterface, ClientServerInterface
|
|
4
|
-
from .sw_component import SwComponentType, EcuAbstractionSwComponentType, AtomicSwComponentType, ApplicationSwComponentType
|
|
5
|
-
from .
|
|
8
|
+
from .port_interface import ModeSwitchInterface, SenderReceiverInterface, ClientServerInterface, TriggerInterface
|
|
9
|
+
from .sw_component import SwComponentType, EcuAbstractionSwComponentType, AtomicSwComponentType, ApplicationSwComponentType
|
|
10
|
+
from .sw_component import ServiceSwComponentType, CompositionSwComponentType, SensorActuatorSwComponentType, ComplexDeviceDriverSwComponentType
|
|
11
|
+
from .datatype import ApplicationArrayDataType, ImplementationDataType, ApplicationDataType, DataTypeMappingSet, DataTypeMap, SwBaseType, ApplicationPrimitiveDataType, ApplicationRecordDataType
|
|
6
12
|
from .m2_msr import CompuMethod
|
|
13
|
+
from .common_structure import ConstantSpecification, ModeDeclarationGroup
|
|
7
14
|
from .implementation import BswImplementation, SwcImplementation, Implementation
|
|
8
15
|
from .bsw_module_template import BswModuleDescription, BswModuleEntry
|
|
16
|
+
from .global_constraints import DataConstr
|
|
9
17
|
|
|
10
18
|
class ARPackage(Identifiable, CollectableElement):
|
|
11
19
|
def __init__(self, parent: ARObject, short_name: str):
|
|
12
20
|
Identifiable.__init__(self, parent, short_name)
|
|
13
21
|
CollectableElement.__init__(self)
|
|
14
22
|
|
|
23
|
+
self._ar_packages = {} # type: Dict[str, ARPackage]
|
|
24
|
+
|
|
15
25
|
def getARPackages(self): # type: (...) -> List[ARPackage]
|
|
16
|
-
return list(
|
|
26
|
+
return list(sorted(self._ar_packages.values(), key= lambda a: a.short_name))
|
|
27
|
+
#return list(filter(lambda e: isinstance(e, ARPackage), self.elements.values()))
|
|
17
28
|
|
|
18
29
|
def createARPackage(self, short_name: str):
|
|
30
|
+
'''
|
|
19
31
|
if (short_name not in self.elements):
|
|
20
32
|
ar_package = ARPackage(self, short_name)
|
|
21
33
|
self.elements[short_name] = ar_package
|
|
22
34
|
return self.elements[short_name]
|
|
35
|
+
'''
|
|
36
|
+
if short_name not in self._ar_packages:
|
|
37
|
+
ar_package = ARPackage(self, short_name)
|
|
38
|
+
self._ar_packages[short_name] = ar_package
|
|
39
|
+
return self._ar_packages[short_name]
|
|
40
|
+
|
|
41
|
+
def getElement(self, short_name: str) -> Referrable:
|
|
42
|
+
if (short_name in self._ar_packages):
|
|
43
|
+
return self._ar_packages[short_name]
|
|
44
|
+
return CollectableElement.getElement(self, short_name)
|
|
23
45
|
|
|
24
46
|
def createEcuAbstractionSwComponentType(self, short_name: str) -> EcuAbstractionSwComponentType:
|
|
25
47
|
if (short_name not in self.elements):
|
|
@@ -28,10 +50,16 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
28
50
|
return self.elements[short_name]
|
|
29
51
|
|
|
30
52
|
def createApplicationSwComponentType(self, short_name: str) -> ApplicationSwComponentType:
|
|
31
|
-
if
|
|
53
|
+
if short_name not in self.elements:
|
|
32
54
|
sw_component = ApplicationSwComponentType(self, short_name)
|
|
33
55
|
self.elements[short_name] = sw_component
|
|
34
56
|
return self.elements[short_name]
|
|
57
|
+
|
|
58
|
+
def createComplexDeviceDriverSwComponentType(self, short_name: str) -> ComplexDeviceDriverSwComponentType:
|
|
59
|
+
if short_name not in self.elements:
|
|
60
|
+
sw_component = ComplexDeviceDriverSwComponentType(self, short_name)
|
|
61
|
+
self.elements[short_name] = sw_component
|
|
62
|
+
return self.elements[short_name]
|
|
35
63
|
|
|
36
64
|
def createServiceSwComponentType(self, short_name: str) -> ServiceSwComponentType:
|
|
37
65
|
if (short_name not in self.elements):
|
|
@@ -128,9 +156,72 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
128
156
|
sw_component = SwcBswMapping(self, short_name)
|
|
129
157
|
self.elements[short_name] = sw_component
|
|
130
158
|
return self.elements[short_name]
|
|
159
|
+
|
|
160
|
+
def createConstantSpecification(self, short_name: str) -> ConstantSpecification:
|
|
161
|
+
if (short_name not in self.elements):
|
|
162
|
+
spec = ConstantSpecification(self, short_name)
|
|
163
|
+
self.elements[short_name] = spec
|
|
164
|
+
return self.elements[short_name]
|
|
165
|
+
|
|
166
|
+
def createDataConstr(self, short_name: str) -> DataConstr:
|
|
167
|
+
if (short_name not in self.elements):
|
|
168
|
+
spec = DataConstr(self, short_name)
|
|
169
|
+
self.elements[short_name] = spec
|
|
170
|
+
return self.elements[short_name]
|
|
171
|
+
|
|
172
|
+
def createUnit(self, short_name: str) -> Unit:
|
|
173
|
+
if (short_name not in self.elements):
|
|
174
|
+
spec = Unit(self, short_name)
|
|
175
|
+
self.elements[short_name] = spec
|
|
176
|
+
return self.elements[short_name]
|
|
177
|
+
|
|
178
|
+
def createEndToEndProtectionSet(self, short_name: str) -> EndToEndProtectionSet:
|
|
179
|
+
if (short_name not in self.elements):
|
|
180
|
+
spec = EndToEndProtectionSet(self, short_name)
|
|
181
|
+
self.elements[short_name] = spec
|
|
182
|
+
return self.elements[short_name]
|
|
183
|
+
|
|
184
|
+
def createApplicationArrayDataType(self, short_name: str) -> ApplicationArrayDataType:
|
|
185
|
+
if (short_name not in self.elements):
|
|
186
|
+
spec = ApplicationArrayDataType(self, short_name)
|
|
187
|
+
self.elements[short_name] = spec
|
|
188
|
+
return self.elements[short_name]
|
|
189
|
+
|
|
190
|
+
def createSwRecordLayout(self, short_name: str) -> SwRecordLayout:
|
|
191
|
+
if (short_name not in self.elements):
|
|
192
|
+
spec = SwRecordLayout(self, short_name)
|
|
193
|
+
self.elements[short_name] = spec
|
|
194
|
+
return self.elements[short_name]
|
|
195
|
+
|
|
196
|
+
def createSwAddrMethod(self, short_name: str) -> SwAddrMethod:
|
|
197
|
+
if (short_name not in self.elements):
|
|
198
|
+
spec = SwAddrMethod(self, short_name)
|
|
199
|
+
self.elements[short_name] = spec
|
|
200
|
+
return self.elements[short_name]
|
|
201
|
+
|
|
202
|
+
def createTriggerInterface(self, short_name: str) -> TriggerInterface:
|
|
203
|
+
if (short_name not in self.elements):
|
|
204
|
+
spec = TriggerInterface(self, short_name)
|
|
205
|
+
self.elements[short_name] = spec
|
|
206
|
+
return self.elements[short_name]
|
|
207
|
+
|
|
208
|
+
def createModeDeclarationGroup(self, short_name: str) -> ModeDeclarationGroup:
|
|
209
|
+
if (short_name not in self.elements):
|
|
210
|
+
spec = ModeDeclarationGroup(self, short_name)
|
|
211
|
+
self.elements[short_name] = spec
|
|
212
|
+
return self.elements[short_name]
|
|
213
|
+
|
|
214
|
+
def createModeSwitchInterface(self, short_name: str) -> ModeSwitchInterface:
|
|
215
|
+
if (short_name not in self.elements):
|
|
216
|
+
spec = ModeSwitchInterface(self, short_name)
|
|
217
|
+
self.elements[short_name] = spec
|
|
218
|
+
return self.elements[short_name]
|
|
131
219
|
|
|
132
220
|
def getApplicationPrimitiveDataTypes(self) -> List[ApplicationPrimitiveDataType]:
|
|
133
221
|
return list(filter(lambda a: isinstance(a, ApplicationPrimitiveDataType), self.elements.values()))
|
|
222
|
+
|
|
223
|
+
def getApplicationDataType(self) -> List[ApplicationDataType]:
|
|
224
|
+
return list(sorted(filter(lambda a: isinstance(a, ApplicationDataType), self.elements.values()), key= lambda o:o.short_name))
|
|
134
225
|
|
|
135
226
|
def getImplementationDataTypes(self) -> List[ImplementationDataType]:
|
|
136
227
|
return list(filter(lambda a: isinstance(a, ImplementationDataType), self.elements.values()))
|
|
@@ -149,6 +240,9 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
149
240
|
|
|
150
241
|
def getCompositionSwComponentTypes(self) -> List[CompositionSwComponentType]:
|
|
151
242
|
return list(filter(lambda a : isinstance(a, CompositionSwComponentType), self.elements.values()))
|
|
243
|
+
|
|
244
|
+
def getComplexDeviceDriverSwComponentTypes(self) -> List[ComplexDeviceDriverSwComponentType]:
|
|
245
|
+
return list(sorted(filter(lambda a : isinstance(a, ComplexDeviceDriverSwComponentType), self.elements.values()), key = lambda a: a.short_name))
|
|
152
246
|
|
|
153
247
|
def getSenderReceiverInterfaces(self) -> List[SenderReceiverInterface]:
|
|
154
248
|
return list(filter(lambda a : isinstance(a, SenderReceiverInterface), self.elements.values()))
|
|
@@ -179,8 +273,35 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
179
273
|
|
|
180
274
|
def getSwcBswMappings(self) -> List[SwcBswMapping]:
|
|
181
275
|
return list(filter(lambda a: isinstance(a, SwcBswMapping), self.elements.values()))
|
|
276
|
+
|
|
277
|
+
def getConstantSpecifications(self) -> List[ConstantSpecification]:
|
|
278
|
+
return list(filter(lambda a: isinstance(a, ConstantSpecification), self.elements.values()))
|
|
279
|
+
|
|
280
|
+
def getDataConstrs(self) -> List[DataConstr]:
|
|
281
|
+
return list(filter(lambda a: isinstance(a, DataConstr), self.elements.values()))
|
|
282
|
+
|
|
283
|
+
def getUnits(self) -> List[Unit]:
|
|
284
|
+
return list(filter(lambda a: isinstance(a, Unit), self.elements.values()))
|
|
285
|
+
|
|
286
|
+
def getApplicationArrayDataTypes(self) -> List[ApplicationArrayDataType]:
|
|
287
|
+
return list(sorted(filter(lambda a : isinstance(a, ApplicationArrayDataType), self.elements.values()), key = lambda a: a.short_name))
|
|
288
|
+
|
|
289
|
+
def getSwRecordLayouts(self) -> List[SwRecordLayout]:
|
|
290
|
+
return list(sorted(filter(lambda a : isinstance(a, SwRecordLayout), self.elements.values()), key = lambda a: a.short_name))
|
|
182
291
|
|
|
183
|
-
|
|
292
|
+
def getSwAddrMethods(self) -> List[SwAddrMethod]:
|
|
293
|
+
return list(sorted(filter(lambda a : isinstance(a, SwAddrMethod), self.elements.values()), key = lambda a: a.short_name))
|
|
294
|
+
|
|
295
|
+
def getTriggerInterfaces(self) -> List[TriggerInterface]:
|
|
296
|
+
return list(sorted(filter(lambda a : isinstance(a, TriggerInterface), self.elements.values()), key = lambda a: a.short_name))
|
|
297
|
+
|
|
298
|
+
def getModeDeclarationGroups(self) -> List[ModeDeclarationGroup]:
|
|
299
|
+
return list(sorted(filter(lambda a : isinstance(a, ModeDeclarationGroup), self.elements.values()), key = lambda a: a.short_name))
|
|
300
|
+
|
|
301
|
+
def getModeSwitchInterfaces(self) -> List[ModeSwitchInterface]:
|
|
302
|
+
return list(sorted(filter(lambda a : isinstance(a, ModeSwitchInterface), self.elements.values()), key = lambda a: a.short_name))
|
|
303
|
+
|
|
304
|
+
class AUTOSAR (CollectableElement):
|
|
184
305
|
__instance = None
|
|
185
306
|
|
|
186
307
|
@staticmethod
|
|
@@ -194,26 +315,35 @@ class AUTOSAR (ARObject, CollectableElement):
|
|
|
194
315
|
raise Exception("The AUTOSAR is singleton!")
|
|
195
316
|
CollectableElement.__init__(self)
|
|
196
317
|
|
|
197
|
-
self.
|
|
318
|
+
self.schema_location = ""
|
|
198
319
|
self._appl_impl_type_maps = {}
|
|
199
320
|
self._impl_appl_type_maps = {}
|
|
200
321
|
AUTOSAR.__instance = self
|
|
201
322
|
|
|
323
|
+
self._ar_packages = {} # type: Dict[str, ARPackage]
|
|
324
|
+
|
|
202
325
|
@property
|
|
203
326
|
def full_name(self):
|
|
204
327
|
return ""
|
|
205
328
|
|
|
206
329
|
def clear(self):
|
|
330
|
+
self._ar_packages = {}
|
|
207
331
|
self.elements = {}
|
|
208
332
|
|
|
333
|
+
def getElement(self, short_name: str) -> Referrable:
|
|
334
|
+
if (short_name in self._ar_packages):
|
|
335
|
+
return self._ar_packages[short_name]
|
|
336
|
+
return CollectableElement.getElement(self, short_name)
|
|
337
|
+
|
|
209
338
|
def getARPackages(self) -> List[ARPackage]:
|
|
210
|
-
return list(filter(lambda e: isinstance(e, ARPackage), self.elements.values()))
|
|
339
|
+
#return list(filter(lambda e: isinstance(e, ARPackage), self.elements.values()))
|
|
340
|
+
return list(sorted(self._ar_packages.values(), key= lambda a: a.short_name))
|
|
211
341
|
|
|
212
342
|
def createARPackage(self, short_name: str) -> ARPackage:
|
|
213
|
-
if (short_name not in self.
|
|
343
|
+
if (short_name not in self._ar_packages):
|
|
214
344
|
ar_package = ARPackage(self, short_name)
|
|
215
|
-
self.
|
|
216
|
-
return self.
|
|
345
|
+
self._ar_packages[short_name] = ar_package
|
|
346
|
+
return self._ar_packages[short_name]
|
|
217
347
|
|
|
218
348
|
def find(self, referred_name: str) -> Referrable:
|
|
219
349
|
short_name_list = referred_name.split("/")
|
|
@@ -230,11 +360,11 @@ class AUTOSAR (ARObject, CollectableElement):
|
|
|
230
360
|
def getDataType(self, data_type: ImplementationDataType) -> ImplementationDataType:
|
|
231
361
|
if (isinstance(data_type, ImplementationDataType) or isinstance(data_type, SwBaseType)):
|
|
232
362
|
if (data_type.category == ImplementationDataType.CATEGORY_TYPE_REFERENCE):
|
|
233
|
-
referred_type = self.find(data_type.sw_data_def_props.
|
|
363
|
+
referred_type = self.find(data_type.sw_data_def_props.implementationDataTypeRef.value)
|
|
234
364
|
return self.getDataType(referred_type)
|
|
235
365
|
if (data_type.category == ImplementationDataType.CATEGORY_DATA_REFERENCE):
|
|
236
366
|
if (data_type.sw_data_def_props.sw_pointer_target_props.target_category == "VALUE"):
|
|
237
|
-
referred_type = self.find(data_type.sw_data_def_props.sw_pointer_target_props.sw_data_def_props.
|
|
367
|
+
referred_type = self.find(data_type.sw_data_def_props.sw_pointer_target_props.sw_data_def_props.baseTypeRef.value)
|
|
238
368
|
return self.getDataType(referred_type)
|
|
239
369
|
return data_type
|
|
240
370
|
else:
|
armodel/models/ar_ref.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
|
+
from typing import List
|
|
2
3
|
from .ar_object import ARObject
|
|
3
4
|
|
|
4
5
|
class RefType(ARObject):
|
|
@@ -14,23 +15,51 @@ class TRefType(RefType):
|
|
|
14
15
|
class AutosarVariableRef(ARObject):
|
|
15
16
|
def __init__(self):
|
|
16
17
|
super().__init__()
|
|
17
|
-
self.autosar_variable_iref = None
|
|
18
|
-
self.autosar_variable_in_impl_datatype = None
|
|
18
|
+
self.autosar_variable_iref = None # type: VariableInAtomicSWCTypeInstanceRef
|
|
19
|
+
self.autosar_variable_in_impl_datatype = None # type: ArVariableInImplementationDataInstanceRef
|
|
19
20
|
self.local_variable_ref = None
|
|
20
21
|
|
|
22
|
+
class AutosarParameterRef(ARObject):
|
|
23
|
+
def __init__(self):
|
|
24
|
+
super().__init__()
|
|
25
|
+
|
|
26
|
+
self.autosar_parameter_iref = None # type: ParameterInAtomicSWCTypeInstanceRef
|
|
27
|
+
self.local_parameter_ref = None # type: RefType
|
|
28
|
+
|
|
21
29
|
class AtpInstanceRef(ARObject, metaclass=ABCMeta):
|
|
22
30
|
def __init__(self):
|
|
23
31
|
if type(self) == AtpInstanceRef:
|
|
24
32
|
raise NotImplementedError("AtpInstanceRef is an abstract class.")
|
|
33
|
+
|
|
25
34
|
super().__init__()
|
|
26
35
|
|
|
27
|
-
class
|
|
36
|
+
class VariableInAtomicSWCTypeInstanceRef(AtpInstanceRef):
|
|
37
|
+
def __init__(self):
|
|
38
|
+
super().__init__()
|
|
39
|
+
|
|
40
|
+
self.base_ref = None # type: RefType
|
|
41
|
+
self.context_data_prototype_ref = None # type: RefType
|
|
42
|
+
self.port_prototype_ref = None # type: RefType
|
|
43
|
+
self.root_variable_data_prototype_ref = None # type: RefType
|
|
44
|
+
self.target_data_prototype_ref = None # type: RefType
|
|
45
|
+
|
|
46
|
+
class PortInCompositionTypeInstanceRef(AtpInstanceRef, metaclass=ABCMeta):
|
|
47
|
+
def __init__(self):
|
|
48
|
+
if type(self) == PortInCompositionTypeInstanceRef:
|
|
49
|
+
raise NotImplementedError("PortInCompositionTypeInstanceRef is an abstract class.")
|
|
50
|
+
super().__init__()
|
|
51
|
+
|
|
52
|
+
self.abstract_context_component_ref = None # type: RefType
|
|
53
|
+
self.base_ref = None # type: RefType
|
|
54
|
+
self.target_port_ref = None # type: RefType
|
|
55
|
+
|
|
56
|
+
class PPortInCompositionInstanceRef(PortInCompositionTypeInstanceRef):
|
|
28
57
|
def __init__(self):
|
|
29
58
|
super().__init__()
|
|
30
59
|
self.context_component_ref = None # type: RefType
|
|
31
60
|
self.target_p_port_ref = None # type: RefType
|
|
32
61
|
|
|
33
|
-
class
|
|
62
|
+
class RPortInCompositionInstanceRef(PortInCompositionTypeInstanceRef):
|
|
34
63
|
def __init__(self):
|
|
35
64
|
super().__init__()
|
|
36
65
|
self.context_component_ref = None # type: RefType
|
|
@@ -85,7 +114,44 @@ class RModeInAtomicSwcInstanceRef(AtpInstanceRef):
|
|
|
85
114
|
def __init__(self):
|
|
86
115
|
super().__init__()
|
|
87
116
|
|
|
88
|
-
self.base_ref = None
|
|
89
|
-
self.
|
|
90
|
-
self.
|
|
91
|
-
self.
|
|
117
|
+
self.base_ref = None # type: RefType
|
|
118
|
+
self.context_mode_declaration_group_prototype_ref = None # type: RefType
|
|
119
|
+
self.context_port_ref = None # type: RefType
|
|
120
|
+
self.target_mode_declaration_ref = None # type: RefType
|
|
121
|
+
|
|
122
|
+
class ParameterInAtomicSWCTypeInstanceRef(AtpInstanceRef):
|
|
123
|
+
def __init__(self):
|
|
124
|
+
super().__init__()
|
|
125
|
+
|
|
126
|
+
self.base_ref = None # type: RefType
|
|
127
|
+
self.context_data_prototype_ref = None # type: RefType
|
|
128
|
+
self.port_prototype_ref = None # type: RefType
|
|
129
|
+
self.root_parameter_data_prototype_ref = None # type: RefType
|
|
130
|
+
self.target_data_prototype_ref = None # type: RefType
|
|
131
|
+
|
|
132
|
+
class ApplicationCompositeElementInPortInterfaceInstanceRef(AtpInstanceRef):
|
|
133
|
+
def __init__(self):
|
|
134
|
+
super().__init__()
|
|
135
|
+
|
|
136
|
+
self.base_ref = None # type: RefType
|
|
137
|
+
self.context_data_prototype_ref = None # type: RefType
|
|
138
|
+
self.root_data_prototype_ref = None # type: RefType
|
|
139
|
+
self.target_data_prototype_ref = None # type: RefType
|
|
140
|
+
|
|
141
|
+
class InnerPortGroupInCompositionInstanceRef(AtpInstanceRef):
|
|
142
|
+
def __init__(self):
|
|
143
|
+
super().__init__()
|
|
144
|
+
|
|
145
|
+
self.baseRef = None # type: RefType
|
|
146
|
+
self.contextRef = None # type: RefType
|
|
147
|
+
self.targetRef = None # type: RefType
|
|
148
|
+
|
|
149
|
+
class VariableDataPrototypeInSystemInstanceRef(AtpInstanceRef):
|
|
150
|
+
def __init__(self):
|
|
151
|
+
super().__init__()
|
|
152
|
+
|
|
153
|
+
self.baseRef = None # type: RefType
|
|
154
|
+
self.contextComponentRef = [] # type: List[RefType]
|
|
155
|
+
self.contextCompositionRef = None # type: RefType
|
|
156
|
+
self.contextPortRef = None # type: RefType
|
|
157
|
+
self.targetDataPrototypeRef = None # type: RefType
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
|
-
from typing import List
|
|
2
|
+
from typing import Dict, List
|
|
3
3
|
from .general_structure import AtpStructureElement, ARObject, ARElement
|
|
4
|
+
from .ar_object import ARBoolean, ARFloat, ARLiteral, ARNumerical, ARPositiveInteger
|
|
4
5
|
from .common_structure import ExecutableEntity, ModeDeclarationGroupPrototype, InternalBehavior, Identifiable
|
|
5
6
|
from .ar_ref import RefType
|
|
6
7
|
|
|
@@ -10,10 +11,16 @@ class BswModuleEntity(ExecutableEntity, metaclass=ABCMeta):
|
|
|
10
11
|
raise NotImplementedError("BswModuleEntity is an abstract class.")
|
|
11
12
|
super().__init__(parent, short_name)
|
|
12
13
|
|
|
13
|
-
self.
|
|
14
|
-
self.
|
|
15
|
-
self.implemented_entry_ref = None
|
|
16
|
-
self.
|
|
14
|
+
self.accessedModeGroupRefs = [] # type: List[RefType]
|
|
15
|
+
self.activationPointRefs = [] # type: List[RefType]
|
|
16
|
+
self.implemented_entry_ref = None # type: RefType
|
|
17
|
+
self._managedModeGroupRefs = [] # type: List[RefType]
|
|
18
|
+
|
|
19
|
+
def addManagedModeGroupRef(self, ref: RefType):
|
|
20
|
+
self._managedModeGroupRefs.append(ref)
|
|
21
|
+
|
|
22
|
+
def getManagedModeGroupRefs(self) -> List[RefType]:
|
|
23
|
+
return self._managedModeGroupRefs
|
|
17
24
|
|
|
18
25
|
class BswCalledEntity(BswModuleEntity):
|
|
19
26
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -46,7 +53,7 @@ class BswEvent(Identifiable, metaclass=ABCMeta):
|
|
|
46
53
|
raise NotImplementedError("BswEvent is an abstract class.")
|
|
47
54
|
super().__init__(parent, short_name)
|
|
48
55
|
|
|
49
|
-
self.
|
|
56
|
+
self.startsOnEventRef = None # type: RefType
|
|
50
57
|
|
|
51
58
|
class BswOperationInvokedEvent(BswEvent):
|
|
52
59
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -78,11 +85,13 @@ class BswTimingEvent(BswScheduleEvent):
|
|
|
78
85
|
def __init__(self, parent: ARObject, short_name: str):
|
|
79
86
|
super().__init__(parent, short_name)
|
|
80
87
|
|
|
81
|
-
self.period =
|
|
88
|
+
self.period = None # type: ARFloat
|
|
82
89
|
|
|
83
90
|
@property
|
|
84
|
-
def
|
|
85
|
-
|
|
91
|
+
def periodMs(self) -> int:
|
|
92
|
+
if self.period is not None:
|
|
93
|
+
return int(self.period.value * 1000)
|
|
94
|
+
return None
|
|
86
95
|
|
|
87
96
|
class BswDataReceivedEvent(BswScheduleEvent):
|
|
88
97
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -94,16 +103,62 @@ class BswInternalTriggerOccurredEvent(BswScheduleEvent):
|
|
|
94
103
|
def __init__(self, parent: ARObject, short_name: str):
|
|
95
104
|
super().__init__(parent, short_name)
|
|
96
105
|
|
|
97
|
-
self.event_source_ref = None
|
|
106
|
+
self.event_source_ref = None # type: RefType
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class BswModeSwitchAckRequest(ARObject):
|
|
110
|
+
def __init__(self):
|
|
111
|
+
super().__init__()
|
|
112
|
+
|
|
113
|
+
self.timeout = None # type: ARFloat
|
|
114
|
+
|
|
115
|
+
class BswModeSenderPolicy(ARObject):
|
|
116
|
+
def __init__(self):
|
|
117
|
+
super().__init__()
|
|
118
|
+
|
|
119
|
+
self.ack_request = None # type: BswModeSwitchAckRequest
|
|
120
|
+
self.enhanced_mode_api = None # type: ARBoolean
|
|
121
|
+
self._provided_mode_group_ref = None # type: RefType
|
|
122
|
+
self._queue_length = None # type: ARNumerical
|
|
123
|
+
|
|
124
|
+
def setProvidedModeGroupRef(self, ref: RefType):
|
|
125
|
+
self._provided_mode_group_ref = ref
|
|
126
|
+
return self
|
|
127
|
+
|
|
128
|
+
def getProvidedModeGroupRef(self) -> RefType:
|
|
129
|
+
return self._provided_mode_group_ref
|
|
130
|
+
|
|
131
|
+
def setQueueLength(self, length: any):
|
|
132
|
+
if isinstance(length, ARNumerical):
|
|
133
|
+
self._queue_length = length
|
|
134
|
+
elif isinstance(length, int):
|
|
135
|
+
self._queue_length = ARNumerical()
|
|
136
|
+
self._queue_length.setValue(length)
|
|
137
|
+
else:
|
|
138
|
+
raise ValueError("Unsupported type <%s>" % type(length))
|
|
139
|
+
|
|
140
|
+
def getQueueLength(self) -> ARNumerical:
|
|
141
|
+
return self._queue_length
|
|
98
142
|
|
|
99
143
|
class BswInternalBehavior(InternalBehavior):
|
|
100
144
|
def __init__(self, parent: ARObject, short_name: str):
|
|
101
145
|
super().__init__(parent, short_name)
|
|
102
146
|
|
|
147
|
+
self._entities = [] # type: List[BswModuleEntity]
|
|
148
|
+
self._events = [] # type: List[BswEvent]
|
|
149
|
+
self._mode_sender_policies = [] # type: List[BswModeSenderPolicy]
|
|
150
|
+
|
|
151
|
+
def addModeSenderPolicy(self, policy: BswModeSenderPolicy):
|
|
152
|
+
self._mode_sender_policies.append(policy)
|
|
153
|
+
|
|
154
|
+
def getModeSenderPolicies(self) -> List[BswModeSenderPolicy]:
|
|
155
|
+
return self._mode_sender_policies
|
|
156
|
+
|
|
103
157
|
def createBswCalledEntity(self, short_name: str) -> BswCalledEntity:
|
|
104
158
|
if (short_name not in self.elements):
|
|
105
159
|
event = BswCalledEntity(self, short_name)
|
|
106
160
|
self.elements[short_name] = event
|
|
161
|
+
self._entities.append(event)
|
|
107
162
|
return self.elements[short_name]
|
|
108
163
|
|
|
109
164
|
def getBswCalledEntities(self) -> List[BswCalledEntity]:
|
|
@@ -113,24 +168,30 @@ class BswInternalBehavior(InternalBehavior):
|
|
|
113
168
|
if (short_name not in self.elements):
|
|
114
169
|
event = BswSchedulableEntity(self, short_name)
|
|
115
170
|
self.elements[short_name] = event
|
|
171
|
+
self._entities.append(event)
|
|
116
172
|
return self.elements[short_name]
|
|
117
173
|
|
|
118
174
|
def getBswSchedulableEntities(self) -> List[BswSchedulableEntity]:
|
|
119
175
|
return list(filter(lambda a: isinstance(a, BswSchedulableEntity), self.elements.values()))
|
|
176
|
+
|
|
177
|
+
def getBswModuleEntities(self) -> List[BswModuleEntity]:
|
|
178
|
+
return list(filter(lambda a: isinstance(a, BswModuleEntity), self.elements.values()))
|
|
120
179
|
|
|
121
180
|
def createBswModeSwitchEvent(self, short_name: str) -> BswModeSwitchEvent:
|
|
122
181
|
if (short_name not in self.elements):
|
|
123
182
|
event = BswModeSwitchEvent(self, short_name)
|
|
124
183
|
self.elements[short_name] = event
|
|
184
|
+
self._events.append(event)
|
|
125
185
|
return self.elements[short_name]
|
|
126
186
|
|
|
127
187
|
def getBswModeSwitchEvents(self) -> List[BswModeSwitchEvent]:
|
|
128
188
|
return list(filter(lambda a: isinstance(a, BswModeSwitchEvent), self.elements.values()))
|
|
129
|
-
|
|
189
|
+
|
|
130
190
|
def createBswTimingEvent(self, short_name: str) -> BswTimingEvent:
|
|
131
191
|
if (short_name not in self.elements):
|
|
132
192
|
event = BswTimingEvent(self, short_name)
|
|
133
193
|
self.elements[short_name] = event
|
|
194
|
+
self._events.append(event)
|
|
134
195
|
return self.elements[short_name]
|
|
135
196
|
|
|
136
197
|
def getBswTimingEvents(self) -> List[BswTimingEvent]:
|
|
@@ -140,6 +201,7 @@ class BswInternalBehavior(InternalBehavior):
|
|
|
140
201
|
if (short_name not in self.elements):
|
|
141
202
|
event = BswDataReceivedEvent(self, short_name)
|
|
142
203
|
self.elements[short_name] = event
|
|
204
|
+
self._events.append(event)
|
|
143
205
|
return self.elements[short_name]
|
|
144
206
|
|
|
145
207
|
def getBswDataReceivedEvents(self) -> List[BswDataReceivedEvent]:
|
|
@@ -149,10 +211,14 @@ class BswInternalBehavior(InternalBehavior):
|
|
|
149
211
|
if (short_name not in self.elements):
|
|
150
212
|
event = BswInternalTriggerOccurredEvent(self, short_name)
|
|
151
213
|
self.elements[short_name] = event
|
|
214
|
+
self._events.append(event)
|
|
152
215
|
return self.elements[short_name]
|
|
153
216
|
|
|
154
217
|
def getBswInternalTriggerOccurredEvents(self) -> List[BswInternalTriggerOccurredEvent]:
|
|
155
218
|
return list(filter(lambda a: isinstance(a, BswInternalTriggerOccurredEvent), self.elements.values()))
|
|
219
|
+
|
|
220
|
+
def getBswEvents(self) -> List[BswEvent]:
|
|
221
|
+
return list(filter(lambda a: isinstance(a, BswEvent), self.elements.values()))
|
|
156
222
|
|
|
157
223
|
class BswModuleDescription(AtpStructureElement):
|
|
158
224
|
'''
|
|
@@ -168,12 +234,18 @@ class BswModuleDescription(AtpStructureElement):
|
|
|
168
234
|
super().__init__(parent, short_name)
|
|
169
235
|
|
|
170
236
|
# MODULE-ID
|
|
171
|
-
self.module_id =
|
|
237
|
+
self.module_id = None # type: ARPositiveInteger
|
|
172
238
|
# PROVIDED-ENTRYS
|
|
173
|
-
self.
|
|
239
|
+
self._implementedEntryRefs = [] # type: List[RefType]
|
|
240
|
+
|
|
241
|
+
self.providedModeGroups = {} # type: Dict[str, ModeDeclarationGroupPrototype]
|
|
242
|
+
self.requiredModeGroups = {} # tyep: Dict[str, ModeDeclarationGroupPrototype]
|
|
243
|
+
|
|
244
|
+
def addImplementedEntry(self, entry_ref: RefType):
|
|
245
|
+
self._implementedEntryRefs.append(entry_ref)
|
|
174
246
|
|
|
175
|
-
|
|
176
|
-
self.
|
|
247
|
+
def getImplementedEntries(self) -> List[RefType]:
|
|
248
|
+
return self._implementedEntryRefs
|
|
177
249
|
|
|
178
250
|
@property
|
|
179
251
|
def category(self) -> str:
|
|
@@ -189,21 +261,21 @@ class BswModuleDescription(AtpStructureElement):
|
|
|
189
261
|
if (short_name not in self.elements):
|
|
190
262
|
prototype = ModeDeclarationGroupPrototype(self, short_name)
|
|
191
263
|
self.elements[short_name] = prototype
|
|
192
|
-
self.
|
|
264
|
+
self.providedModeGroups[short_name] = prototype
|
|
193
265
|
return self.elements[short_name]
|
|
194
266
|
|
|
195
267
|
def getProvidedModeGroups(self) -> List[ModeDeclarationGroupPrototype]:
|
|
196
|
-
return sorted(self.
|
|
268
|
+
return sorted(self.providedModeGroups.values(), key=lambda v: v.short_name)
|
|
197
269
|
|
|
198
270
|
def createRequiredModeGroup(self, short_name: str) -> ModeDeclarationGroupPrototype:
|
|
199
271
|
if (short_name not in self.elements):
|
|
200
272
|
prototype = ModeDeclarationGroupPrototype(self, short_name)
|
|
201
273
|
self.elements[short_name] = prototype
|
|
202
|
-
self.
|
|
274
|
+
self.requiredModeGroups[short_name] = property
|
|
203
275
|
return self.elements[short_name]
|
|
204
276
|
|
|
205
277
|
def getRequiredModeGroups(self) -> List[ModeDeclarationGroupPrototype]:
|
|
206
|
-
return sorted(self.
|
|
278
|
+
return sorted(self.requiredModeGroups.values(), key=lambda v: v.short_name)
|
|
207
279
|
|
|
208
280
|
def createBswInternalBehavior(self, short_name: str) -> BswInternalBehavior:
|
|
209
281
|
'''
|
|
@@ -221,12 +293,12 @@ class BswModuleEntry(ARElement):
|
|
|
221
293
|
def __init__(self, parent: ARObject, short_name: str):
|
|
222
294
|
super().__init__(parent, short_name)
|
|
223
295
|
|
|
224
|
-
self.service_id = None
|
|
225
|
-
self.is_reentrant = None
|
|
226
|
-
self.is_synchronous = None
|
|
227
|
-
self.call_type = None
|
|
228
|
-
self._execution_context = None
|
|
229
|
-
self._sw_service_impl_policy = None
|
|
296
|
+
self.service_id = None # type: ARNumerical
|
|
297
|
+
self.is_reentrant = None # type: ARBoolean
|
|
298
|
+
self.is_synchronous = None # type: ARBoolean
|
|
299
|
+
self.call_type = None # type: ARLiteral
|
|
300
|
+
self._execution_context = None # type: ARLiteral
|
|
301
|
+
self._sw_service_impl_policy = None # type: ARLiteral
|
|
230
302
|
|
|
231
303
|
@property
|
|
232
304
|
def execution_context(self):
|