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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
from abc import ABCMeta
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
from .ar_object import ARFloat, ARNumerical, ARObject
|
|
5
|
+
from .ar_ref import RefType
|
|
6
|
+
from .data_def_properties import ValueList
|
|
7
|
+
|
|
8
|
+
class SwValues(ARObject):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__()
|
|
11
|
+
|
|
12
|
+
self._v = [] # type: List[ARNumerical]
|
|
13
|
+
self.vt = None # type: float
|
|
14
|
+
|
|
15
|
+
def addV(self, v: ARNumerical):
|
|
16
|
+
self._v.append(v)
|
|
17
|
+
|
|
18
|
+
def getVs(self) -> List[ARNumerical]:
|
|
19
|
+
return self._v
|
|
20
|
+
|
|
21
|
+
class SwValueCont(ARObject):
|
|
22
|
+
def __init__(self):
|
|
23
|
+
super().__init__()
|
|
24
|
+
|
|
25
|
+
self.sw_arraysize = None # type: ValueList
|
|
26
|
+
self.unit_ref = None # type: RefType
|
|
27
|
+
self.sw_values_phys = None # type: SwValues
|
|
28
|
+
|
|
29
|
+
class SwGenericAxisParam(ARObject):
|
|
30
|
+
def __init__(self):
|
|
31
|
+
super().__init__()
|
|
32
|
+
|
|
33
|
+
self.swGenericAxisParamTypeRef = None # type: RefType
|
|
34
|
+
self.vf = [] # type: List[ARFloat]
|
|
35
|
+
class SwAxisGeneric(ARObject):
|
|
36
|
+
def __init__(self):
|
|
37
|
+
super().__init__()
|
|
38
|
+
|
|
39
|
+
self.swAxisTypeRef = None # type: RefType
|
|
40
|
+
self.swGenericAxisParam = [] # type: List[SwGenericAxisParam]
|
|
41
|
+
|
|
42
|
+
class SwCalprmAxisTypeProps(ARObject, metaclass = ABCMeta):
|
|
43
|
+
def __init__(self):
|
|
44
|
+
if type(self) == SwCalprmAxisTypeProps:
|
|
45
|
+
raise NotImplementedError("SwCalprmAxisTypeProps is an abstract class.")
|
|
46
|
+
|
|
47
|
+
super().__init__()
|
|
48
|
+
|
|
49
|
+
self.maxGradient = None # type: ARFloat
|
|
50
|
+
self.monotony = None # type: MonotonyEnum
|
|
51
|
+
|
|
52
|
+
class SwAxisIndividual(SwCalprmAxisTypeProps):
|
|
53
|
+
def __init__(self):
|
|
54
|
+
super().__init__()
|
|
55
|
+
|
|
56
|
+
self.compuMethodRef = None # type: RefType
|
|
57
|
+
self.dataConstrRef = None # type: RefType
|
|
58
|
+
self.inputVariableTypeRef = None # type: RefType
|
|
59
|
+
self.swAxisGeneric = None # type: SwAxisGeneric
|
|
60
|
+
self.swMaxAxisPoints = None # type: ARNumerical
|
|
61
|
+
self.swMinAxisPoints = None # type: ARNumerical
|
|
62
|
+
self.swVariableRefs = [] # type: List
|
|
63
|
+
self.unitRef = None # type: RefType
|
|
64
|
+
|
|
65
|
+
def setInputVariableTypeRef(self, ref: RefType):
|
|
66
|
+
self.inputVariableTypeRef = ref
|
|
67
|
+
return self
|
|
68
|
+
|
|
69
|
+
def setCompuMethodRef(self, ref: RefType):
|
|
70
|
+
self.compuMethodRef = ref
|
|
71
|
+
return self
|
|
72
|
+
|
|
73
|
+
def setSwMaxAxisPoints(self, points: int):
|
|
74
|
+
self.swMaxAxisPoints = points
|
|
75
|
+
return self
|
|
76
|
+
|
|
77
|
+
def setSwMinAxisPoints(self, points: int):
|
|
78
|
+
self.swMinAxisPoints = points
|
|
79
|
+
return self
|
|
80
|
+
|
|
81
|
+
def setDataConstrRef(self, ref: RefType):
|
|
82
|
+
self.dataConstrRef = ref
|
|
83
|
+
return self
|
|
84
|
+
|
|
85
|
+
class SwAxisGrouped(SwCalprmAxisTypeProps):
|
|
86
|
+
def __init__(self):
|
|
87
|
+
super().__init__()
|
|
88
|
+
|
|
89
|
+
self.sharedAxisTypeRef = None # type: RefType
|
|
90
|
+
self.swAxisIndex = None # type: ARNumerical
|
|
91
|
+
self.swCalprmRef = None # type: SwCalprmRefProxy
|
|
92
|
+
|
|
93
|
+
def setSharedAxisTypeRef(self, ref: RefType):
|
|
94
|
+
self.sharedAxisTypeRef = ref
|
|
95
|
+
return self
|
|
96
|
+
|
|
97
|
+
class SwCalprmAxis(ARObject):
|
|
98
|
+
def __init__(self):
|
|
99
|
+
super().__init__()
|
|
100
|
+
|
|
101
|
+
self.category = None # type: CalprmAxisCategoryEnum
|
|
102
|
+
self.displayFormat = None # type: DisplayFormatString
|
|
103
|
+
self.sw_axis_index = None # type: AxisIndexType
|
|
104
|
+
self.swCalibrationAccess = None # type: SwCalibrationAccessEnum
|
|
105
|
+
self.sw_calprm_axis_type_props = None # type: SwCalprmAxisTypeProps
|
|
106
|
+
|
|
107
|
+
class SwCalprmAxisSet(ARObject):
|
|
108
|
+
def __init__(self):
|
|
109
|
+
super().__init__()
|
|
110
|
+
|
|
111
|
+
self._swCalprmAxis = [] # type: List[SwCalprmAxis]
|
|
112
|
+
|
|
113
|
+
def addSwCalprmAxis(self, axis: SwCalprmAxis):
|
|
114
|
+
self._swCalprmAxis.append(axis)
|
|
115
|
+
|
|
116
|
+
def getSwCalprmAxises(self) -> List[SwCalprmAxis]:
|
|
117
|
+
return self._swCalprmAxis
|
|
118
|
+
|
|
119
|
+
|
|
@@ -3,20 +3,113 @@
|
|
|
3
3
|
from abc import ABCMeta
|
|
4
4
|
from typing import List
|
|
5
5
|
|
|
6
|
+
from .ar_object import ARFloat, ARLiteral, ARNumerical
|
|
6
7
|
from .general_structure import ARObject, ARElement, Identifiable
|
|
7
8
|
from .data_dictionary import SwDataDefProps
|
|
8
|
-
from .ar_ref import RefType
|
|
9
|
+
from .ar_ref import RefType, TRefType
|
|
9
10
|
|
|
10
11
|
import re
|
|
11
12
|
|
|
12
13
|
class ValueSpecification(ARObject, metaclass=ABCMeta):
|
|
14
|
+
'''
|
|
15
|
+
Base class for expressions leading to a value which can be used to initialize a data object.
|
|
16
|
+
|
|
17
|
+
Base : ARObject
|
|
18
|
+
Subclasses : AbstractRuleBasedValueSpecification, ApplicationValueSpecification, CompositeValueSpecification,
|
|
19
|
+
ConstantReference, NotAvailableValueSpecification, NumericalValueSpecification, ReferenceValueSpecification,
|
|
20
|
+
TextValueSpecification
|
|
21
|
+
'''
|
|
13
22
|
def __init__(self):
|
|
14
23
|
if type(self) == ValueSpecification:
|
|
15
24
|
raise NotImplementedError("ValueSpecification is an abstract class.")
|
|
25
|
+
|
|
16
26
|
super().__init__()
|
|
17
27
|
|
|
18
28
|
self.short_label = None
|
|
19
29
|
|
|
30
|
+
class CompositeRuleBasedValueArgument(ValueSpecification, metaclass=ABCMeta):
|
|
31
|
+
'''
|
|
32
|
+
This meta-class has the ability to serve as the abstract base class for ValueSpecifications that can be
|
|
33
|
+
used for compound primitive data types.
|
|
34
|
+
|
|
35
|
+
Base : ARObject
|
|
36
|
+
Subclasses : ApplicationRuleBasedValueSpecification, ApplicationValueSpecification
|
|
37
|
+
'''
|
|
38
|
+
def __init__(self):
|
|
39
|
+
if type(self) == CompositeRuleBasedValueArgument:
|
|
40
|
+
raise NotImplementedError("CompositeRuleBasedValueArgument is an abstract class.")
|
|
41
|
+
|
|
42
|
+
super().__init__()
|
|
43
|
+
|
|
44
|
+
class CompositeValueSpecification(ValueSpecification, metaclass=ABCMeta):
|
|
45
|
+
'''
|
|
46
|
+
This abstract meta-class acts a base class for ValueSpecifications that have a composite form.
|
|
47
|
+
|
|
48
|
+
Base : ARObject, ValueSpecification
|
|
49
|
+
Subclasses : ArrayValueSpecification, RecordValueSpecification
|
|
50
|
+
'''
|
|
51
|
+
def __init__(self):
|
|
52
|
+
if type(self) == CompositeValueSpecification:
|
|
53
|
+
raise NotImplementedError("CompositeValueSpecification is an abstract class.")
|
|
54
|
+
|
|
55
|
+
super().__init__()
|
|
56
|
+
|
|
57
|
+
class ApplicationValueSpecification(CompositeRuleBasedValueArgument):
|
|
58
|
+
'''
|
|
59
|
+
This meta-class represents values for DataPrototypes typed by ApplicationDataTypes (this includes in
|
|
60
|
+
particular compound primitives).
|
|
61
|
+
For further details refer to ASAM CDF 2.0. This meta-class corresponds to some extent with
|
|
62
|
+
SW-INSTANCE in ASAM CDF 2.0.
|
|
63
|
+
|
|
64
|
+
Base ARObject, CompositeRuleBasedValueArgument, ValueSpecification
|
|
65
|
+
'''
|
|
66
|
+
def __init__(self):
|
|
67
|
+
super().__init__()
|
|
68
|
+
|
|
69
|
+
self.category = None
|
|
70
|
+
self.sw_Axis_cont = []
|
|
71
|
+
self.sw_value_cont = None
|
|
72
|
+
|
|
73
|
+
class RecordValueSpecification(CompositeValueSpecification):
|
|
74
|
+
'''
|
|
75
|
+
Specifies the values for a record.
|
|
76
|
+
|
|
77
|
+
Base : ARObject, CompositeValueSpecification, ValueSpecification
|
|
78
|
+
'''
|
|
79
|
+
def __init__(self):
|
|
80
|
+
super().__init__()
|
|
81
|
+
|
|
82
|
+
self._fields = []
|
|
83
|
+
|
|
84
|
+
def add_field(self, field: ValueSpecification):
|
|
85
|
+
self._fields.append(field)
|
|
86
|
+
|
|
87
|
+
def get_fields(self) -> List[ValueSpecification]:
|
|
88
|
+
return self._fields
|
|
89
|
+
|
|
90
|
+
class TextValueSpecification(ValueSpecification):
|
|
91
|
+
def __init__(self):
|
|
92
|
+
super().__init__()
|
|
93
|
+
|
|
94
|
+
self.value = None # type: str
|
|
95
|
+
|
|
96
|
+
class NumericalValueSpecification(ValueSpecification):
|
|
97
|
+
def __init__(self):
|
|
98
|
+
super().__init__()
|
|
99
|
+
|
|
100
|
+
self.value = None # type: ARFloat
|
|
101
|
+
|
|
102
|
+
class ArrayValueSpecification(ValueSpecification):
|
|
103
|
+
def __init__(self):
|
|
104
|
+
super().__init__()
|
|
105
|
+
|
|
106
|
+
self._element = [] # type: List[ValueSpecification]
|
|
107
|
+
|
|
108
|
+
def add_element(self, element: ValueSpecification):
|
|
109
|
+
self._element.append(element)
|
|
110
|
+
|
|
111
|
+
def get_elements(self) -> List[ValueSpecification]:
|
|
112
|
+
return self._element
|
|
20
113
|
|
|
21
114
|
class ConstantSpecification(ARElement):
|
|
22
115
|
def __init__(self, parent, short_name):
|
|
@@ -41,10 +134,10 @@ class ImplementationDataTypeElement(AbstractImplementationDataTypeElement):
|
|
|
41
134
|
def __init__(self, parent, short_name: str):
|
|
42
135
|
super().__init__(parent, short_name)
|
|
43
136
|
|
|
44
|
-
self.
|
|
45
|
-
self.array_size_semantics = None
|
|
46
|
-
self.
|
|
47
|
-
self.sw_data_def_props = None
|
|
137
|
+
self.arraySize = None # type: int
|
|
138
|
+
self.array_size_semantics = None # type: str
|
|
139
|
+
self.isOptional = None # type: bool
|
|
140
|
+
self.sw_data_def_props = None # type: SwDataDefProps
|
|
48
141
|
|
|
49
142
|
def createImplementationDataTypeElement(self, short_name: str): # type: (...) -> ImplementationDataTypeElement
|
|
50
143
|
if (short_name not in self.elements):
|
|
@@ -52,7 +145,7 @@ class ImplementationDataTypeElement(AbstractImplementationDataTypeElement):
|
|
|
52
145
|
self.elements[short_name] = event
|
|
53
146
|
return self.elements[short_name]
|
|
54
147
|
|
|
55
|
-
def getImplementationDataTypeElements(self): # type:(...) -> List[ImplementationDataTypeElement]
|
|
148
|
+
def getImplementationDataTypeElements(self): # type:(...) -> List[ImplementationDataTypeElement]
|
|
56
149
|
return list(filter(lambda c: isinstance(c, ImplementationDataTypeElement), self.elements.values()))
|
|
57
150
|
|
|
58
151
|
class ExclusiveArea(Identifiable):
|
|
@@ -65,13 +158,13 @@ class InternalBehavior(Identifiable, metaclass=ABCMeta):
|
|
|
65
158
|
raise NotImplementedError("InternalBehavior is an abstract class.")
|
|
66
159
|
super().__init__(parent, short_name)
|
|
67
160
|
|
|
68
|
-
self.
|
|
161
|
+
self._dataTypeMappingRefs = [] # type: List[RefType]
|
|
69
162
|
|
|
70
163
|
def addDataTypeMappingRef(self, ref: RefType):
|
|
71
|
-
self.
|
|
164
|
+
self._dataTypeMappingRefs.append(ref)
|
|
72
165
|
|
|
73
166
|
def getDataTypeMappingRefs(self) -> List[RefType]:
|
|
74
|
-
return self.
|
|
167
|
+
return self._dataTypeMappingRefs
|
|
75
168
|
|
|
76
169
|
def createExclusiveArea(self, short_name: str) -> ExclusiveArea:
|
|
77
170
|
if (short_name not in self.elements):
|
|
@@ -86,7 +179,14 @@ class ModeDeclaration(Identifiable):
|
|
|
86
179
|
def __init__(self, parent: ARObject, short_name: str):
|
|
87
180
|
super().__init__(parent, short_name)
|
|
88
181
|
|
|
89
|
-
self.value =
|
|
182
|
+
self.value = None # type: ARNumerical
|
|
183
|
+
|
|
184
|
+
def setValue(self, value):
|
|
185
|
+
self.value = value
|
|
186
|
+
return self
|
|
187
|
+
|
|
188
|
+
def getValue(self) -> ARNumerical:
|
|
189
|
+
return self.value
|
|
90
190
|
|
|
91
191
|
class ExecutableEntity(Identifiable, metaclass=ABCMeta):
|
|
92
192
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -94,20 +194,22 @@ class ExecutableEntity(Identifiable, metaclass=ABCMeta):
|
|
|
94
194
|
raise NotImplementedError("ExecutableEntity is an abstract class.")
|
|
95
195
|
super().__init__(parent, short_name)
|
|
96
196
|
|
|
97
|
-
self.activation_reason = None
|
|
98
|
-
self.minimum_start_interval =
|
|
99
|
-
self.reentrancy_level = None
|
|
100
|
-
self.
|
|
197
|
+
self.activation_reason = None # *
|
|
198
|
+
self.minimum_start_interval = None # type: ARFloat
|
|
199
|
+
self.reentrancy_level = None #
|
|
200
|
+
self._can_enter_exclusive_area_refs = [] # type: List[RefType]
|
|
101
201
|
|
|
102
202
|
@property
|
|
103
203
|
def minimum_start_interval_ms(self) -> int:
|
|
104
|
-
|
|
204
|
+
if self.minimum_start_interval is not None:
|
|
205
|
+
return int(self.minimum_start_interval.getValue() * 1000)
|
|
206
|
+
return None
|
|
105
207
|
|
|
106
208
|
def addCanEnterExclusiveAreaRef(self, ref: RefType):
|
|
107
|
-
self.
|
|
209
|
+
self._can_enter_exclusive_area_refs.append(ref)
|
|
108
210
|
|
|
109
211
|
def getCanEnterExclusiveAreaRefs(self):
|
|
110
|
-
return self.
|
|
212
|
+
return self._can_enter_exclusive_area_refs
|
|
111
213
|
|
|
112
214
|
class ModeDeclarationGroupPrototype(Identifiable):
|
|
113
215
|
"""
|
|
@@ -116,44 +218,55 @@ class ModeDeclarationGroupPrototype(Identifiable):
|
|
|
116
218
|
|
|
117
219
|
def __init__(self, parent: ARObject, short_name: str):
|
|
118
220
|
super().__init__(parent, short_name)
|
|
119
|
-
|
|
120
|
-
self.
|
|
221
|
+
|
|
222
|
+
self._swCalibrationAccess = None # type: str
|
|
223
|
+
self.typeTRef = None # type: TRefType
|
|
121
224
|
|
|
122
225
|
@property
|
|
123
226
|
def sw_calibration_access(self):
|
|
124
|
-
return self.
|
|
227
|
+
return self._swCalibrationAccess
|
|
125
228
|
|
|
126
229
|
@sw_calibration_access.setter
|
|
127
230
|
def sw_calibration_access(self, value):
|
|
128
231
|
if (value not in ("notAccessible", "readOnly", "readWrite")):
|
|
129
232
|
raise ValueError("Invalid SwCalibrationAccess <%s> of ModeDeclarationGroupPrototype <%s>" % (value, self.short_name))
|
|
130
|
-
self.
|
|
233
|
+
self._swCalibrationAccess = value
|
|
131
234
|
|
|
132
235
|
class MemorySection(Identifiable):
|
|
133
236
|
def __init__(self, parent: ARObject, short_name: str):
|
|
134
237
|
super().__init__(parent, short_name)
|
|
135
238
|
|
|
136
|
-
self._alignment = None
|
|
137
|
-
self.
|
|
239
|
+
self._alignment = None # type: ARLiteral
|
|
240
|
+
self.size = None
|
|
241
|
+
self._options = [] # type: List[ARLiteral]
|
|
242
|
+
self.swAddrMethodRef = None # type: RefType
|
|
243
|
+
self.symbol = None # type: ARLiteral
|
|
244
|
+
|
|
245
|
+
def addOption(self, option: ARLiteral):
|
|
246
|
+
self._options.append(option)
|
|
247
|
+
|
|
248
|
+
def getOptions(self) -> List[ARLiteral]:
|
|
249
|
+
return self._options
|
|
138
250
|
|
|
139
251
|
@property
|
|
140
|
-
def alignment(self) ->
|
|
252
|
+
def alignment(self) -> ARLiteral:
|
|
141
253
|
return self._alignment
|
|
142
254
|
|
|
143
255
|
@alignment.setter
|
|
144
|
-
def alignment(self, value:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
match = True
|
|
149
|
-
else:
|
|
150
|
-
m = re.match(r'^\d+', value)
|
|
151
|
-
if m:
|
|
256
|
+
def alignment(self, value: ARLiteral):
|
|
257
|
+
if value is not None:
|
|
258
|
+
match = False
|
|
259
|
+
if value.value in ("UNKNOWN", "UNSPECIFIED", "BOOLEAN", "PTR"):
|
|
152
260
|
self._alignment = value
|
|
153
261
|
match = True
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
262
|
+
else:
|
|
263
|
+
m = re.match(r'^\d+', value.value)
|
|
264
|
+
if m:
|
|
265
|
+
self._alignment = value
|
|
266
|
+
match = True
|
|
267
|
+
|
|
268
|
+
if not match:
|
|
269
|
+
raise ValueError("Invalid alignment <%s> of memory section <%s>" % (value, self.short_name))
|
|
157
270
|
|
|
158
271
|
|
|
159
272
|
class ResourceConsumption(Identifiable):
|
|
@@ -170,4 +283,58 @@ class ResourceConsumption(Identifiable):
|
|
|
170
283
|
return list(filter(lambda a : isinstance(a, MemorySection), self.elements.values()))
|
|
171
284
|
|
|
172
285
|
def getMemorySection(self, short_name: str) -> MemorySection:
|
|
173
|
-
return next(filter(lambda o: isinstance(o, MemorySection) and (o.short_name == short_name), self.elements.values()), None)
|
|
286
|
+
return next(filter(lambda o: isinstance(o, MemorySection) and (o.short_name == short_name), self.elements.values()), None)
|
|
287
|
+
|
|
288
|
+
class Trigger(Identifiable):
|
|
289
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
290
|
+
super().__init__(parent, short_name)
|
|
291
|
+
|
|
292
|
+
self.swImplPolicy = None # type: str
|
|
293
|
+
self.triggerPeriod = None # type: float
|
|
294
|
+
|
|
295
|
+
class ModeRequestTypeMap(ARObject):
|
|
296
|
+
def __init__(self):
|
|
297
|
+
super().__init__()
|
|
298
|
+
|
|
299
|
+
self.implementation_data_type_ref = None # type: RefType
|
|
300
|
+
self.mode_group_ref = None # type: RefType
|
|
301
|
+
|
|
302
|
+
class ModeDeclarationGroup(Identifiable):
|
|
303
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
304
|
+
super().__init__(parent, short_name)
|
|
305
|
+
|
|
306
|
+
self._initial_mode_ref = None # type: RefType
|
|
307
|
+
self._on_transition_value = None # type: ARNumerical
|
|
308
|
+
|
|
309
|
+
def createModeDeclaration(self, short_name: str) -> ModeDeclaration:
|
|
310
|
+
if (short_name not in self.elements):
|
|
311
|
+
spec = ModeDeclaration(self, short_name)
|
|
312
|
+
self.elements[short_name] = spec
|
|
313
|
+
return self.elements[short_name]
|
|
314
|
+
|
|
315
|
+
def getModeDeclarations(self) -> List[ModeDeclaration]:
|
|
316
|
+
return list(sorted(filter(lambda a: isinstance(a, ModeDeclaration), self.elements.values()), key= lambda o:o.short_name))
|
|
317
|
+
|
|
318
|
+
def setInitialModeRef(self, ref: RefType):
|
|
319
|
+
self._initial_mode_ref = ref
|
|
320
|
+
return self
|
|
321
|
+
|
|
322
|
+
def getInitialModeRef(self) -> RefType:
|
|
323
|
+
return self._initial_mode_ref
|
|
324
|
+
|
|
325
|
+
def setOnTransitionValue(self, value):
|
|
326
|
+
if isinstance(value, int):
|
|
327
|
+
value = ARNumerical()
|
|
328
|
+
value.setValue(value)
|
|
329
|
+
self._on_transition_value = value
|
|
330
|
+
return self
|
|
331
|
+
|
|
332
|
+
def getOnTransitionValue(self) -> ARNumerical:
|
|
333
|
+
return self._on_transition_value
|
|
334
|
+
|
|
335
|
+
class ModeDeclarationGroupPrototype(Identifiable):
|
|
336
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
337
|
+
super().__init__(parent, short_name)
|
|
338
|
+
|
|
339
|
+
self.swCalibrationAccess = None # type: str
|
|
340
|
+
self.type_tref = None # type: TRefType
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from .data_dictionary import SwDataDefProps
|
|
3
|
+
from .ar_ref import ApplicationCompositeElementInPortInterfaceInstanceRef
|
|
4
|
+
from .ar_object import ARObject
|
|
5
|
+
|
|
6
|
+
class TransmissionAcknowledgementRequest(ARObject):
|
|
7
|
+
def __init__(self):
|
|
8
|
+
super().__init__()
|
|
9
|
+
|
|
10
|
+
self.timeout = None # type: float
|
|
11
|
+
|
|
12
|
+
class CompositeNetworkRepresentation(ARObject):
|
|
13
|
+
def __init__(self):
|
|
14
|
+
super().__init__()
|
|
15
|
+
|
|
16
|
+
self.leaf_element_iref = None # type: ApplicationCompositeElementInPortInterfaceInstanceRef
|
|
17
|
+
self.network_representation = None # type: SwDataDefProps
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
from .ar_object import ARFloat, ARLiteral, ARObject
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ValueList(ARObject):
|
|
6
|
+
def __init__(self):
|
|
7
|
+
super().__init__()
|
|
8
|
+
|
|
9
|
+
self.v = None # type: ARFloat
|
|
10
|
+
self._vf = [] # type: List[ARLiteral]
|
|
11
|
+
|
|
12
|
+
def addVf(self, vf: ARLiteral):
|
|
13
|
+
self._vf.append(vf)
|
|
14
|
+
|
|
15
|
+
def getVfs(self) -> List[ARLiteral]:
|
|
16
|
+
return sorted(self._vf)
|
|
@@ -1,17 +1,44 @@
|
|
|
1
|
-
from
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from .ar_object import ARFloat, ARLiteral
|
|
4
|
+
from .calibration import SwCalprmAxisSet
|
|
5
|
+
from .annotation import Annotation
|
|
6
|
+
from .general_structure import ARObject, Identifiable
|
|
2
7
|
from .ar_ref import RefType
|
|
3
8
|
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SwDataDefPropsConditional(ARObject):
|
|
12
|
+
def __init__(self):
|
|
13
|
+
super().__init__()
|
|
14
|
+
|
|
4
15
|
class SwDataDefProps(ARObject):
|
|
5
16
|
def __init__(self):
|
|
6
17
|
super().__init__()
|
|
7
18
|
|
|
8
|
-
self.
|
|
9
|
-
self.
|
|
10
|
-
self.
|
|
11
|
-
self.
|
|
12
|
-
self.
|
|
13
|
-
self.
|
|
14
|
-
self.
|
|
19
|
+
self._annotations = [] # type: List[Annotation]
|
|
20
|
+
self.baseTypeRef = None # type: RefType
|
|
21
|
+
self.compuMethodRef = None # type: RefType
|
|
22
|
+
self.dataConstrRef = None # type: RefType
|
|
23
|
+
self.implementationDataTypeRef = None # type: RefType
|
|
24
|
+
self.swImplPolicy = None # type: str
|
|
25
|
+
self.swCalibrationAccess = None # type: str
|
|
26
|
+
self.swCalprmAxisSet = None # type: SwCalprmAxisSet
|
|
27
|
+
self.sw_pointer_target_props = None # type: SwPointerTargetProps
|
|
28
|
+
self.swRecordLayoutRef = None # type: RefType
|
|
29
|
+
self.valueAxisDataTypeRef = None # type: RefType
|
|
30
|
+
self.unitRef = None # type: RefType
|
|
31
|
+
self.conditional = SwDataDefPropsConditional() # type: SwDataDefPropsConditional
|
|
32
|
+
|
|
33
|
+
def addAnnotation(self, annotation: Annotation):
|
|
34
|
+
self._annotations.append(annotation)
|
|
35
|
+
|
|
36
|
+
def getAnnotations(self) -> List[Annotation]:
|
|
37
|
+
return self._annotations
|
|
38
|
+
|
|
39
|
+
def setUnitRef(self, ref: RefType):
|
|
40
|
+
self.unitRef = ref
|
|
41
|
+
return self
|
|
15
42
|
|
|
16
43
|
class SwPointerTargetProps(ARObject):
|
|
17
44
|
def __init__(self):
|
|
@@ -19,4 +46,14 @@ class SwPointerTargetProps(ARObject):
|
|
|
19
46
|
|
|
20
47
|
self.function_pointer_signature = None # type: RefType
|
|
21
48
|
self.sw_data_def_props = None # type: SwDataDefProps
|
|
22
|
-
self.target_category =
|
|
49
|
+
self.target_category = None
|
|
50
|
+
|
|
51
|
+
class SwAddrMethod(Identifiable):
|
|
52
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
53
|
+
super().__init__(parent, short_name)
|
|
54
|
+
|
|
55
|
+
self.memoryAllocationKeywordPolicy = None # type: MemoryAllocationKeywordPolicyType
|
|
56
|
+
self.option = [] # type: str
|
|
57
|
+
self.sectionInitializationPolicy = None # type: SectionInitializationPolicyType
|
|
58
|
+
self.sectionType = None # type: MemorySectionType
|
|
59
|
+
|
armodel/models/data_prototype.py
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
from abc import ABCMeta
|
|
2
|
-
|
|
3
|
-
from .
|
|
2
|
+
|
|
3
|
+
from .ar_object import ARNumerical
|
|
4
4
|
from .ar_ref import RefType
|
|
5
|
+
from .data_dictionary import SwDataDefProps
|
|
6
|
+
from .common_structure import ValueSpecification
|
|
7
|
+
from .general_structure import AtpFeature, ARObject
|
|
5
8
|
|
|
6
9
|
class AtpPrototype(AtpFeature, metaclass = ABCMeta):
|
|
7
10
|
def __init__(self, parent:ARObject, short_name: str):
|
|
@@ -25,25 +28,41 @@ class AutosarDataPrototype(DataPrototype, metaclass = ABCMeta):
|
|
|
25
28
|
raise NotImplementedError("AutosarDataPrototype is an abstract class.")
|
|
26
29
|
|
|
27
30
|
super().__init__(parent, short_name)
|
|
28
|
-
|
|
31
|
+
|
|
32
|
+
self.type_tref = None
|
|
29
33
|
|
|
30
34
|
class VariableDataPrototype(AutosarDataPrototype):
|
|
31
35
|
def __init__(self, parent:ARObject, short_name: str):
|
|
32
36
|
super().__init__(parent, short_name)
|
|
33
37
|
|
|
38
|
+
self.init_value = None # type: ValueSpecification
|
|
39
|
+
|
|
34
40
|
class ApplicationCompositeElementDataPrototype(DataPrototype, metaclass = ABCMeta):
|
|
35
41
|
def __init__(self, parent:ARObject, short_name: str):
|
|
36
42
|
if type(self) == ApplicationCompositeElementDataPrototype:
|
|
37
43
|
raise NotImplementedError("ApplicationCompositeElementDataPrototype is an abstract class.")
|
|
38
44
|
|
|
39
45
|
super().__init__(parent, short_name)
|
|
40
|
-
|
|
46
|
+
|
|
47
|
+
self.typeTRef = None # type: RefType
|
|
41
48
|
|
|
42
49
|
class ApplicationArrayElement(ApplicationCompositeElementDataPrototype):
|
|
43
50
|
def __init__(self, parent:ARObject, short_name: str):
|
|
44
51
|
super().__init__(parent, short_name)
|
|
45
52
|
|
|
53
|
+
self.arraySizeHandling = None # type: str
|
|
54
|
+
self.arraySizeSemantics = None # type: str
|
|
55
|
+
self.indexDataTypeRef = None # type: RefType
|
|
56
|
+
self.maxNumberOfElements = None # type: ARNumerical
|
|
57
|
+
|
|
46
58
|
class ApplicationRecordElement(ApplicationCompositeElementDataPrototype):
|
|
47
59
|
def __init__(self, parent:ARObject, short_name: str):
|
|
48
60
|
super().__init__(parent, short_name)
|
|
49
|
-
|
|
61
|
+
|
|
62
|
+
self.isOptional = None
|
|
63
|
+
|
|
64
|
+
class ParameterDataPrototype(AutosarDataPrototype):
|
|
65
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
66
|
+
super().__init__(parent, short_name)
|
|
67
|
+
|
|
68
|
+
self.init_value = None # type: ValueSpecification
|