armodel 1.4.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/connector_update_cli.py +11 -4
- armodel/data_models/__init__.py +0 -0
- armodel/data_models/sw_connector.py +22 -0
- armodel/lib/data_analyzer.py +1 -1
- armodel/models/__init__.py +3 -2
- armodel/models/annotation.py +20 -0
- armodel/models/ar_object.py +163 -18
- armodel/models/ar_package.py +110 -14
- armodel/models/ar_ref.py +62 -6
- armodel/models/bsw_module_template.py +97 -26
- armodel/models/calibration.py +107 -4
- armodel/models/common_structure.py +112 -37
- armodel/models/communication.py +10 -1
- 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 +69 -20
- armodel/models/end_to_end_protection.py +67 -0
- armodel/models/general_structure.py +25 -15
- armodel/models/global_constraints.py +4 -4
- armodel/models/implementation.py +80 -32
- armodel/models/m2_msr.py +6 -4
- 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 +37 -17
- 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 +224 -39
- armodel/parser/abstract_arxml_parser.py +248 -0
- armodel/parser/arxml_parser.py +1280 -810
- armodel/parser/connector_xlsx_parser.py +190 -0
- armodel/parser/excel_parser.py +18 -0
- armodel/tests/test_armodel/models/test_ar_object.py +152 -0
- armodel/tests/test_armodel/models/test_ar_package.py +1 -1
- armodel/tests/test_armodel/models/test_common_structure.py +2 -2
- armodel/tests/test_armodel/models/test_data_dictionary.py +7 -7
- armodel/tests/test_armodel/models/test_data_prototype.py +2 -2
- armodel/tests/test_armodel/models/test_datatype.py +4 -4
- armodel/tests/test_armodel/models/test_general_structure.py +1 -1
- armodel/tests/test_armodel/models/test_implementation.py +26 -0
- armodel/tests/test_armodel/models/test_m2_msr.py +4 -4
- armodel/tests/test_armodel/parser/test_arxml_parser.py +15 -0
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +70 -46
- armodel/tests/test_armodel/parser/test_sw_components.py +93 -0
- armodel/writer/abstract_arxml_writer.py +123 -0
- armodel/writer/arxml_writer.py +1464 -350
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/METADATA +90 -3
- armodel-1.4.3.dist-info/RECORD +78 -0
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/WHEEL +1 -1
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/entry_points.txt +2 -0
- armodel-1.4.0.dist-info/RECORD +0 -60
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/LICENSE +0 -0
- {armodel-1.4.0.dist-info → armodel-1.4.3.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
|
+
from .ar_ref import RefType
|
|
5
|
+
from .multilanguage_data import MultiLanguageOverviewParagraph, MultilanguageLongName
|
|
4
6
|
from .ar_object import ARObject
|
|
5
7
|
|
|
6
|
-
|
|
7
8
|
class Sd(ARObject):
|
|
8
9
|
def __init__(self):
|
|
9
10
|
super().__init__()
|
|
@@ -58,9 +59,11 @@ class MultilanguageReferrable(Referrable, metaclass=ABCMeta):
|
|
|
58
59
|
def __init__(self, parent: ARObject, short_name: str):
|
|
59
60
|
if type(self) == MultilanguageReferrable:
|
|
60
61
|
raise NotImplementedError("MultilanguageReferrable is an abstract class.")
|
|
62
|
+
|
|
61
63
|
super().__init__(parent, short_name)
|
|
64
|
+
|
|
62
65
|
self.parent = parent
|
|
63
|
-
self.long_name = None
|
|
66
|
+
self.long_name = None # type: MultilanguageLongName
|
|
64
67
|
|
|
65
68
|
class CollectableElement(ARObject, metaclass=ABCMeta):
|
|
66
69
|
def __init__(self):
|
|
@@ -71,6 +74,11 @@ class CollectableElement(ARObject, metaclass=ABCMeta):
|
|
|
71
74
|
def getTotalElement(self) -> int:
|
|
72
75
|
#return len(list(filter(lambda a: not isinstance(a, ARPackage) , self.elements.values())))
|
|
73
76
|
return len(self.elements.values())
|
|
77
|
+
|
|
78
|
+
def removeElement(self, key):
|
|
79
|
+
if key not in self.elements:
|
|
80
|
+
raise KeyError("Invalid key <%s> for removing element" % key)
|
|
81
|
+
self.elements.pop(key)
|
|
74
82
|
|
|
75
83
|
def getElements(self):
|
|
76
84
|
return self.elements.values()
|
|
@@ -89,7 +97,7 @@ class Identifiable(MultilanguageReferrable, CollectableElement, metaclass=ABCMet
|
|
|
89
97
|
|
|
90
98
|
self.admin_data = None # type: AdminData
|
|
91
99
|
self._category = None
|
|
92
|
-
self.desc = None
|
|
100
|
+
self.desc = None # type: MultiLanguageOverviewParagraph
|
|
93
101
|
|
|
94
102
|
@property
|
|
95
103
|
def category(self):
|
|
@@ -122,24 +130,24 @@ class SwcBswRunnableMapping(ARObject):
|
|
|
122
130
|
'''
|
|
123
131
|
super().__init__()
|
|
124
132
|
|
|
125
|
-
self.
|
|
126
|
-
self.
|
|
133
|
+
self.bswEntityRef = None # type: RefType
|
|
134
|
+
self.swcRunnableRef = None # type: RefType
|
|
127
135
|
|
|
128
136
|
class SwcBswMapping(Identifiable):
|
|
129
137
|
def __init__(self, parent: ARObject, short_name: str):
|
|
130
138
|
super().__init__(parent, short_name)
|
|
131
139
|
|
|
132
|
-
self.
|
|
133
|
-
self.
|
|
134
|
-
self.
|
|
135
|
-
self.
|
|
136
|
-
self.
|
|
140
|
+
self.bswBehaviorRef = None # type: RefType
|
|
141
|
+
self._runnableMappings = []
|
|
142
|
+
self.swcBehaviorRef = None # type: RefType
|
|
143
|
+
self.synchronizedModeGroups = []
|
|
144
|
+
self.synchronizedTriggers = []
|
|
137
145
|
|
|
138
146
|
def addRunnableMapping(self, mapping: SwcBswRunnableMapping):
|
|
139
|
-
self.
|
|
147
|
+
self._runnableMappings.append(mapping)
|
|
140
148
|
|
|
141
149
|
def getRunnableMappings(self) -> List[SwcBswRunnableMapping]:
|
|
142
|
-
return self.
|
|
150
|
+
return self._runnableMappings
|
|
143
151
|
|
|
144
152
|
class ARElement(PackageableElement, metaclass=ABCMeta):
|
|
145
153
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -154,7 +162,9 @@ class AtpStructureElement(AtpFeature, metaclass=ABCMeta):
|
|
|
154
162
|
raise NotImplementedError("AtpStructureElement is an abstract class.")
|
|
155
163
|
super().__init__(parent, short_name)
|
|
156
164
|
|
|
157
|
-
class Limit:
|
|
165
|
+
class Limit(ARObject):
|
|
158
166
|
def __init__(self):
|
|
159
|
-
|
|
160
|
-
|
|
167
|
+
super().__init__()
|
|
168
|
+
|
|
169
|
+
self.intervalType = None # type: str
|
|
170
|
+
self.value = None # type: str
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .ar_ref import RefType
|
|
2
|
-
from .ar_object import ARObject
|
|
2
|
+
from .ar_object import ARNumerical, ARObject
|
|
3
3
|
from .general_structure import Identifiable, Limit
|
|
4
4
|
|
|
5
5
|
from typing import List
|
|
@@ -23,9 +23,9 @@ class DataConstrRule(ARObject):
|
|
|
23
23
|
def __init__(self):
|
|
24
24
|
super().__init__()
|
|
25
25
|
|
|
26
|
-
self.
|
|
27
|
-
self.
|
|
28
|
-
self.
|
|
26
|
+
self.constrLevel = None # type: ARNumerical
|
|
27
|
+
self.internalConstrs = None # type: InternalConstrs
|
|
28
|
+
self.physConstrs = None # type: PhysConstrs
|
|
29
29
|
|
|
30
30
|
class DataConstr(Identifiable):
|
|
31
31
|
def __init__(self, parent: ARObject, short_name: str):
|
armodel/models/implementation.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
|
-
from .ar_object import ARObject
|
|
3
|
+
from .ar_object import ARLiteral, ARNumerical, ARObject
|
|
4
4
|
from .general_structure import PackageableElement, Identifiable
|
|
5
5
|
from .common_structure import ResourceConsumption
|
|
6
6
|
from .ar_ref import RefType
|
|
@@ -12,10 +12,43 @@ class EngineeringObject(ARObject, metaclass=ABCMeta):
|
|
|
12
12
|
|
|
13
13
|
super().__init__()
|
|
14
14
|
|
|
15
|
-
self.category =
|
|
16
|
-
self.domain = None # type:
|
|
17
|
-
self.revision_label = None
|
|
18
|
-
self.short_label =
|
|
15
|
+
self.category = None # type: ARLiteral
|
|
16
|
+
self.domain = None # type: ARLiteral
|
|
17
|
+
self.revision_label = None # type: ARLiteral
|
|
18
|
+
self.short_label = None # type: ARLiteral
|
|
19
|
+
|
|
20
|
+
def setCategory(self, category: ARLiteral):
|
|
21
|
+
if isinstance(category, ARLiteral):
|
|
22
|
+
self.category = category
|
|
23
|
+
else:
|
|
24
|
+
self.category = ARLiteral()
|
|
25
|
+
self.category.setValue(str(category))
|
|
26
|
+
|
|
27
|
+
return self
|
|
28
|
+
|
|
29
|
+
def getCategory(self) -> ARLiteral:
|
|
30
|
+
return self.category
|
|
31
|
+
|
|
32
|
+
def setDomain(self, domain: ARLiteral):
|
|
33
|
+
self.domain = domain
|
|
34
|
+
return self
|
|
35
|
+
|
|
36
|
+
def getDomain(self) -> ARLiteral:
|
|
37
|
+
return self.domain
|
|
38
|
+
|
|
39
|
+
def setRevisionLabel(self, revision_label: ARLiteral):
|
|
40
|
+
self.revision_label = revision_label
|
|
41
|
+
return self
|
|
42
|
+
|
|
43
|
+
def getRevisionLabel(self) -> ARLiteral:
|
|
44
|
+
return self.revision_label
|
|
45
|
+
|
|
46
|
+
def setShortLabel(self, label: ARLiteral):
|
|
47
|
+
self.short_label = label
|
|
48
|
+
return self
|
|
49
|
+
|
|
50
|
+
def getShortLabel(self) -> ARLiteral:
|
|
51
|
+
return self.short_label
|
|
19
52
|
|
|
20
53
|
class AutosarEngineeringObject(EngineeringObject):
|
|
21
54
|
def __init__(self):
|
|
@@ -25,17 +58,17 @@ class Code(Identifiable):
|
|
|
25
58
|
def __init__(self, parent: ARObject, short_name: str):
|
|
26
59
|
super().__init__(parent, short_name)
|
|
27
60
|
|
|
28
|
-
self.
|
|
29
|
-
self.
|
|
61
|
+
self._artifactDescriptors = [] # type: List[AutosarEngineeringObject]
|
|
62
|
+
self.callbackHeaderRefs = [] # type: List[RefType]
|
|
30
63
|
|
|
31
64
|
def addArtifactDescriptor(self, desc: AutosarEngineeringObject):
|
|
32
|
-
self.
|
|
65
|
+
self._artifactDescriptors.append(desc)
|
|
33
66
|
|
|
34
67
|
def getArtifactDescriptors(self, category:str = "") -> List[AutosarEngineeringObject]:
|
|
35
68
|
if (category == ""):
|
|
36
|
-
return self.
|
|
69
|
+
return self._artifactDescriptors
|
|
37
70
|
else:
|
|
38
|
-
return list(filter(lambda a: a.
|
|
71
|
+
return list(filter(lambda a: a.getCategory().getText() == category, self._artifactDescriptors))
|
|
39
72
|
|
|
40
73
|
class Implementation(PackageableElement, metaclass=ABCMeta):
|
|
41
74
|
def __init__(self, parent: ARObject, short_name: str) -> None:
|
|
@@ -43,20 +76,21 @@ class Implementation(PackageableElement, metaclass=ABCMeta):
|
|
|
43
76
|
raise NotImplementedError("Implementation is an abstract class.")
|
|
44
77
|
|
|
45
78
|
super().__init__(parent, short_name)
|
|
46
|
-
|
|
47
|
-
self.
|
|
48
|
-
self.
|
|
49
|
-
self.
|
|
50
|
-
self.
|
|
51
|
-
self.
|
|
52
|
-
self.
|
|
53
|
-
self.
|
|
54
|
-
self.
|
|
55
|
-
self.
|
|
56
|
-
self.
|
|
57
|
-
self.
|
|
58
|
-
self.
|
|
59
|
-
self.
|
|
79
|
+
|
|
80
|
+
self.build_action_manifest_ref = None # type: RefType
|
|
81
|
+
self.compilers = None
|
|
82
|
+
self.generated_artifacts = None
|
|
83
|
+
self.hw_element_refs = [] # type: List[RefType]
|
|
84
|
+
self.linker = []
|
|
85
|
+
self.mc_support = None
|
|
86
|
+
self.programming_language = None # type: ARLiteral
|
|
87
|
+
self.required_artifacts = []
|
|
88
|
+
self.required_generator_tools = []
|
|
89
|
+
self._resource_consumption = None # type: ResourceConsumption
|
|
90
|
+
self.sw_version = "" # type: ARLiteral
|
|
91
|
+
self.swc_bsw_mapping_ref = None # type: RefType
|
|
92
|
+
self.used_code_generator = None # type: ARLiteral
|
|
93
|
+
self.vendor_id = 0 # type: ARNumerical
|
|
60
94
|
|
|
61
95
|
def createCodeDescriptor(self, short_name: str) -> Code:
|
|
62
96
|
if (short_name not in self.elements):
|
|
@@ -67,22 +101,36 @@ class Implementation(PackageableElement, metaclass=ABCMeta):
|
|
|
67
101
|
def getCodeDescriptors(self)-> List[Code]:
|
|
68
102
|
return list(filter(lambda a : isinstance(a, Code), self.elements.values()))
|
|
69
103
|
|
|
104
|
+
def setResourceConsumption(self, consumption: ResourceConsumption):
|
|
105
|
+
self.elements[consumption.short_name] = consumption
|
|
106
|
+
self._resource_consumption = consumption
|
|
107
|
+
return self
|
|
108
|
+
|
|
109
|
+
def getResourceConsumption(self) -> ResourceConsumption:
|
|
110
|
+
return self._resource_consumption
|
|
111
|
+
|
|
70
112
|
class BswImplementation(Implementation):
|
|
71
113
|
def __init__(self, parent: ARObject, short_name: str) -> None:
|
|
72
114
|
super().__init__(parent, short_name)
|
|
73
115
|
|
|
74
|
-
self.ar_release_version =
|
|
75
|
-
self.
|
|
76
|
-
self.
|
|
77
|
-
self.
|
|
78
|
-
self.
|
|
79
|
-
self.
|
|
80
|
-
|
|
116
|
+
self.ar_release_version = None # type: ARLiteral
|
|
117
|
+
self.behavior_ref = None # type: RefType
|
|
118
|
+
self.preconfiguredConfigurationRef = [] # type: List[RefType]
|
|
119
|
+
self.recommendedConfigurationRef = [] # type: List[RefType]
|
|
120
|
+
self.vendorApiInfix = None # type: str
|
|
121
|
+
self._vendorSpecificModuleDefRef = [] # type: List[RefType]
|
|
122
|
+
|
|
123
|
+
def addVendorSpecificModuleDefRef(self, ref: RefType):
|
|
124
|
+
self._vendorSpecificModuleDefRef.append(ref)
|
|
81
125
|
|
|
126
|
+
def getVendorSpecificModuleDefRefs(self):
|
|
127
|
+
return self._vendorSpecificModuleDefRef
|
|
128
|
+
|
|
82
129
|
class SwcImplementation(Implementation):
|
|
83
130
|
def __init__(self, parent: ARObject, short_name: str) -> None:
|
|
84
131
|
super().__init__(parent, short_name)
|
|
85
132
|
|
|
86
133
|
self.behavior_ref = None # type: RefType
|
|
87
134
|
self.per_instance_memory_size = None
|
|
88
|
-
self.required_rte_vendor = ""
|
|
135
|
+
self.required_rte_vendor = ""
|
|
136
|
+
|
armodel/models/m2_msr.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from .ar_object import ARLiteral
|
|
1
2
|
from .general_structure import ARObject, ARElement, Limit
|
|
2
3
|
from .ar_ref import RefType
|
|
3
4
|
from abc import ABCMeta
|
|
@@ -117,10 +118,11 @@ class CompuScale(Compu):
|
|
|
117
118
|
def __init__(self):
|
|
118
119
|
super().__init__()
|
|
119
120
|
|
|
120
|
-
self.
|
|
121
|
-
self.
|
|
122
|
-
self.
|
|
123
|
-
self.
|
|
121
|
+
self.symbol = None # type: ARLiteral
|
|
122
|
+
self.lowerLimit = None # type: Limit
|
|
123
|
+
self.upperLimit = None # type: Limit
|
|
124
|
+
self.compuInverseValue = None # type: CompuConst
|
|
125
|
+
self.compuScaleContents = None # type: CompuScaleContents
|
|
124
126
|
|
|
125
127
|
class CompuScales(CompuContent):
|
|
126
128
|
def __init__(self):
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
from typing import List
|
|
3
|
+
from .ar_object import ARObject
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class LLongName(ARObject):
|
|
7
|
+
def __init__(self):
|
|
8
|
+
super().__init__()
|
|
9
|
+
|
|
10
|
+
self.l = ""
|
|
11
|
+
self.value = ""
|
|
12
|
+
|
|
13
|
+
class LOverviewParagraph(ARObject):
|
|
14
|
+
def __init__(self):
|
|
15
|
+
super().__init__()
|
|
16
|
+
|
|
17
|
+
self.l = ""
|
|
18
|
+
self.value = ""
|
|
19
|
+
|
|
20
|
+
class MultilanguageLongName(ARObject):
|
|
21
|
+
def __init__(self):
|
|
22
|
+
super().__init__()
|
|
23
|
+
|
|
24
|
+
self.l4 = [] # type:List[LLongName]
|
|
25
|
+
|
|
26
|
+
def addL4(self, l4: LLongName):
|
|
27
|
+
self.l4.append(l4)
|
|
28
|
+
|
|
29
|
+
def getL4s(self) -> List[LLongName]:
|
|
30
|
+
return self.l4
|
|
31
|
+
|
|
32
|
+
class MultiLanguageOverviewParagraph(ARObject):
|
|
33
|
+
def __init__(self):
|
|
34
|
+
super().__init__()
|
|
35
|
+
|
|
36
|
+
self.l2 = [] # type: List[str]
|
|
37
|
+
|
|
38
|
+
def addL2(self, l2: LOverviewParagraph):
|
|
39
|
+
self.l2.append(l2)
|
|
40
|
+
|
|
41
|
+
def getL2s(self) -> List[LOverviewParagraph]:
|
|
42
|
+
return self.l2
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
from .data_dictionary import SwDataDefProps
|
|
3
|
+
from .ar_object import ARObject
|
|
4
|
+
from .general_structure import Identifiable
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class PerInstanceMemory(Identifiable):
|
|
8
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
9
|
+
super().__init__(parent, short_name)
|
|
10
|
+
|
|
11
|
+
self.init_value = None # type: str
|
|
12
|
+
self.sw_data_def_props = None # type: SwDataDefProps
|
|
13
|
+
self.type = None # type: str
|
|
14
|
+
self.type_definition = None # type: str
|
armodel/models/port_interface.py
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
|
+
from .ar_object import ARBoolean, ARLiteral, ARNumerical
|
|
5
|
+
from .common_structure import ModeDeclarationGroupPrototype, Trigger
|
|
4
6
|
from .datatype import AtpType
|
|
5
7
|
from .general_structure import ARObject, Identifiable, AtpFeature
|
|
6
8
|
from .data_prototype import VariableDataPrototype, AutosarDataPrototype
|
|
7
9
|
from .ar_ref import RefType
|
|
8
10
|
|
|
9
|
-
class PortInterface(AtpType, metaclass=ABCMeta):
|
|
11
|
+
class PortInterface(AtpType, metaclass = ABCMeta):
|
|
10
12
|
def __init__(self, parent: ARObject, short_name: str):
|
|
11
13
|
if type(self) == PortInterface:
|
|
12
14
|
raise NotImplementedError("PortInterface is an abstract class.")
|
|
13
15
|
super().__init__(parent, short_name)
|
|
14
16
|
|
|
15
|
-
self.is_service =
|
|
16
|
-
|
|
17
|
+
self.is_service = None # type: ARBoolean
|
|
18
|
+
self.serviceKind = None # type: ARLiteral
|
|
17
19
|
|
|
18
20
|
class DataInterface(PortInterface, metaclass=ABCMeta):
|
|
19
21
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -63,7 +65,7 @@ class ApplicationError(Identifiable):
|
|
|
63
65
|
def __init__(self, parent: ARObject, short_name: str):
|
|
64
66
|
super().__init__(parent, short_name)
|
|
65
67
|
|
|
66
|
-
self.error_code =
|
|
68
|
+
self.error_code = None # type: ARNumerical
|
|
67
69
|
|
|
68
70
|
class ClientServerOperation(AtpFeature):
|
|
69
71
|
"""
|
|
@@ -140,3 +142,24 @@ class ClientServerInterface(PortInterface):
|
|
|
140
142
|
|
|
141
143
|
def getPossibleErrors(self) -> List[ApplicationError]:
|
|
142
144
|
return list(filter(lambda c: isinstance(c, ApplicationError), self.elements.values()))
|
|
145
|
+
|
|
146
|
+
class TriggerInterface(PortInterface):
|
|
147
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
148
|
+
super().__init__(parent, short_name)
|
|
149
|
+
|
|
150
|
+
self._triggers = [] # type: Trigger
|
|
151
|
+
|
|
152
|
+
class ModeSwitchInterface(PortInterface):
|
|
153
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
154
|
+
super().__init__(parent, short_name)
|
|
155
|
+
|
|
156
|
+
self._modeGroup = [] # type: List[ModeDeclarationGroupPrototype]
|
|
157
|
+
|
|
158
|
+
def createModeGroup(self, short_name: str) -> ModeDeclarationGroupPrototype:
|
|
159
|
+
prototype = ModeDeclarationGroupPrototype(self, short_name)
|
|
160
|
+
if (short_name not in self.elements):
|
|
161
|
+
self.elements[short_name] = prototype
|
|
162
|
+
return self.elements[short_name]
|
|
163
|
+
|
|
164
|
+
def getModeGroups(self) -> List[ModeDeclarationGroupPrototype]:
|
|
165
|
+
return list(sorted(filter(lambda c: isinstance(c, ModeDeclarationGroupPrototype), self.elements.values()), key= lambda o: o.short_name))
|
armodel/models/port_prototype.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from typing import List
|
|
2
2
|
|
|
3
|
+
from .ar_object import ARBoolean
|
|
3
4
|
from .data_dictionary import SwDataDefProps
|
|
4
5
|
from .general_structure import ARObject, Identifiable
|
|
5
6
|
from .ar_ref import RefType, TRefType
|
|
6
|
-
from .communication import TransmissionAcknowledgementRequest
|
|
7
|
+
from .communication import CompositeNetworkRepresentation, TransmissionAcknowledgementRequest
|
|
7
8
|
from .common_structure import ValueSpecification
|
|
8
9
|
|
|
9
10
|
from abc import ABCMeta
|
|
@@ -71,11 +72,17 @@ class ReceiverComSpec(RPortComSpec):
|
|
|
71
72
|
def __init__(self):
|
|
72
73
|
super().__init__()
|
|
73
74
|
|
|
74
|
-
self.
|
|
75
|
-
self.
|
|
76
|
-
self.
|
|
77
|
-
self.
|
|
78
|
-
|
|
75
|
+
self._composite_network_representation = [] # type: List[CompositeNetworkRepresentation]
|
|
76
|
+
self.data_element_ref = None # type: RefType
|
|
77
|
+
self.network_representation = None # type: SwDataDefProps
|
|
78
|
+
self.handle_out_of_range = None # type: str
|
|
79
|
+
self.uses_end_to_end_protection = None # type: ARBoolean
|
|
80
|
+
|
|
81
|
+
def addCompositeNetworkRepresentation(self, representation: CompositeNetworkRepresentation):
|
|
82
|
+
self._composite_network_representation.append(representation)
|
|
83
|
+
|
|
84
|
+
def getCompositeNetworkRepresentations(self) -> List[CompositeNetworkRepresentation]:
|
|
85
|
+
return self._composite_network_representation
|
|
79
86
|
|
|
80
87
|
class ModeSwitchSenderComSpec(RPortComSpec):
|
|
81
88
|
def __init__(self):
|
|
@@ -92,11 +99,18 @@ class SenderComSpec(PPortComSpec):
|
|
|
92
99
|
|
|
93
100
|
def __init__(self):
|
|
94
101
|
super().__init__()
|
|
95
|
-
self.
|
|
96
|
-
self.
|
|
97
|
-
self.
|
|
98
|
-
self.
|
|
99
|
-
self.
|
|
102
|
+
self._composite_network_representation = [] # type: List[CompositeNetworkRepresentation]
|
|
103
|
+
self.data_element_ref = None # type: RefType
|
|
104
|
+
self.network_representation = None # type: SwDataDefProps
|
|
105
|
+
self.handle_out_of_range = None # type: str
|
|
106
|
+
self.transmission_acknowledge = None # type: TransmissionAcknowledgementRequest
|
|
107
|
+
self.uses_end_to_end_protection = None # type: ARBoolean
|
|
108
|
+
|
|
109
|
+
def addCompositeNetworkRepresentation(self, representation: CompositeNetworkRepresentation):
|
|
110
|
+
self._composite_network_representation.append(representation)
|
|
111
|
+
|
|
112
|
+
def getCompositeNetworkRepresentations(self) -> List[CompositeNetworkRepresentation]:
|
|
113
|
+
return self._composite_network_representation
|
|
100
114
|
|
|
101
115
|
class QueuedSenderComSpec(PPortComSpec):
|
|
102
116
|
def __init__(self):
|
|
@@ -113,7 +127,9 @@ class NonqueuedSenderComSpec(SenderComSpec):
|
|
|
113
127
|
class ServerComSpec(PPortComSpec):
|
|
114
128
|
def __init__(self):
|
|
115
129
|
super().__init__()
|
|
116
|
-
|
|
130
|
+
|
|
131
|
+
self.operation_ref = None # type: RefType
|
|
132
|
+
self.queue_length = None # type: int
|
|
117
133
|
|
|
118
134
|
|
|
119
135
|
class NonqueuedReceiverComSpec(ReceiverComSpec):
|
|
@@ -121,10 +137,10 @@ class NonqueuedReceiverComSpec(ReceiverComSpec):
|
|
|
121
137
|
super().__init__()
|
|
122
138
|
|
|
123
139
|
self.alive_timeout = 0
|
|
124
|
-
self.enable_updated =
|
|
140
|
+
self.enable_updated = None # type: ARBoolean
|
|
125
141
|
self.filter = None # type: DataFilter
|
|
126
142
|
self.handle_data_status = None # type: bool
|
|
127
|
-
self.handle_never_received =
|
|
143
|
+
self.handle_never_received = None # type: ARBoolean
|
|
128
144
|
self.handel_timeout_type = ""
|
|
129
145
|
self.init_value = None # type: ValueSpecification
|
|
130
146
|
self.timeout_substitution = None # type: ValueSpecification
|
|
@@ -147,13 +163,15 @@ class AbstractProvidedPortPrototype(PortPrototype):
|
|
|
147
163
|
self.provided_com_specs = [] # type: List[PPortComSpec]
|
|
148
164
|
|
|
149
165
|
def _validateRPortComSpec(self, com_spec: PPortComSpec):
|
|
150
|
-
if
|
|
151
|
-
if
|
|
166
|
+
if isinstance(com_spec, NonqueuedSenderComSpec):
|
|
167
|
+
if com_spec.data_element_ref == None:
|
|
152
168
|
raise ValueError(
|
|
153
169
|
"operation of NonqueuedSenderComSpec is invalid")
|
|
154
|
-
if
|
|
170
|
+
if com_spec.data_element_ref.dest != "VARIABLE-DATA-PROTOTYPE":
|
|
155
171
|
raise ValueError(
|
|
156
172
|
"Invalid operation dest of NonqueuedSenderComSpec")
|
|
173
|
+
elif isinstance(com_spec, ServerComSpec):
|
|
174
|
+
pass
|
|
157
175
|
else:
|
|
158
176
|
raise ValueError("Unsupported com spec")
|
|
159
177
|
|
|
@@ -188,6 +206,8 @@ class AbstractRequiredPortPrototype(PortPrototype):
|
|
|
188
206
|
if (com_spec.data_element_ref.dest != "VARIABLE-DATA-PROTOTYPE"):
|
|
189
207
|
raise ValueError(
|
|
190
208
|
"Invalid date element dest of NonqueuedReceiverComSpec.")
|
|
209
|
+
elif isinstance(com_spec, QueuedReceiverComSpec):
|
|
210
|
+
pass
|
|
191
211
|
else:
|
|
192
212
|
raise ValueError("Unsupported RPortComSpec")
|
|
193
213
|
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
|
|
2
|
+
from .multilanguage_data import MultiLanguageOverviewParagraph
|
|
3
|
+
from .ar_ref import RefType
|
|
4
|
+
from .ar_object import ARLiteral, ARNumerical, ARObject
|
|
5
|
+
from .general_structure import ARElement
|
|
6
|
+
|
|
7
|
+
class SwRecordLayoutV(ARObject):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
super().__init__()
|
|
10
|
+
|
|
11
|
+
self.baseTypeRef = None # type: RefType
|
|
12
|
+
self.desc = None # type: MultiLanguageOverviewParagraph
|
|
13
|
+
self.shortLabel = None # type: ARLiteral
|
|
14
|
+
self.swGenericAxisParamTypeRef = None # type: RefType
|
|
15
|
+
self.swRecordLayoutVAxis = None # type: ARNumerical
|
|
16
|
+
self.swRecordLayoutVFixValue = None # type: ARNumerical
|
|
17
|
+
self.swRecordLayoutVIndex = None # type: ARLiteral
|
|
18
|
+
self.swRecordLayoutVProp = None # type: ARLiteral
|
|
19
|
+
|
|
20
|
+
def setShortLabel(self, short_label: ARLiteral):
|
|
21
|
+
self.shortLabel = short_label
|
|
22
|
+
return self
|
|
23
|
+
|
|
24
|
+
def setBaseTypeRef(self, ref: RefType):
|
|
25
|
+
self.baseTypeRef = ref
|
|
26
|
+
return self
|
|
27
|
+
|
|
28
|
+
def setSwRecordLayoutVAxis(self, axis: ARNumerical):
|
|
29
|
+
self.swRecordLayoutVAxis = axis
|
|
30
|
+
return self
|
|
31
|
+
|
|
32
|
+
def setSwRecordLayoutVFixValue(self, value: ARNumerical):
|
|
33
|
+
self.swRecordLayoutVFixValue = value
|
|
34
|
+
return self
|
|
35
|
+
|
|
36
|
+
def setSwRecordLayoutVIndex(self, index: ARLiteral):
|
|
37
|
+
self.swRecordLayoutVIndex = index
|
|
38
|
+
return self
|
|
39
|
+
|
|
40
|
+
def setSwRecordLayoutVProp(self, prop: ARLiteral):
|
|
41
|
+
self.swRecordLayoutVProp = prop
|
|
42
|
+
return self
|
|
43
|
+
|
|
44
|
+
class SwRecordLayoutGroupContent(ARObject):
|
|
45
|
+
def __init__(self):
|
|
46
|
+
super().__init__()
|
|
47
|
+
|
|
48
|
+
self.swRecordLayoutRef = None # type: RefType
|
|
49
|
+
self.swRecordLayoutGroup = None # type: SwRecordLayoutGroup
|
|
50
|
+
self.swRecordLayoutV = None # type: SwRecordLayoutV
|
|
51
|
+
|
|
52
|
+
class SwRecordLayoutGroup(ARObject):
|
|
53
|
+
def __init__(self):
|
|
54
|
+
super().__init__()
|
|
55
|
+
|
|
56
|
+
self.category = None # type: ARLiteral
|
|
57
|
+
self.desc = None # type: MultiLanguageOverviewParagraph
|
|
58
|
+
self.shortLabel = None # type: ARLiteral
|
|
59
|
+
self.swGenericAxisParamTypeRef = None # type: RefType
|
|
60
|
+
self.swRecordLayoutComponent = None # type: ARLiteral
|
|
61
|
+
self.swRecordLayoutGroupAxis = None # type: ARNumerical
|
|
62
|
+
self.swRecordLayoutGroupContentType = None # type: SwRecordLayoutGroupContent
|
|
63
|
+
self.swRecordLayoutGroupIndex = None # type: ARLiteral
|
|
64
|
+
self.swRecordLayoutGroupFrom = None # type: ARLiteral
|
|
65
|
+
self.swRecordLayoutGroupTo = None # type: ARLiteral
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def setCategory(self, category: ARLiteral):
|
|
69
|
+
self.category = category
|
|
70
|
+
return self
|
|
71
|
+
|
|
72
|
+
def setDesc(self, desc):
|
|
73
|
+
self.desc = desc
|
|
74
|
+
return self
|
|
75
|
+
|
|
76
|
+
def setShortLabel(self, label: ARLiteral):
|
|
77
|
+
self.shortLabel = label
|
|
78
|
+
return self
|
|
79
|
+
|
|
80
|
+
def setSwGenericAxisParamTypeRef(self, ref: RefType):
|
|
81
|
+
self.swGenericAxisParamTypeRef = ref
|
|
82
|
+
return self
|
|
83
|
+
|
|
84
|
+
def setSwRecordLayoutComponent(self, component: ARLiteral):
|
|
85
|
+
self.swRecordLayoutComponent = component
|
|
86
|
+
return self
|
|
87
|
+
|
|
88
|
+
def setSwRecordLayoutGroupAxis(self, axis: ARNumerical):
|
|
89
|
+
self.swRecordLayoutGroupAxis = axis
|
|
90
|
+
return self
|
|
91
|
+
|
|
92
|
+
def setSwRecordLayoutGroupIndex(self, index: ARLiteral):
|
|
93
|
+
self.swRecordLayoutGroupIndex = index
|
|
94
|
+
return self
|
|
95
|
+
|
|
96
|
+
def setSwRecordLayoutGroupFrom(self, from_value: ARLiteral):
|
|
97
|
+
self.swRecordLayoutGroupFrom = from_value
|
|
98
|
+
return self
|
|
99
|
+
|
|
100
|
+
def setSwRecordLayoutGroupTo(self, to_value: ARLiteral):
|
|
101
|
+
self.swRecordLayoutGroupTo = to_value
|
|
102
|
+
return self
|
|
103
|
+
|
|
104
|
+
def setSwRecordLayoutGroupContentType(self, content_type: SwRecordLayoutGroupContent):
|
|
105
|
+
self.swRecordLayoutGroupContentType = content_type
|
|
106
|
+
return self
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class SwRecordLayout(ARElement):
|
|
110
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
111
|
+
super().__init__(parent, short_name)
|
|
112
|
+
|
|
113
|
+
self.swRecordLayoutGroup = None # type: SwRecordLayoutGroup
|
|
114
|
+
|
|
115
|
+
def setSwRecordLayoutGroup(self, group: SwRecordLayoutGroup):
|
|
116
|
+
self.swRecordLayoutGroup = group
|
|
117
|
+
return self
|
|
118
|
+
|