armodel 1.5.0__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 +13 -13
- 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 +124 -14
- armodel/models/ar_ref.py +109 -62
- armodel/models/bsw_module_template.py +37 -14
- armodel/models/common_structure.py +132 -147
- armodel/models/communication.py +1 -1
- armodel/models/data_prototype.py +41 -6
- armodel/models/datatype.py +11 -5
- armodel/models/fibex/can_communication.py +119 -3
- 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 +81 -88
- 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/lin_communication.py +24 -3
- armodel/models/general_structure.py +101 -8
- 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/multilanguage_data.py +15 -0
- armodel/models/per_instance_memory.py +34 -6
- armodel/models/port_prototype.py +12 -174
- armodel/models/sw_component.py +14 -216
- armodel/parser/abstract_arxml_parser.py +10 -1
- armodel/parser/arxml_parser.py +803 -186
- 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 +1 -1
- armodel/tests/test_armodel/models/test_datatype.py +1 -1
- armodel/tests/test_armodel/models/test_port_interface.py +1 -1
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +3 -3
- armodel/tests/test_armodel/parser/test_sw_components.py +2 -2
- armodel/writer/arxml_writer.py +832 -196
- {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/METADATA +24 -1
- armodel-1.6.0.dist-info/RECORD +127 -0
- {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/entry_points.txt +3 -1
- armodel-1.5.0.dist-info/RECORD +0 -91
- {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/LICENSE +0 -0
- {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/WHEEL +0 -0
- {armodel-1.5.0.dist-info → armodel-1.6.0.dist-info}/top_level.txt +0 -0
armodel/cli/arxml_dump_cli.py
CHANGED
|
@@ -2,9 +2,9 @@ import getopt
|
|
|
2
2
|
import sys
|
|
3
3
|
import logging
|
|
4
4
|
|
|
5
|
-
from ..models import AUTOSAR, ARPackage,
|
|
5
|
+
from ..models import AUTOSAR, ARPackage, VariableAccess, SwComponentType, DataTypeMappingSet
|
|
6
6
|
from ..models import SwcInternalBehavior, ImplementationDataType
|
|
7
|
-
from ..models import BswModuleDescription,
|
|
7
|
+
from ..models import BswModuleDescription, BswInternalBehavior, BswModuleEntity, BswModuleEntry
|
|
8
8
|
from ..models import PortPrototype, RPortPrototype, PPortPrototype
|
|
9
9
|
from ..models import SenderReceiverInterface, ClientServerInterface
|
|
10
10
|
from ..parser import ARXMLParser
|
|
@@ -21,26 +21,26 @@ def show_port(indent:int, port_prototype: PortPrototype):
|
|
|
21
21
|
if (isinstance(port_prototype, RPortPrototype)):
|
|
22
22
|
print("%s-RPort: %s (%s)" % (" " * indent, port_prototype.short_name, port_prototype.required_interface_tref.value))
|
|
23
23
|
for client_com_spec in port_prototype.getClientComSpecs():
|
|
24
|
-
print("%s : %s (ClientComSpec)" % (" " * (indent + 2), client_com_spec.
|
|
24
|
+
print("%s : %s (ClientComSpec)" % (" " * (indent + 2), client_com_spec.operationRef.value))
|
|
25
25
|
for com_spec in port_prototype.getNonqueuedReceiverComSpecs():
|
|
26
|
-
print("%s : %s (NonqueuedReceiverComSpec)" % (" " * (indent + 2), com_spec.
|
|
26
|
+
print("%s : %s (NonqueuedReceiverComSpec)" % (" " * (indent + 2), com_spec.dataElementRef.value))
|
|
27
27
|
elif (isinstance(port_prototype, PPortPrototype)):
|
|
28
28
|
print("%s-PPort: %s (%s)" % (" " * indent, port_prototype.short_name, port_prototype.provided_interface_tref.value))
|
|
29
29
|
for com_spec in port_prototype.getNonqueuedSenderComSpecs():
|
|
30
|
-
print("%s : %s (NonqueuedSenderComSpec)" % (" " * (indent + 2), com_spec.
|
|
30
|
+
print("%s : %s (NonqueuedSenderComSpec)" % (" " * (indent + 2), com_spec.dataElementRef.value))
|
|
31
31
|
else:
|
|
32
32
|
raise ValueError("Unsupported Port prototype")
|
|
33
33
|
|
|
34
34
|
def show_type(indent: int, data_type: ImplementationDataType):
|
|
35
35
|
print("%s-Implementation Type: %s (%s)" % (" " * indent, data_type.short_name, data_type._parent.full_name))
|
|
36
36
|
print("%s : %s" % (" " * indent, data_type.category))
|
|
37
|
-
if (data_type.
|
|
38
|
-
if (data_type.
|
|
39
|
-
base_type_ref = data_type.
|
|
37
|
+
if (data_type.swDataDefProps != None):
|
|
38
|
+
if (data_type.swDataDefProps.baseTypeRef != None):
|
|
39
|
+
base_type_ref = data_type.swDataDefProps.baseTypeRef
|
|
40
40
|
print("%s : %s (%s)" % (" " * indent, base_type_ref.value, base_type_ref.dest))
|
|
41
41
|
|
|
42
|
-
if (data_type.
|
|
43
|
-
implementation_data_type_ref = data_type.
|
|
42
|
+
if (data_type.swDataDefProps.implementationDataTypeRef != None):
|
|
43
|
+
implementation_data_type_ref = data_type.swDataDefProps.implementationDataTypeRef
|
|
44
44
|
print("%s : %s (%s)" % (" " * indent, implementation_data_type_ref.value, implementation_data_type_ref.dest))
|
|
45
45
|
|
|
46
46
|
def show_data_type_mapping(indent: int, mapping_set: DataTypeMappingSet):
|
|
@@ -92,7 +92,7 @@ def show_client_server_interface(indent: int, cs_interface: ClientServerInterfac
|
|
|
92
92
|
print("%sOperation:%s" % (" " * (indent + 2), operation.short_name))
|
|
93
93
|
for argument in operation.getArgumentDataPrototypes():
|
|
94
94
|
print("%s :%s (%s: %s)" % (" " * (indent + 2), argument.short_name,
|
|
95
|
-
argument.direction, argument.
|
|
95
|
+
argument.direction, argument.typeTRef.value))
|
|
96
96
|
|
|
97
97
|
def show_bsw_internal_behavior(indent: int, behavior: BswInternalBehavior):
|
|
98
98
|
document = AUTOSAR.getInstance()
|
|
@@ -107,8 +107,8 @@ def show_bsw_internal_behavior(indent: int, behavior: BswInternalBehavior):
|
|
|
107
107
|
print("%s-%s: %s" % (" " * (indent + 4), "StartsOnEventRef", event.startsOnEventRef.value))
|
|
108
108
|
starts_on_event = document.find(event.startsOnEventRef.value) # type: BswModuleEntity
|
|
109
109
|
print("%s-%s: %s" % (" " * (indent + 4), "StartsOnEvent", starts_on_event.short_name))
|
|
110
|
-
print("%s-%s: %s" % (" " * (indent + 4), "ImplementedEntryRef", starts_on_event.
|
|
111
|
-
implemented_entry = document.find(starts_on_event.
|
|
110
|
+
print("%s-%s: %s" % (" " * (indent + 4), "ImplementedEntryRef", starts_on_event.implementedEntryRef.value))
|
|
111
|
+
implemented_entry = document.find(starts_on_event.implementedEntryRef.value) # type: BswModuleEntry
|
|
112
112
|
print("%s-%s: %s" % (" " * (indent + 4), "ImplementedEntry", implemented_entry.short_name))
|
|
113
113
|
print("%s-%s: %d" % (" " * (indent + 6), "Service Id", implemented_entry.service_id))
|
|
114
114
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import pkg_resources
|
|
3
|
+
import logging
|
|
4
|
+
import sys
|
|
5
|
+
import os.path
|
|
6
|
+
|
|
7
|
+
from armodel import AUTOSAR
|
|
8
|
+
from armodel.parser import ARXMLParser
|
|
9
|
+
from ..lib import InputFileParser, SystemSignalAnalyzer
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
version = pkg_resources.require("armodel")[0].version
|
|
13
|
+
|
|
14
|
+
ap = argparse.ArgumentParser()
|
|
15
|
+
ap.add_argument("-v", "--verbose", required= False, help= "Print debug information", action= "store_true")
|
|
16
|
+
ap.add_argument("-f", "--format", required= False, help= "Specify the short or long name of Sw-C. [short|long]")
|
|
17
|
+
|
|
18
|
+
ap.add_argument("INPUT", help = "The path of AUTOSAR XML", nargs='+')
|
|
19
|
+
ap.add_argument("")
|
|
20
|
+
|
|
21
|
+
args = ap.parse_args()
|
|
22
|
+
|
|
23
|
+
logger = logging.getLogger()
|
|
24
|
+
|
|
25
|
+
formatter = logging.Formatter('[%(levelname)s] : %(message)s')
|
|
26
|
+
|
|
27
|
+
stdout_handler = logging.StreamHandler(sys.stderr)
|
|
28
|
+
stdout_handler.setFormatter(formatter)
|
|
29
|
+
|
|
30
|
+
#base_path = os.path.dirname(args.Output)
|
|
31
|
+
log_file = os.path.join(".", 'system-signals.log')
|
|
32
|
+
|
|
33
|
+
if os.path.exists(log_file):
|
|
34
|
+
os.remove(log_file)
|
|
35
|
+
|
|
36
|
+
file_handler = logging.FileHandler(log_file)
|
|
37
|
+
file_handler.setFormatter(formatter)
|
|
38
|
+
|
|
39
|
+
logger.setLevel(logging.DEBUG)
|
|
40
|
+
file_handler.setLevel(logging.DEBUG)
|
|
41
|
+
|
|
42
|
+
if args.verbose:
|
|
43
|
+
stdout_handler.setLevel(logging.DEBUG)
|
|
44
|
+
|
|
45
|
+
else:
|
|
46
|
+
stdout_handler.setLevel(logging.INFO)
|
|
47
|
+
|
|
48
|
+
logger.addHandler(file_handler)
|
|
49
|
+
logger.addHandler(stdout_handler)
|
|
50
|
+
|
|
51
|
+
try:
|
|
52
|
+
parser = InputFileParser(args.INPUT)
|
|
53
|
+
filenames = parser.parse()
|
|
54
|
+
|
|
55
|
+
document = AUTOSAR().getInstance()
|
|
56
|
+
parser = ARXMLParser({'warning': True})
|
|
57
|
+
|
|
58
|
+
format = "short"
|
|
59
|
+
if args.format is not None and args.format.lower() == "long":
|
|
60
|
+
format = "long"
|
|
61
|
+
|
|
62
|
+
for filename in filenames:
|
|
63
|
+
parser.load(filename, document)
|
|
64
|
+
|
|
65
|
+
analyzer = SystemSignalAnalyzer()
|
|
66
|
+
analyzer.import_data(document)
|
|
67
|
+
analyzer.print_out({
|
|
68
|
+
'format': format,
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
except Exception as e:
|
|
72
|
+
print(e)
|
|
73
|
+
#raise e
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
main()
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import pkg_resources
|
|
3
|
+
import logging
|
|
4
|
+
import sys
|
|
5
|
+
import os.path
|
|
6
|
+
|
|
7
|
+
from armodel import AUTOSAR
|
|
8
|
+
from armodel.parser import ARXMLParser
|
|
9
|
+
from ..lib import InputFileParser, SystemSignalAnalyzer
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
version = pkg_resources.require("armodel")[0].version
|
|
13
|
+
|
|
14
|
+
ap = argparse.ArgumentParser()
|
|
15
|
+
ap.add_argument("-v", "--verbose", required= False, help= "Print debug information", action= "store_true")
|
|
16
|
+
ap.add_argument("-f", "--format", required= False, help= "Specify the name format of SW-C. [short|full]")
|
|
17
|
+
ap.add_argument("INPUT", help = "The path of AUTOSAR XML", nargs='+')
|
|
18
|
+
|
|
19
|
+
args = ap.parse_args()
|
|
20
|
+
|
|
21
|
+
logger = logging.getLogger()
|
|
22
|
+
|
|
23
|
+
formatter = logging.Formatter('[%(levelname)s] : %(message)s')
|
|
24
|
+
|
|
25
|
+
stdout_handler = logging.StreamHandler(sys.stderr)
|
|
26
|
+
stdout_handler.setFormatter(formatter)
|
|
27
|
+
|
|
28
|
+
#base_path = os.path.dirname(args.Output)
|
|
29
|
+
log_file = os.path.join(".", 'system-signals.log')
|
|
30
|
+
|
|
31
|
+
if os.path.exists(log_file):
|
|
32
|
+
os.remove(log_file)
|
|
33
|
+
|
|
34
|
+
file_handler = logging.FileHandler(log_file)
|
|
35
|
+
file_handler.setFormatter(formatter)
|
|
36
|
+
|
|
37
|
+
logger.setLevel(logging.DEBUG)
|
|
38
|
+
file_handler.setLevel(logging.DEBUG)
|
|
39
|
+
|
|
40
|
+
if args.verbose:
|
|
41
|
+
stdout_handler.setLevel(logging.DEBUG)
|
|
42
|
+
|
|
43
|
+
else:
|
|
44
|
+
stdout_handler.setLevel(logging.INFO)
|
|
45
|
+
|
|
46
|
+
logger.addHandler(file_handler)
|
|
47
|
+
logger.addHandler(stdout_handler)
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
parser = InputFileParser(args.INPUT)
|
|
51
|
+
filenames = parser.parse()
|
|
52
|
+
|
|
53
|
+
document = AUTOSAR().getInstance()
|
|
54
|
+
parser = ARXMLParser({'warning': True})
|
|
55
|
+
|
|
56
|
+
format = "short"
|
|
57
|
+
if args.format is not None and args.format.lower() == "full":
|
|
58
|
+
format = "full"
|
|
59
|
+
|
|
60
|
+
for filename in filenames:
|
|
61
|
+
parser.load(filename, document)
|
|
62
|
+
|
|
63
|
+
analyzer = SystemSignalAnalyzer()
|
|
64
|
+
analyzer.import_data(document)
|
|
65
|
+
analyzer.print_out({
|
|
66
|
+
'format': format,
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
except Exception as e:
|
|
70
|
+
print(e)
|
|
71
|
+
#raise e
|
|
72
|
+
|
|
73
|
+
if __name__ == "__main__":
|
|
74
|
+
main()
|
armodel/lib/__init__.py
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
from ..models.ar_package import AUTOSAR, ARPackage
|
|
5
|
+
from ..models.fibex.fibex_core.core_communication import SystemSignal
|
|
6
|
+
|
|
7
|
+
class SystemSignalAnalyzer:
|
|
8
|
+
def __init__(self) -> None:
|
|
9
|
+
self.system_signals = [] # type: List[SystemSignal]
|
|
10
|
+
|
|
11
|
+
def add_system_signal(self, signal: SystemSignal):
|
|
12
|
+
self.system_signals.append(signal)
|
|
13
|
+
|
|
14
|
+
def get_system_signals(self) -> List[SystemSignal]:
|
|
15
|
+
return self.system_signals
|
|
16
|
+
|
|
17
|
+
def parse_pkg(self, parent: ARPackage):
|
|
18
|
+
for pkg in parent.getARPackages():
|
|
19
|
+
self.parse_pkg(pkg)
|
|
20
|
+
for signal in parent.getSystemSignals():
|
|
21
|
+
|
|
22
|
+
self.add_system_signal(signal)
|
|
23
|
+
|
|
24
|
+
def import_data(self, document: AUTOSAR):
|
|
25
|
+
for pkg in document.getARPackages():
|
|
26
|
+
self.parse_pkg(pkg)
|
|
27
|
+
|
|
28
|
+
def print_out(self, option = {}):
|
|
29
|
+
logger = logging.getLogger()
|
|
30
|
+
|
|
31
|
+
logger.info("== SYSTEM SIGNAL LIST ==")
|
|
32
|
+
|
|
33
|
+
for signal in sorted(self.system_signals, key = lambda o: o.short_name):
|
|
34
|
+
if option['format'] == 'full':
|
|
35
|
+
logger.info("%s" % signal.full_name)
|
|
36
|
+
else:
|
|
37
|
+
logger.info("%s" % signal.short_name)
|
armodel/models/__init__.py
CHANGED
|
@@ -8,12 +8,15 @@ from .ar_ref import *
|
|
|
8
8
|
from .datatype import *
|
|
9
9
|
from .port_prototype import *
|
|
10
10
|
from .data_prototype import *
|
|
11
|
-
from .
|
|
12
|
-
from .
|
|
11
|
+
from .m2.msr.asam_hdo.units import *
|
|
12
|
+
from .m2.msr.data_dictionary.data_def_properties import *
|
|
13
|
+
from .m2.msr.data_dictionary.auxillary_objects import *
|
|
14
|
+
from .m2.autosar_templates.sw_component_template.port_interface import *
|
|
13
15
|
from .m2_msr import *
|
|
14
16
|
from .implementation import *
|
|
15
17
|
from .bsw_module_template import *
|
|
16
18
|
from .communication import *
|
|
17
19
|
from .calibration import *
|
|
18
20
|
from .global_constraints import *
|
|
19
|
-
from .
|
|
21
|
+
from .m2.msr.asam_hdo.units import *
|
|
22
|
+
from .m2.autosar_templates.sw_component_template import *
|
armodel/models/annotation.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
from abc import ABCMeta
|
|
3
3
|
|
|
4
|
+
from .m2.msr.documentation.block_elements import DocumentationBlock
|
|
4
5
|
from .multilanguage_data import MultilanguageLongName
|
|
5
|
-
from .ar_object import ARObject
|
|
6
|
+
from .ar_object import ARLiteral, ARObject
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class GeneralAnnotation(ARObject, metaclass=ABCMeta):
|
|
@@ -10,10 +11,33 @@ class GeneralAnnotation(ARObject, metaclass=ABCMeta):
|
|
|
10
11
|
if type(self) == ARObject:
|
|
11
12
|
raise NotImplementedError("GeneralAnnotation is an abstract class.")
|
|
12
13
|
|
|
13
|
-
self.label = None # type: MultilanguageLongName
|
|
14
|
-
|
|
15
14
|
super().__init__()
|
|
16
15
|
|
|
16
|
+
self.annotationOrigin = None # type: ARLiteral
|
|
17
|
+
self.annotationText = None # type: DocumentationBlock
|
|
18
|
+
self.label = None # type: MultilanguageLongName
|
|
19
|
+
|
|
20
|
+
def getAnnotationOrigin(self) -> ARLiteral:
|
|
21
|
+
return self.annotationOrigin
|
|
22
|
+
|
|
23
|
+
def setAnnotationOrigin(self, value: ARLiteral):
|
|
24
|
+
self.annotationOrigin = value
|
|
25
|
+
return self
|
|
26
|
+
|
|
27
|
+
def getAnnotationText(self) -> DocumentationBlock:
|
|
28
|
+
return self.annotationText
|
|
29
|
+
|
|
30
|
+
def setAnnotationText(self, value: DocumentationBlock):
|
|
31
|
+
self.annotationText = value
|
|
32
|
+
return self
|
|
33
|
+
|
|
34
|
+
def getLabel(self) -> MultilanguageLongName:
|
|
35
|
+
return self.label
|
|
36
|
+
|
|
37
|
+
def setLabel(self, value: MultilanguageLongName):
|
|
38
|
+
self.label = value
|
|
39
|
+
return self
|
|
40
|
+
|
|
17
41
|
class Annotation(GeneralAnnotation):
|
|
18
42
|
def __init__(self):
|
|
19
43
|
super().__init__()
|
armodel/models/ar_object.py
CHANGED
|
@@ -73,10 +73,21 @@ class ARNumerical(ARType):
|
|
|
73
73
|
self._text = None # type: str
|
|
74
74
|
|
|
75
75
|
def _convertStringToNumberValue(self, value: str) -> int:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
try:
|
|
77
|
+
if value == 'true':
|
|
78
|
+
return 1
|
|
79
|
+
elif value == 'false':
|
|
80
|
+
return 0
|
|
81
|
+
else:
|
|
82
|
+
m = re.match(r"0x([0-9a-f]+)", value, re.I)
|
|
83
|
+
if m:
|
|
84
|
+
return int(m.group(1), 16)
|
|
85
|
+
m = re.match(r"\d+\.\d+", value)
|
|
86
|
+
if m:
|
|
87
|
+
return float(value)
|
|
88
|
+
return int(value)
|
|
89
|
+
except:
|
|
90
|
+
raise ValueError("Invalid Numerical Type <%s>" % value)
|
|
80
91
|
|
|
81
92
|
@property
|
|
82
93
|
def value(self) -> int:
|
|
@@ -118,7 +129,7 @@ class ARPositiveInteger(ARNumerical):
|
|
|
118
129
|
else:
|
|
119
130
|
raise ValueError("Unsupported Type <%s>", type(val))
|
|
120
131
|
|
|
121
|
-
class ARFloat(
|
|
132
|
+
class ARFloat(ARNumerical):
|
|
122
133
|
def __init__(self) -> None:
|
|
123
134
|
super().__init__()
|
|
124
135
|
|
|
@@ -136,7 +147,8 @@ class ARFloat(ARType):
|
|
|
136
147
|
self._value = val * 1.0
|
|
137
148
|
elif isinstance(val, str):
|
|
138
149
|
self._text = val
|
|
139
|
-
self._value = float(val)
|
|
150
|
+
#self._value = float(val)
|
|
151
|
+
self._value = self._convertStringToNumberValue(val)
|
|
140
152
|
else:
|
|
141
153
|
raise ValueError("Unsupported Type <%s>", type(val))
|
|
142
154
|
|
armodel/models/ar_package.py
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
from typing import Dict, List
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
from .
|
|
7
|
-
from .system_template.network_management import NmConfig
|
|
8
|
-
from .fibex.fibex_core import DcmIPdu, ISignal, NPdu, NmPdu
|
|
3
|
+
from .fibex.fibex_core.core_topology import EcuInstance, CanCluster, LinCluster
|
|
4
|
+
from .fibex.fibex_core.core_communication import ISignalGroup, ISignalIPdu, ISignalIPduGroup, SecuredIPdu, SystemSignal, DcmIPdu, ISignal, NPdu, NmPdu, SystemSignalGroup
|
|
5
|
+
from .fibex.can_communication import CanFrame
|
|
6
|
+
from .fibex.fibex_4_multiplatform import Gateway
|
|
9
7
|
from .fibex.lin_communication import LinUnconditionalFrame
|
|
10
|
-
|
|
8
|
+
|
|
9
|
+
from .m2.msr.asam_hdo.units import PhysicalDimension
|
|
10
|
+
from .m2.msr.data_dictionary.auxillary_objects import SwAddrMethod
|
|
11
|
+
from .m2.autosar_templates.common_structure import ConstantSpecification
|
|
12
|
+
from .m2.autosar_templates.ecuc_description_template import EcucModuleConfigurationValues, EcucValueCollection
|
|
13
|
+
from .m2.autosar_templates.system_template import System
|
|
14
|
+
from .m2.autosar_templates.system_template.transport_protocols import CanTpConfig
|
|
15
|
+
from .m2.autosar_templates.system_template.network_management import NmConfig
|
|
16
|
+
|
|
11
17
|
from .timing import SwcTiming
|
|
12
|
-
from .data_dictionary import SwAddrMethod
|
|
13
18
|
from .record_layout import SwRecordLayout
|
|
14
19
|
from .end_to_end_protection import EndToEndProtectionSet
|
|
15
|
-
from .
|
|
20
|
+
from .m2.msr.asam_hdo.units import Unit
|
|
16
21
|
from .general_structure import Identifiable, ARObject, Referrable, CollectableElement, SwcBswMapping
|
|
17
|
-
from .port_interface import ModeSwitchInterface, SenderReceiverInterface, ClientServerInterface, TriggerInterface
|
|
22
|
+
from .m2.autosar_templates.sw_component_template.port_interface import ModeSwitchInterface, SenderReceiverInterface, ClientServerInterface, TriggerInterface
|
|
18
23
|
from .sw_component import SwComponentType, EcuAbstractionSwComponentType, AtomicSwComponentType, ApplicationSwComponentType
|
|
19
24
|
from .sw_component import ServiceSwComponentType, CompositionSwComponentType, SensorActuatorSwComponentType, ComplexDeviceDriverSwComponentType
|
|
20
25
|
from .datatype import ApplicationArrayDataType, ImplementationDataType, ApplicationDataType, DataTypeMappingSet, DataTypeMap, SwBaseType, ApplicationPrimitiveDataType, ApplicationRecordDataType
|
|
21
26
|
from .m2_msr import CompuMethod
|
|
22
|
-
from .common_structure import
|
|
27
|
+
from .common_structure import ModeDeclarationGroup
|
|
23
28
|
from .implementation import BswImplementation, SwcImplementation, Implementation
|
|
24
29
|
from .bsw_module_template import BswModuleDescription, BswModuleEntry
|
|
25
30
|
from .global_constraints import DataConstr
|
|
@@ -238,6 +243,12 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
238
243
|
self.elements[short_name] = cluster
|
|
239
244
|
return self.elements[short_name]
|
|
240
245
|
|
|
246
|
+
def createCanCluster(self, short_name: str) -> CanCluster:
|
|
247
|
+
if (short_name not in self.elements):
|
|
248
|
+
cluster = CanCluster(self, short_name)
|
|
249
|
+
self.elements[short_name] = cluster
|
|
250
|
+
return self.elements[short_name]
|
|
251
|
+
|
|
241
252
|
def createLinUnconditionalFrame(self, short_name: str) -> LinUnconditionalFrame:
|
|
242
253
|
if (short_name not in self.elements):
|
|
243
254
|
frame = LinUnconditionalFrame(self, short_name)
|
|
@@ -262,6 +273,12 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
262
273
|
self.elements[short_name] = pdu
|
|
263
274
|
return self.elements[short_name]
|
|
264
275
|
|
|
276
|
+
def createSecuredIPdu(self, short_name: str) -> SecuredIPdu:
|
|
277
|
+
if (short_name not in self.elements):
|
|
278
|
+
pdu = SecuredIPdu(self, short_name)
|
|
279
|
+
self.elements[short_name] = pdu
|
|
280
|
+
return self.elements[short_name]
|
|
281
|
+
|
|
265
282
|
def createNmConfig(self, short_name: str) -> NmConfig:
|
|
266
283
|
if (short_name not in self.elements):
|
|
267
284
|
config = NmConfig(self, short_name)
|
|
@@ -280,6 +297,12 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
280
297
|
self.elements[short_name] = frame
|
|
281
298
|
return self.elements[short_name]
|
|
282
299
|
|
|
300
|
+
def createEcuInstance(self, short_name: str) -> EcuInstance:
|
|
301
|
+
if (short_name not in self.elements):
|
|
302
|
+
frame = EcuInstance(self, short_name)
|
|
303
|
+
self.elements[short_name] = frame
|
|
304
|
+
return self.elements[short_name]
|
|
305
|
+
|
|
283
306
|
def createGateway(self, short_name: str) -> Gateway:
|
|
284
307
|
if (short_name not in self.elements):
|
|
285
308
|
gateway = Gateway(self, short_name)
|
|
@@ -292,6 +315,60 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
292
315
|
self.elements[short_name] = signal
|
|
293
316
|
return self.elements[short_name]
|
|
294
317
|
|
|
318
|
+
def createSystemSignal(self, short_name: str) -> SystemSignal:
|
|
319
|
+
if (short_name not in self.elements):
|
|
320
|
+
signal = SystemSignal(self, short_name)
|
|
321
|
+
self.elements[short_name] = signal
|
|
322
|
+
return self.elements[short_name]
|
|
323
|
+
|
|
324
|
+
def createSystemSignalGroup(self, short_name: str) -> SystemSignalGroup:
|
|
325
|
+
if (short_name not in self.elements):
|
|
326
|
+
signal = SystemSignalGroup(self, short_name)
|
|
327
|
+
self.elements[short_name] = signal
|
|
328
|
+
return self.elements[short_name]
|
|
329
|
+
|
|
330
|
+
def createISignalIPdu(self, short_name: str) -> ISignalIPdu:
|
|
331
|
+
if (short_name not in self.elements):
|
|
332
|
+
signal = ISignalIPdu(self, short_name)
|
|
333
|
+
self.elements[short_name] = signal
|
|
334
|
+
return self.elements[short_name]
|
|
335
|
+
|
|
336
|
+
def createEcucValueCollection(self, short_name: str) -> EcucValueCollection:
|
|
337
|
+
if (short_name not in self.elements):
|
|
338
|
+
signal = EcucValueCollection(self, short_name)
|
|
339
|
+
self.elements[short_name] = signal
|
|
340
|
+
return self.elements[short_name]
|
|
341
|
+
|
|
342
|
+
def createEcucModuleConfigurationValues(self, short_name: str) -> EcucModuleConfigurationValues:
|
|
343
|
+
if (short_name not in self.elements):
|
|
344
|
+
signal = EcucModuleConfigurationValues(self, short_name)
|
|
345
|
+
self.elements[short_name] = signal
|
|
346
|
+
return self.elements[short_name]
|
|
347
|
+
|
|
348
|
+
def createPhysicalDimension(self, short_name: str) -> PhysicalDimension:
|
|
349
|
+
if (short_name not in self.elements):
|
|
350
|
+
signal = PhysicalDimension(self, short_name)
|
|
351
|
+
self.elements[short_name] = signal
|
|
352
|
+
return self.elements[short_name]
|
|
353
|
+
|
|
354
|
+
def createISignalGroup(self, short_name: str) -> ISignalGroup:
|
|
355
|
+
if (short_name not in self.elements):
|
|
356
|
+
signal = ISignalGroup(self, short_name)
|
|
357
|
+
self.elements[short_name] = signal
|
|
358
|
+
return self.elements[short_name]
|
|
359
|
+
|
|
360
|
+
def createISignalIPduGroup(self, short_name: str) -> ISignalIPduGroup:
|
|
361
|
+
if (short_name not in self.elements):
|
|
362
|
+
signal = ISignalIPduGroup(self, short_name)
|
|
363
|
+
self.elements[short_name] = signal
|
|
364
|
+
return self.elements[short_name]
|
|
365
|
+
|
|
366
|
+
def createSystem(self, short_name: str) -> System:
|
|
367
|
+
if (short_name not in self.elements):
|
|
368
|
+
signal = System(self, short_name)
|
|
369
|
+
self.elements[short_name] = signal
|
|
370
|
+
return self.elements[short_name]
|
|
371
|
+
|
|
295
372
|
def getApplicationPrimitiveDataTypes(self) -> List[ApplicationPrimitiveDataType]:
|
|
296
373
|
return list(sorted(filter(lambda a: isinstance(a, ApplicationPrimitiveDataType), self.elements.values()), key= lambda o:o.short_name))
|
|
297
374
|
|
|
@@ -382,6 +459,9 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
382
459
|
def getLinClusters(self) -> List[LinCluster]:
|
|
383
460
|
return list(sorted(filter(lambda a : isinstance(a, LinCluster), self.elements.values()), key = lambda a: a.short_name))
|
|
384
461
|
|
|
462
|
+
def getCanClusters(self) -> List[CanCluster]:
|
|
463
|
+
return list(sorted(filter(lambda a : isinstance(a, CanCluster), self.elements.values()), key = lambda a: a.short_name))
|
|
464
|
+
|
|
385
465
|
def getLinUnconditionalFrames(self) -> List[LinUnconditionalFrame]:
|
|
386
466
|
return list(sorted(filter(lambda a : isinstance(a, LinUnconditionalFrame), self.elements.values()), key = lambda a: a.short_name))
|
|
387
467
|
|
|
@@ -394,6 +474,9 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
394
474
|
def getDcmIPdus(self) -> List[DcmIPdu]:
|
|
395
475
|
return list(sorted(filter(lambda a : isinstance(a, DcmIPdu), self.elements.values()), key = lambda a: a.short_name))
|
|
396
476
|
|
|
477
|
+
def getSecuredIPdus(self) -> List[SecuredIPdu]:
|
|
478
|
+
return list(sorted(filter(lambda a : isinstance(a, SecuredIPdu), self.elements.values()), key = lambda a: a.short_name))
|
|
479
|
+
|
|
397
480
|
def getNmConfigs(self) -> List[NmConfig]:
|
|
398
481
|
return list(sorted(filter(lambda a : isinstance(a, NmConfig), self.elements.values()), key = lambda a: a.short_name))
|
|
399
482
|
|
|
@@ -403,12 +486,39 @@ class ARPackage(Identifiable, CollectableElement):
|
|
|
403
486
|
def getCanFrames(self) -> List[CanFrame]:
|
|
404
487
|
return list(sorted(filter(lambda a : isinstance(a, CanFrame), self.elements.values()), key = lambda a: a.short_name))
|
|
405
488
|
|
|
489
|
+
def getEcuInstances(self) -> List[EcuInstance]:
|
|
490
|
+
return list(sorted(filter(lambda a : isinstance(a, EcuInstance), self.elements.values()), key = lambda a: a.short_name))
|
|
491
|
+
|
|
406
492
|
def getGateways(self) -> List[Gateway]:
|
|
407
493
|
return list(sorted(filter(lambda a : isinstance(a, Gateway), self.elements.values()), key = lambda a: a.short_name))
|
|
408
494
|
|
|
409
495
|
def getISignals(self) -> List[ISignal]:
|
|
410
496
|
return list(sorted(filter(lambda a : isinstance(a, ISignal), self.elements.values()), key = lambda a: a.short_name))
|
|
411
497
|
|
|
498
|
+
def getEcucValueCollections(self) -> List[EcucValueCollection]:
|
|
499
|
+
return list(sorted(filter(lambda a : isinstance(a, EcucValueCollection), self.elements.values()), key = lambda a: a.short_name))
|
|
500
|
+
|
|
501
|
+
def getEcucModuleConfigurationValues(self) -> List[EcucModuleConfigurationValues]:
|
|
502
|
+
return list(sorted(filter(lambda a : isinstance(a, EcucModuleConfigurationValues), self.elements.values()), key = lambda a: a.short_name))
|
|
503
|
+
|
|
504
|
+
def getEcucModuleConfigurationValues(self) -> List[PhysicalDimension]:
|
|
505
|
+
return list(sorted(filter(lambda a : isinstance(a, PhysicalDimension), self.elements.values()), key = lambda a: a.short_name))
|
|
506
|
+
|
|
507
|
+
def getISignalGroups(self) -> List[ISignalGroup]:
|
|
508
|
+
return list(sorted(filter(lambda a : isinstance(a, ISignalGroup), self.elements.values()), key = lambda a: a.short_name))
|
|
509
|
+
|
|
510
|
+
def getSystemSignals(self) -> List[SystemSignal]:
|
|
511
|
+
return list(sorted(filter(lambda a : isinstance(a, SystemSignal), self.elements.values()), key = lambda a: a.short_name))
|
|
512
|
+
|
|
513
|
+
def getSystemSignalGroups(self) -> List[SystemSignalGroup]:
|
|
514
|
+
return list(sorted(filter(lambda a : isinstance(a, SystemSignalGroup), self.elements.values()), key = lambda a: a.short_name))
|
|
515
|
+
|
|
516
|
+
def getISignalIPdus(self) -> List[ISignalIPdu]:
|
|
517
|
+
return list(sorted(filter(lambda a : isinstance(a, ISignalIPdu), self.elements.values()), key = lambda a: a.short_name))
|
|
518
|
+
|
|
519
|
+
def getSystems(self) -> List[System]:
|
|
520
|
+
return list(sorted(filter(lambda a : isinstance(a, System), self.elements.values()), key = lambda a: a.short_name))
|
|
521
|
+
|
|
412
522
|
class AUTOSAR (CollectableElement):
|
|
413
523
|
__instance = None
|
|
414
524
|
|
|
@@ -468,11 +578,11 @@ class AUTOSAR (CollectableElement):
|
|
|
468
578
|
def getDataType(self, data_type: ImplementationDataType) -> ImplementationDataType:
|
|
469
579
|
if (isinstance(data_type, ImplementationDataType) or isinstance(data_type, SwBaseType)):
|
|
470
580
|
if (data_type.category == ImplementationDataType.CATEGORY_TYPE_REFERENCE):
|
|
471
|
-
referred_type = self.find(data_type.
|
|
581
|
+
referred_type = self.find(data_type.swDataDefProps.implementationDataTypeRef.value)
|
|
472
582
|
return self.getDataType(referred_type)
|
|
473
583
|
if (data_type.category == ImplementationDataType.CATEGORY_DATA_REFERENCE):
|
|
474
|
-
if (data_type.
|
|
475
|
-
referred_type = self.find(data_type.
|
|
584
|
+
if (data_type.swDataDefProps.swPointerTargetProps.target_category == "VALUE"):
|
|
585
|
+
referred_type = self.find(data_type.swDataDefProps.swPointerTargetProps.sw_data_def_props.baseTypeRef.value)
|
|
476
586
|
return self.getDataType(referred_type)
|
|
477
587
|
return data_type
|
|
478
588
|
else:
|