armodel 1.4.3__py3-none-any.whl → 1.6.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.
- armodel/cli/arxml_dump_cli.py +14 -14
- armodel/cli/memory_section_cli.py +76 -0
- armodel/cli/system_signal_cli.py +74 -0
- armodel/lib/__init__.py +2 -1
- armodel/lib/system_signal.py +37 -0
- armodel/models/__init__.py +6 -3
- armodel/models/annotation.py +27 -3
- armodel/models/ar_object.py +18 -6
- armodel/models/ar_package.py +248 -30
- armodel/models/ar_ref.py +115 -45
- armodel/models/bsw_module_template.py +66 -28
- armodel/models/common_structure.py +150 -150
- armodel/models/communication.py +1 -1
- armodel/models/data_prototype.py +41 -6
- armodel/models/datatype.py +11 -5
- armodel/models/fibex/__init__.py +0 -0
- armodel/models/fibex/can_communication.py +122 -0
- armodel/models/fibex/fibex_4_can/__init__.py +0 -0
- armodel/models/fibex/fibex_4_lin/__init__.py +0 -0
- armodel/models/fibex/fibex_4_multiplatform.py +138 -0
- armodel/models/fibex/fibex_core/__init__.py +0 -0
- armodel/models/fibex/fibex_core/core_communication.py +627 -0
- armodel/models/fibex/fibex_core/core_topology.py +180 -0
- armodel/models/fibex/fibex_core.py +341 -0
- armodel/models/fibex/lin_communication.py +38 -0
- armodel/models/fibex/lin_topology.py +7 -0
- armodel/models/general_structure.py +119 -10
- armodel/models/implementation.py +4 -5
- armodel/models/internal_behavior.py +63 -0
- armodel/models/m2/__init__.py +0 -0
- armodel/models/m2/autosar_templates/__init__.py +0 -0
- armodel/models/m2/autosar_templates/common_structure/__init__.py +188 -0
- armodel/models/m2/autosar_templates/common_structure/constants.py +0 -0
- armodel/models/m2/autosar_templates/ecuc_description_template.py +268 -0
- armodel/models/m2/autosar_templates/sw_component_template/__init__.py +0 -0
- armodel/models/m2/autosar_templates/sw_component_template/communication.py +316 -0
- armodel/models/m2/autosar_templates/sw_component_template/components/__init__.py +0 -0
- armodel/models/m2/autosar_templates/sw_component_template/components/instance_refs.py +149 -0
- armodel/models/m2/autosar_templates/sw_component_template/port_interface.py +236 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/__init__.py +203 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/access_count.py +13 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/data_elements.py +54 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/mode_declaration_group.py +39 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py +26 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/trigger.py +10 -0
- armodel/models/m2/autosar_templates/system_template/__init__.py +321 -0
- armodel/models/m2/autosar_templates/system_template/data_mapping.py +88 -0
- armodel/models/m2/autosar_templates/system_template/network_management.py +554 -0
- armodel/models/m2/autosar_templates/system_template/transport_protocols.py +7 -0
- armodel/models/m2/msr/__init__.py +0 -0
- armodel/models/m2/msr/asam_hdo/__init__.py +0 -0
- armodel/models/m2/msr/asam_hdo/units.py +105 -0
- armodel/models/m2/msr/data_dictionary/__init__.py +0 -0
- armodel/models/m2/msr/data_dictionary/auxillary_objects.py +42 -0
- armodel/models/m2/msr/data_dictionary/data_def_properties.py +295 -0
- armodel/models/m2/msr/documentation/__init__.py +0 -0
- armodel/models/m2/msr/documentation/block_elements.py +18 -0
- armodel/models/mode_declaration.py +8 -0
- armodel/models/multilanguage_data.py +15 -0
- armodel/models/per_instance_memory.py +34 -6
- armodel/models/port_prototype.py +15 -159
- armodel/models/rpt_scenario.py +20 -0
- armodel/models/sw_component.py +48 -187
- armodel/models/system_template/__init__.py +0 -0
- armodel/models/system_template/network_management.py +7 -0
- armodel/models/system_template/transport_protocols.py +7 -0
- armodel/models/timing.py +91 -0
- armodel/parser/abstract_arxml_parser.py +11 -2
- armodel/parser/arxml_parser.py +1101 -227
- armodel/tests/test_armodel/models/test_ar_package.py +1 -1
- armodel/tests/test_armodel/models/test_ar_ref.py +3 -3
- armodel/tests/test_armodel/models/test_bsw_module_template.py +5 -5
- armodel/tests/test_armodel/models/test_common_structure.py +3 -3
- armodel/tests/test_armodel/models/test_data_dictionary.py +5 -5
- armodel/tests/test_armodel/models/test_data_prototype.py +2 -2
- armodel/tests/test_armodel/models/test_datatype.py +8 -8
- armodel/tests/test_armodel/models/test_port_interface.py +6 -6
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +16 -8
- armodel/tests/test_armodel/parser/test_sw_components.py +6 -6
- armodel/writer/arxml_writer.py +1046 -181
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/METADATA +48 -1
- armodel-1.6.0.dist-info/RECORD +127 -0
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/entry_points.txt +3 -1
- armodel-1.4.3.dist-info/RECORD +0 -78
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/LICENSE +0 -0
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/WHEEL +0 -0
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/top_level.txt +0 -0
armodel/models/sw_component.py
CHANGED
|
@@ -1,180 +1,19 @@
|
|
|
1
|
-
from typing import List
|
|
1
|
+
from typing import List
|
|
2
2
|
from abc import ABCMeta
|
|
3
3
|
|
|
4
|
+
from .m2.autosar_templates.sw_component_template.components.instance_refs import RModeInAtomicSwcInstanceRef, RVariableInAtomicSwcInstanceRef
|
|
5
|
+
from .m2.autosar_templates.sw_component_template.swc_internal_behavior import RunnableEntity
|
|
6
|
+
from .internal_behavior import IncludedDataTypeSet, InternalBehavior
|
|
4
7
|
from .service_mapping import RoleBasedPortAssignment
|
|
5
8
|
from .per_instance_memory import PerInstanceMemory
|
|
6
9
|
from .service_needs import NvBlockNeeds, RoleBasedDataAssignment, ServiceNeeds
|
|
7
10
|
from .ar_object import ARBoolean, ARLiteral
|
|
8
11
|
from .general_structure import ARElement, Identifiable, ARObject
|
|
9
|
-
from .ar_ref import
|
|
12
|
+
from .ar_ref import InnerPortGroupInCompositionInstanceRef, POperationInAtomicSwcInstanceRef, TRefType
|
|
10
13
|
from .ar_ref import RefType, PortInCompositionTypeInstanceRef, PPortInCompositionInstanceRef, RPortInCompositionInstanceRef
|
|
11
|
-
from .ar_ref import RVariableInAtomicSwcInstanceRef, RModeInAtomicSwcInstanceRef
|
|
12
14
|
from .port_prototype import RPortPrototype, PPortPrototype, PortPrototype
|
|
13
15
|
from .data_prototype import ParameterDataPrototype, VariableDataPrototype
|
|
14
|
-
from .common_structure import
|
|
15
|
-
|
|
16
|
-
class VariableAccess(Identifiable):
|
|
17
|
-
def __init__(self, parent: ARObject, short_name):
|
|
18
|
-
super().__init__(parent, short_name)
|
|
19
|
-
self.accessed_variable_ref = AutosarVariableRef()
|
|
20
|
-
self.accessed_variable_ref.parent = self
|
|
21
|
-
self.parent = parent
|
|
22
|
-
self.local_variable_ref = None # type: RefType
|
|
23
|
-
|
|
24
|
-
class AbstractAccessPoint(Identifiable):
|
|
25
|
-
__metaclass__ = ABCMeta
|
|
26
|
-
|
|
27
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
28
|
-
if type(self) == AbstractAccessPoint:
|
|
29
|
-
raise NotImplementedError("ARObject is an abstract class.")
|
|
30
|
-
|
|
31
|
-
super().__init__(parent, short_name)
|
|
32
|
-
|
|
33
|
-
self.return_value_provision = None
|
|
34
|
-
|
|
35
|
-
class ParameterAccess(AbstractAccessPoint):
|
|
36
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
37
|
-
super().__init__(parent, short_name)
|
|
38
|
-
|
|
39
|
-
self.accessed_parameter = None # type: AutosarParameterRef
|
|
40
|
-
self.sw_data_def_props = None #
|
|
41
|
-
|
|
42
|
-
class ServerCallPoint(AbstractAccessPoint):
|
|
43
|
-
__metaclass__ = ABCMeta
|
|
44
|
-
|
|
45
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
46
|
-
super().__init__(parent, short_name)
|
|
47
|
-
self.operation_iref = None # type: ROperationInAtomicSwcInstanceRef
|
|
48
|
-
self.timeout = None # type: float
|
|
49
|
-
|
|
50
|
-
class SynchronousServerCallPoint(ServerCallPoint):
|
|
51
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
52
|
-
super().__init__(parent, short_name)
|
|
53
|
-
|
|
54
|
-
self.called_from_within_exclusive_area_ref = None # Type: RefType
|
|
55
|
-
|
|
56
|
-
class AsynchronousServerCallPoint(ServerCallPoint):
|
|
57
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
58
|
-
super().__init__(parent, short_name)
|
|
59
|
-
|
|
60
|
-
class AsynchronousServerCallResultPoint(ServerCallPoint):
|
|
61
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
62
|
-
super().__init__(parent, short_name)
|
|
63
|
-
|
|
64
|
-
self.asynchronous_server_call_point_ref = None # Type:RefType
|
|
65
|
-
|
|
66
|
-
class InternalTriggeringPoint(AbstractAccessPoint):
|
|
67
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
68
|
-
super().__init__(parent, short_name)
|
|
69
|
-
|
|
70
|
-
self.sw_impl_policy = None
|
|
71
|
-
|
|
72
|
-
class RunnableEntity(ExecutableEntity):
|
|
73
|
-
def __init__(self, parent: ARObject, short_name: str):
|
|
74
|
-
super().__init__(parent, short_name)
|
|
75
|
-
self.can_be_invoked_concurrently = None # Type: ARBoolean
|
|
76
|
-
self.data_read_accesses = {} # Type: Dict[str, VariableAccess]
|
|
77
|
-
self.data_received_point_by_arguments = {} # Type: Dict[str, VariableAccess]
|
|
78
|
-
self.data_received_point_by_values = {} # Type: Dict[str, VariableAccess]
|
|
79
|
-
self.data_send_points = {} # Type: Dict[str, VariableAccess]
|
|
80
|
-
self.data_write_accesses = {} # Type: Dict[str, VariableAccess]
|
|
81
|
-
self.written_local_variables = {} # Type: Dict[str, VariableAccess]
|
|
82
|
-
self.read_local_variables = {} # Type: Dict[str, VariableAccess]
|
|
83
|
-
self.external_triggering_points = {} # Type: Dict[InternalTriggeringPoint]
|
|
84
|
-
self.internal_triggering_points = {}
|
|
85
|
-
self.mode_access_points = {}
|
|
86
|
-
self.mode_switch_points = {}
|
|
87
|
-
self.parameter_accesses = {} # Type: Dict[str, ParameterAccess]
|
|
88
|
-
self.server_call_points = {} # Type: Dict[str, ServerCallPoint]
|
|
89
|
-
self.wait_points = {} # Type: Dict[str, WaitPoint]
|
|
90
|
-
self.symbol = ""
|
|
91
|
-
|
|
92
|
-
def _createVariableAccess(self, short_name, variable_accesses: Dict[str, VariableAccess]):
|
|
93
|
-
if (short_name not in variable_accesses):
|
|
94
|
-
variable_access = VariableAccess(self, short_name)
|
|
95
|
-
variable_accesses[short_name] = variable_access
|
|
96
|
-
return variable_accesses[short_name]
|
|
97
|
-
|
|
98
|
-
def createDataReadAccess(self, short_name: str) -> VariableAccess:
|
|
99
|
-
return self._createVariableAccess(short_name, self.data_read_accesses)
|
|
100
|
-
|
|
101
|
-
def getDataReadAccesses(self) -> List[VariableAccess]:
|
|
102
|
-
return sorted(self.data_read_accesses.values(), key=lambda v: v.short_name)
|
|
103
|
-
|
|
104
|
-
def createDataWriteAccess(self, short_name: str) -> VariableAccess:
|
|
105
|
-
return self._createVariableAccess(short_name, self.data_write_accesses)
|
|
106
|
-
|
|
107
|
-
def getDataWriteAccesses(self) -> List[VariableAccess]:
|
|
108
|
-
return sorted(self.data_write_accesses.values(), key=lambda v: v.short_name)
|
|
109
|
-
|
|
110
|
-
def createDataReceivePointByArgument(self, short_name: str) -> VariableAccess:
|
|
111
|
-
return self._createVariableAccess(short_name, self.data_received_point_by_arguments)
|
|
112
|
-
|
|
113
|
-
def getDataReceivePointByArguments(self) -> List[VariableAccess]:
|
|
114
|
-
return sorted(self.data_received_point_by_arguments.values(), key=lambda v: v.short_name)
|
|
115
|
-
|
|
116
|
-
def createDataReceivePointByValue(self, short_name: str) -> VariableAccess:
|
|
117
|
-
return self._createVariableAccess(short_name, self.data_received_point_by_values)
|
|
118
|
-
|
|
119
|
-
def getDataReceivePointByValues(self) -> List[VariableAccess]:
|
|
120
|
-
return sorted(self.data_received_point_by_values.values(), key=lambda v: v.short_name)
|
|
121
|
-
|
|
122
|
-
def createDataSendPoint(self, short_name: str) -> VariableAccess:
|
|
123
|
-
return self._createVariableAccess(short_name, self.data_send_points)
|
|
124
|
-
|
|
125
|
-
def getDataSendPoints(self) -> List[VariableAccess]:
|
|
126
|
-
return sorted(self.data_send_points.values(), key=lambda v: v.short_name)
|
|
127
|
-
|
|
128
|
-
def createReadLocalVariable(self, short_name: str) -> VariableAccess:
|
|
129
|
-
return self._createVariableAccess(short_name, self.read_local_variables)
|
|
130
|
-
|
|
131
|
-
def getReadLocalVariables(self) -> List[VariableAccess]:
|
|
132
|
-
return sorted(self.read_local_variables.values(), key=lambda v: v.short_name)
|
|
133
|
-
|
|
134
|
-
def createWrittenLocalVariable(self, short_name: str) -> VariableAccess:
|
|
135
|
-
return self._createVariableAccess(short_name, self.written_local_variables)
|
|
136
|
-
|
|
137
|
-
def getWrittenLocalVariables(self) -> List[VariableAccess]:
|
|
138
|
-
return sorted(self.written_local_variables.values(), key=lambda v: v.short_name)
|
|
139
|
-
|
|
140
|
-
def createParameterAccess(self, short_name: str) -> ParameterAccess:
|
|
141
|
-
if (short_name not in self.server_call_points):
|
|
142
|
-
parameter_access = ParameterAccess(self, short_name)
|
|
143
|
-
self.parameter_accesses[short_name] = parameter_access
|
|
144
|
-
return self.parameter_accesses[short_name]
|
|
145
|
-
|
|
146
|
-
def getParameterAccesses(self) -> List[ParameterAccess]:
|
|
147
|
-
return sorted(self.parameter_accesses.values(), key= lambda o: o.short_name)
|
|
148
|
-
|
|
149
|
-
def createSynchronousServerCallPoint(self, short_name: str) -> SynchronousServerCallPoint:
|
|
150
|
-
if (short_name not in self.server_call_points):
|
|
151
|
-
server_call_point = SynchronousServerCallPoint(self, short_name)
|
|
152
|
-
self.server_call_points[short_name] = server_call_point
|
|
153
|
-
return self.server_call_points[short_name]
|
|
154
|
-
|
|
155
|
-
def createAsynchronousServerCallPoint(self, short_name: str) -> AsynchronousServerCallPoint:
|
|
156
|
-
if (short_name not in self.server_call_points):
|
|
157
|
-
server_call_point = AsynchronousServerCallPoint(self, short_name)
|
|
158
|
-
self.server_call_points[short_name] = server_call_point
|
|
159
|
-
return self.server_call_points[short_name]
|
|
160
|
-
|
|
161
|
-
def getSynchronousServerCallPoint(self) -> List[ServerCallPoint]:
|
|
162
|
-
return filter(lambda o: isinstance(o, SynchronousServerCallPoint), self.getServerCallPoints())
|
|
163
|
-
|
|
164
|
-
def getAsynchronousServerCallPoint(self) -> List[ServerCallPoint]:
|
|
165
|
-
return filter(lambda o: isinstance(o, AsynchronousServerCallPoint), self.getServerCallPoints())
|
|
166
|
-
|
|
167
|
-
def getServerCallPoints(self) -> List[ServerCallPoint]:
|
|
168
|
-
return sorted(self.server_call_points.values(), key=lambda v: v.short_name)
|
|
169
|
-
|
|
170
|
-
def createInternalTriggeringPoint(self, short_name: str) -> InternalTriggeringPoint:
|
|
171
|
-
if (short_name not in self.elements):
|
|
172
|
-
point = InternalTriggeringPoint(self, short_name)
|
|
173
|
-
self.elements[point.short_name] = point
|
|
174
|
-
return self.elements[point.short_name]
|
|
175
|
-
|
|
176
|
-
def getInternalTriggeringPoints(self) -> List[InternalTriggeringPoint]:
|
|
177
|
-
return filter(lambda o: isinstance(o, InternalTriggeringPoint), self.elements)
|
|
16
|
+
from .m2.autosar_templates.common_structure import ValueSpecification
|
|
178
17
|
|
|
179
18
|
class AbstractEvent(Identifiable):
|
|
180
19
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -184,8 +23,8 @@ class RTEEvent(AbstractEvent):
|
|
|
184
23
|
def __init__(self, parent: ARObject, short_name: str):
|
|
185
24
|
super().__init__(parent, short_name)
|
|
186
25
|
|
|
187
|
-
self.start_on_event_ref = None
|
|
188
|
-
self.disabled_mode_irefs = []
|
|
26
|
+
self.start_on_event_ref = None # type: RefType
|
|
27
|
+
self.disabled_mode_irefs = [] # type: List[RModeInAtomicSwcInstanceRef]
|
|
189
28
|
|
|
190
29
|
def addDisabledModeIRef(self, iref: RModeInAtomicSwcInstanceRef):
|
|
191
30
|
self.disabled_mode_irefs.append(iref)
|
|
@@ -209,7 +48,14 @@ class DataReceivedEvent(RTEEvent):
|
|
|
209
48
|
def __init__(self, parent: ARObject, short_name: str):
|
|
210
49
|
super().__init__(parent, short_name)
|
|
211
50
|
|
|
212
|
-
self.
|
|
51
|
+
self.dataIRef = None # type: RVariableInAtomicSwcInstanceRef
|
|
52
|
+
|
|
53
|
+
def getDataIRef(self):
|
|
54
|
+
return self.dataIRef
|
|
55
|
+
|
|
56
|
+
def setDataIRef(self, value):
|
|
57
|
+
self.dataIRef = value
|
|
58
|
+
return self
|
|
213
59
|
|
|
214
60
|
class SwcModeSwitchEvent(RTEEvent):
|
|
215
61
|
def __init__(self, parent: ARObject, short_name: str):
|
|
@@ -248,6 +94,14 @@ class OperationInvokedEvent(RTEEvent):
|
|
|
248
94
|
super().__init__(parent, short_name)
|
|
249
95
|
self.operation_iref = None # type: POperationInAtomicSwcInstanceRef
|
|
250
96
|
|
|
97
|
+
@property
|
|
98
|
+
def operationIRef(self) -> POperationInAtomicSwcInstanceRef:
|
|
99
|
+
return self.operation_iref
|
|
100
|
+
|
|
101
|
+
@operationIRef.setter
|
|
102
|
+
def operationIRef(self, value: POperationInAtomicSwcInstanceRef):
|
|
103
|
+
self.operation_iref = value
|
|
104
|
+
|
|
251
105
|
class InitEvent(RTEEvent):
|
|
252
106
|
def __init__(self, parent: ARObject, short_name: str):
|
|
253
107
|
super().__init__(parent, short_name)
|
|
@@ -334,30 +188,37 @@ class SwcInternalBehavior(InternalBehavior):
|
|
|
334
188
|
|
|
335
189
|
self.handle_termination_and_restart = None # type: str
|
|
336
190
|
self.supports_multiple_instantiation = None # type: ARBoolean
|
|
337
|
-
self.
|
|
338
|
-
self.
|
|
339
|
-
self.
|
|
340
|
-
self.
|
|
341
|
-
self.
|
|
191
|
+
self.explicit_inter_runnable_variables = [] # type: List[VariableDataPrototype]
|
|
192
|
+
self.implicit_inter_runnable_variables = [] # type: List[VariableDataPrototype]
|
|
193
|
+
self.per_instance_memories = [] # type: List[PerInstanceMemory]
|
|
194
|
+
self.per_instance_parameters = [] # type: List[ParameterDataPrototype]
|
|
195
|
+
self.port_api_options = [] # type: List[PortAPIOption]
|
|
196
|
+
self.included_data_type_sets = [] # type: List[IncludedDataTypeSet]
|
|
342
197
|
|
|
343
198
|
def getExplicitInterRunnableVariables(self) -> List[VariableDataPrototype]:
|
|
344
|
-
return self.
|
|
199
|
+
return self.explicit_inter_runnable_variables
|
|
345
200
|
|
|
346
201
|
def getImplicitInterRunnableVariables(self) -> List[VariableDataPrototype]:
|
|
347
|
-
return self.
|
|
202
|
+
return self.implicit_inter_runnable_variables
|
|
348
203
|
|
|
349
204
|
def getPerInstanceMemories(self) -> List[PerInstanceMemory]:
|
|
350
|
-
return self.
|
|
205
|
+
return self.per_instance_memories
|
|
351
206
|
|
|
352
|
-
def
|
|
353
|
-
return self.
|
|
207
|
+
def getPerInstanceParameters(self) -> List[ParameterDataPrototype]:
|
|
208
|
+
return self.per_instance_parameters
|
|
354
209
|
|
|
355
210
|
def addPortAPIOption(self, option: PortAPIOption):
|
|
356
|
-
self.
|
|
211
|
+
self.port_api_options.append(option)
|
|
357
212
|
|
|
358
213
|
def getPortAPIOptions(self) -> List[PortAPIOption]:
|
|
359
|
-
return self.
|
|
214
|
+
return self.port_api_options
|
|
215
|
+
|
|
216
|
+
def addIncludedDataTypeSet(self, set: IncludedDataTypeSet):
|
|
217
|
+
self.included_data_type_sets.append(set)
|
|
360
218
|
|
|
219
|
+
def getIncludedDataTypeSets(self) -> List[IncludedDataTypeSet]:
|
|
220
|
+
return self.included_data_type_sets
|
|
221
|
+
|
|
361
222
|
def createOperationInvokedEvent(self, short_name: str) -> OperationInvokedEvent:
|
|
362
223
|
if (short_name not in self.elements):
|
|
363
224
|
event = OperationInvokedEvent(self, short_name)
|
|
@@ -433,28 +294,28 @@ class SwcInternalBehavior(InternalBehavior):
|
|
|
433
294
|
if (short_name not in self.elements):
|
|
434
295
|
prototype = VariableDataPrototype(self, short_name)
|
|
435
296
|
self.elements[short_name] = prototype
|
|
436
|
-
self.
|
|
297
|
+
self.explicit_inter_runnable_variables.append(prototype)
|
|
437
298
|
return self.elements[short_name]
|
|
438
299
|
|
|
439
300
|
def createImplicitInterRunnableVariable(self, short_name: str) -> VariableDataPrototype:
|
|
440
301
|
if (short_name not in self.elements):
|
|
441
302
|
prototype = VariableDataPrototype(self, short_name)
|
|
442
303
|
self.elements[short_name] = prototype
|
|
443
|
-
self.
|
|
304
|
+
self.implicit_inter_runnable_variables.append(prototype)
|
|
444
305
|
return self.elements[short_name]
|
|
445
306
|
|
|
446
307
|
def createPerInstanceMemory(self, short_name: str) -> PerInstanceMemory:
|
|
447
308
|
if (short_name not in self.elements):
|
|
448
309
|
memory = PerInstanceMemory(self, short_name)
|
|
449
310
|
self.elements[short_name] = memory
|
|
450
|
-
self.
|
|
311
|
+
self.per_instance_memories.append(memory)
|
|
451
312
|
return self.elements[short_name]
|
|
452
313
|
|
|
453
|
-
def
|
|
314
|
+
def createPerInstanceParameter(self, short_name: str) -> ParameterDataPrototype:
|
|
454
315
|
if (short_name not in self.elements):
|
|
455
316
|
prototype = ParameterDataPrototype(self, short_name)
|
|
456
317
|
self.elements[short_name] = prototype
|
|
457
|
-
self.
|
|
318
|
+
self.per_instance_parameters.append(prototype)
|
|
458
319
|
return self.elements[short_name]
|
|
459
320
|
|
|
460
321
|
def getVariableDataPrototypes(self) -> List[VariableDataPrototype]:
|
|
File without changes
|
armodel/models/timing.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
from abc import ABCMeta
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from armodel.models.ar_ref import RefType
|
|
6
|
+
|
|
7
|
+
from ..models.general_structure import Identifiable
|
|
8
|
+
from ..models.ar_object import ARObject
|
|
9
|
+
|
|
10
|
+
class EOCExecutableEntityRefAbstract(Identifiable):
|
|
11
|
+
__metaclass__ = ABCMeta
|
|
12
|
+
|
|
13
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
14
|
+
if type(self) == TimingConstraint:
|
|
15
|
+
raise NotImplementedError("TimingExtension is an abstract class.")
|
|
16
|
+
|
|
17
|
+
super().__init__(parent, short_name)
|
|
18
|
+
|
|
19
|
+
class EOCExecutableEntityRef(EOCExecutableEntityRefAbstract):
|
|
20
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
21
|
+
super().__init__(parent, short_name)
|
|
22
|
+
|
|
23
|
+
self.successor_refs = [] # List[RefType]
|
|
24
|
+
|
|
25
|
+
def addSuccessorRef(self, ref: RefType):
|
|
26
|
+
self.successor_refs.append(ref)
|
|
27
|
+
|
|
28
|
+
def getSuccessorRefs(self) -> List[RefType]:
|
|
29
|
+
return self.successor_refs
|
|
30
|
+
|
|
31
|
+
class TimingConstraint(Identifiable):
|
|
32
|
+
__metaclass__ = ABCMeta
|
|
33
|
+
|
|
34
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
35
|
+
if type(self) == TimingConstraint:
|
|
36
|
+
raise NotImplementedError("TimingExtension is an abstract class.")
|
|
37
|
+
|
|
38
|
+
super().__init__(parent, short_name)
|
|
39
|
+
|
|
40
|
+
self.timing_condition_ref = None # type: RefType
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def timingConditionRef(self) -> RefType:
|
|
44
|
+
return self.timing_condition_ref
|
|
45
|
+
|
|
46
|
+
@timingConditionRef.setter
|
|
47
|
+
def timingConditionRef(self, ref: RefType):
|
|
48
|
+
self.timing_condition_ref = ref
|
|
49
|
+
|
|
50
|
+
class ExecutionOrderConstraint(TimingConstraint):
|
|
51
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
52
|
+
super().__init__(parent, short_name)
|
|
53
|
+
|
|
54
|
+
self.ordered_elements = [] # type: List[EOCExecutableEntityRefAbstract]
|
|
55
|
+
|
|
56
|
+
def createEOCExecutableEntityRef(self, short_name: str)-> EOCExecutableEntityRef:
|
|
57
|
+
if short_name not in self.elements:
|
|
58
|
+
entity_ref = EOCExecutableEntityRef(self, short_name)
|
|
59
|
+
self.elements[short_name] = entity_ref
|
|
60
|
+
self.ordered_elements.append(entity_ref)
|
|
61
|
+
return self.elements[short_name]
|
|
62
|
+
|
|
63
|
+
def getOrderedElements(self) -> List[EOCExecutableEntityRefAbstract]:
|
|
64
|
+
return self.ordered_elements
|
|
65
|
+
|
|
66
|
+
class TimingExtension(Identifiable):
|
|
67
|
+
__metaclass__ = ABCMeta
|
|
68
|
+
|
|
69
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
70
|
+
if type(self) == TimingExtension:
|
|
71
|
+
raise NotImplementedError("TimingExtension is an abstract class.")
|
|
72
|
+
|
|
73
|
+
super().__init__(parent, short_name)
|
|
74
|
+
|
|
75
|
+
self.timing_requirements = [] # Type: List[TimingConstraint]
|
|
76
|
+
|
|
77
|
+
def createExecutionOrderConstraint(self, short_name: str)-> ExecutionOrderConstraint:
|
|
78
|
+
if short_name not in self.elements:
|
|
79
|
+
constraint = ExecutionOrderConstraint(self, short_name)
|
|
80
|
+
self.elements[short_name] = constraint
|
|
81
|
+
self.timing_requirements.append(constraint)
|
|
82
|
+
return self.elements[short_name]
|
|
83
|
+
|
|
84
|
+
def getTimingRequirements(self) -> List[TimingConstraint]:
|
|
85
|
+
return self.timing_requirements
|
|
86
|
+
|
|
87
|
+
class SwcTiming(TimingExtension):
|
|
88
|
+
def __init__(self, parent: ARObject, short_name: str):
|
|
89
|
+
super().__init__(parent, short_name)
|
|
90
|
+
|
|
91
|
+
|
|
@@ -45,6 +45,9 @@ class AbstractARXMLParser:
|
|
|
45
45
|
else:
|
|
46
46
|
raise ValueError(error_msg)
|
|
47
47
|
|
|
48
|
+
def _raiseWarning(self, error_msg):
|
|
49
|
+
self.logger.warning(error_msg)
|
|
50
|
+
|
|
48
51
|
def getPureTagName(self, tag):
|
|
49
52
|
return re.sub(r'\{[\w:\/.]+\}(\w+)', r'\1', tag)
|
|
50
53
|
|
|
@@ -105,7 +108,7 @@ class AbstractARXMLParser:
|
|
|
105
108
|
def getChildElementOptionalFloatValue(self, element: ET.Element, key: str) -> ARFloat:
|
|
106
109
|
child_element = element.find("./xmlns:%s" % key, self.nsmap)
|
|
107
110
|
float_value = None
|
|
108
|
-
if (child_element is not None):
|
|
111
|
+
if (child_element is not None) and (child_element.text is not None):
|
|
109
112
|
float_value = ARFloat()
|
|
110
113
|
float_value.setValue(child_element.text)
|
|
111
114
|
return float_value
|
|
@@ -204,7 +207,7 @@ class AbstractARXMLParser:
|
|
|
204
207
|
return None
|
|
205
208
|
|
|
206
209
|
def getChildElementRefTypeList(self, element: ET.Element, key: str) -> List[RefType]:
|
|
207
|
-
child_elements =
|
|
210
|
+
child_elements = self.findall(element, key)
|
|
208
211
|
results = []
|
|
209
212
|
for child_element in child_elements:
|
|
210
213
|
ref = RefType()
|
|
@@ -234,6 +237,12 @@ class AbstractARXMLParser:
|
|
|
234
237
|
|
|
235
238
|
self.logger.debug("schemaLocation %s" % document.schema_location)
|
|
236
239
|
|
|
240
|
+
def getShortName(self, element: ET.Element) -> str:
|
|
241
|
+
child_element = self.find(element, "SHORT-NAME")
|
|
242
|
+
if child_element is None:
|
|
243
|
+
raise ValueError("Short Name is required")
|
|
244
|
+
return child_element.text
|
|
245
|
+
|
|
237
246
|
def convert_find_key(self, key: str) -> str:
|
|
238
247
|
keys = key.split("/")
|
|
239
248
|
for idx, item in enumerate(keys):
|