fmu-manipulation-toolbox 1.9rc9__py3-none-any.whl → 1.9.1__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.
- fmu_manipulation_toolbox/__main__.py +1 -1
- fmu_manipulation_toolbox/__version__.py +1 -1
- fmu_manipulation_toolbox/assembly.py +13 -6
- fmu_manipulation_toolbox/checker.py +21 -2
- fmu_manipulation_toolbox/cli/fmucontainer.py +4 -1
- fmu_manipulation_toolbox/cli/fmutool.py +2 -2
- fmu_manipulation_toolbox/container.py +27 -7
- fmu_manipulation_toolbox/gui.py +2 -2
- fmu_manipulation_toolbox/operations.py +9 -1
- fmu_manipulation_toolbox/resources/darwin64/container.dylib +0 -0
- fmu_manipulation_toolbox/resources/linux32/client_sm.so +0 -0
- fmu_manipulation_toolbox/resources/linux64/client_sm.so +0 -0
- fmu_manipulation_toolbox/resources/linux64/container.so +0 -0
- fmu_manipulation_toolbox/resources/win32/client_sm.dll +0 -0
- fmu_manipulation_toolbox/resources/win32/server_sm.exe +0 -0
- fmu_manipulation_toolbox/resources/win64/client_sm.dll +0 -0
- fmu_manipulation_toolbox/resources/win64/container.dll +0 -0
- fmu_manipulation_toolbox/resources/win64/server_sm.exe +0 -0
- fmu_manipulation_toolbox/split.py +27 -23
- {fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/METADATA +1 -1
- {fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/RECORD +25 -25
- {fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/WHEEL +0 -0
- {fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/entry_points.txt +0 -0
- {fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/licenses/LICENSE.txt +0 -0
- {fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/top_level.txt +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
'V1.9
|
|
1
|
+
'V1.9.1'
|
|
@@ -38,7 +38,8 @@ class Connection:
|
|
|
38
38
|
|
|
39
39
|
class AssemblyNode:
|
|
40
40
|
def __init__(self, name: Optional[str], step_size: float = None, mt=False, profiling=False, sequential=False,
|
|
41
|
-
auto_link=True, auto_input=True, auto_output=True, auto_parameter=False, auto_local=False
|
|
41
|
+
auto_link=True, auto_input=True, auto_output=True, auto_parameter=False, auto_local=False,
|
|
42
|
+
ts_multiplier=False):
|
|
42
43
|
self.name = name
|
|
43
44
|
if step_size:
|
|
44
45
|
try:
|
|
@@ -56,6 +57,7 @@ class AssemblyNode:
|
|
|
56
57
|
self.auto_output = auto_output
|
|
57
58
|
self.auto_parameter = auto_parameter
|
|
58
59
|
self.auto_local = auto_local
|
|
60
|
+
self.ts_multiplier = ts_multiplier
|
|
59
61
|
|
|
60
62
|
self.parent: Optional[AssemblyNode] = None
|
|
61
63
|
self.children: Dict[str, AssemblyNode] = {} # sub-containers
|
|
@@ -141,7 +143,7 @@ class AssemblyNode:
|
|
|
141
143
|
self.add_link(link_rule[0], link_rule[1], link_rule[2], link_rule[3])
|
|
142
144
|
|
|
143
145
|
container.make_fmu(self.name, self.step_size, mt=self.mt, profiling=self.profiling, sequential=self.sequential,
|
|
144
|
-
debug=debug)
|
|
146
|
+
debug=debug, ts_multiplier=self.ts_multiplier)
|
|
145
147
|
|
|
146
148
|
for node in self.children.values():
|
|
147
149
|
logger.info(f"Deleting transient FMU Container '{node.name}'")
|
|
@@ -221,7 +223,7 @@ class AssemblyError(Exception):
|
|
|
221
223
|
class Assembly:
|
|
222
224
|
def __init__(self, filename: str, step_size=None, auto_link=True, auto_input=True, debug=False, sequential=False,
|
|
223
225
|
auto_output=True, mt=False, profiling=False, fmu_directory: Path = Path("."), auto_parameter=False,
|
|
224
|
-
auto_local=False):
|
|
226
|
+
auto_local=False, ts_multiplier=False):
|
|
225
227
|
self.filename = Path(filename)
|
|
226
228
|
self.default_auto_input = auto_input
|
|
227
229
|
self.debug = debug
|
|
@@ -233,6 +235,7 @@ class Assembly:
|
|
|
233
235
|
self.default_mt = mt
|
|
234
236
|
self.default_sequential = sequential
|
|
235
237
|
self.default_profiling = profiling
|
|
238
|
+
self.default_ts_multiplier = ts_multiplier
|
|
236
239
|
self.fmu_directory = fmu_directory
|
|
237
240
|
self.transient_filenames: List[Path] = []
|
|
238
241
|
self.transient_dirnames: Set[Path] = set()
|
|
@@ -289,7 +292,7 @@ class Assembly:
|
|
|
289
292
|
mt=self.default_mt, profiling=self.default_profiling,
|
|
290
293
|
sequential=self.default_sequential, auto_input=self.default_auto_input,
|
|
291
294
|
auto_output=self.default_auto_output, auto_parameter=self.default_auto_parameter,
|
|
292
|
-
auto_local=self.default_auto_local)
|
|
295
|
+
auto_local=self.default_auto_local, ts_multiplier=self.default_ts_multiplier)
|
|
293
296
|
|
|
294
297
|
with open(self.input_pathname) as file:
|
|
295
298
|
reader = csv.reader(file, delimiter=';')
|
|
@@ -397,15 +400,16 @@ class Assembly:
|
|
|
397
400
|
auto_parameter = data.get("auto_parameter", self.default_auto_parameter) # 6b
|
|
398
401
|
auto_local = data.get("auto_local", self.default_auto_local) # 6c
|
|
399
402
|
step_size = data.get("step_size", self.default_step_size) # 7
|
|
403
|
+
ts_multiplier = data.get("ts_multiplier", self.default_ts_multiplier) # 7b
|
|
400
404
|
|
|
401
405
|
node = AssemblyNode(name, step_size=step_size, auto_link=auto_link, mt=mt, profiling=profiling,
|
|
402
406
|
sequential=sequential,
|
|
403
407
|
auto_input=auto_input, auto_output=auto_output, auto_parameter=auto_parameter,
|
|
404
|
-
auto_local=auto_local)
|
|
408
|
+
auto_local=auto_local, ts_multiplier=ts_multiplier)
|
|
405
409
|
|
|
406
410
|
for key, value in data.items():
|
|
407
411
|
if key in ('name', 'step_size', 'auto_link', 'auto_input', 'auto_output', 'mt', 'profiling', 'sequential',
|
|
408
|
-
'auto_parameter', 'auto_local'):
|
|
412
|
+
'auto_parameter', 'auto_local', 'ts_multiplier'):
|
|
409
413
|
continue # Already read
|
|
410
414
|
|
|
411
415
|
elif key == "container": # 8
|
|
@@ -472,6 +476,9 @@ class Assembly:
|
|
|
472
476
|
if node.step_size:
|
|
473
477
|
json_node["step_size"] = node.step_size # 7
|
|
474
478
|
|
|
479
|
+
if node.ts_multiplier:
|
|
480
|
+
json_node["ts_multiplier"] = node.ts_multiplier # 7b
|
|
481
|
+
|
|
475
482
|
if node.children:
|
|
476
483
|
json_node["container"] = [self._json_encode_node(child) for child in node.children.values()] # 8
|
|
477
484
|
|
|
@@ -2,8 +2,11 @@ import importlib.util
|
|
|
2
2
|
import inspect
|
|
3
3
|
import logging
|
|
4
4
|
import os
|
|
5
|
+
import sys
|
|
5
6
|
import xmlschema
|
|
7
|
+
from typing import *
|
|
6
8
|
from xmlschema.validators.exceptions import XMLSchemaValidationError
|
|
9
|
+
|
|
7
10
|
from .operations import OperationAbstract
|
|
8
11
|
|
|
9
12
|
logger = logging.getLogger("fmu_manipulation_toolbox")
|
|
@@ -40,8 +43,24 @@ class OperationGenericCheck(OperationAbstract):
|
|
|
40
43
|
else:
|
|
41
44
|
logger.error(f"This FMU does not validate with FMI standard.")
|
|
42
45
|
|
|
46
|
+
_checkers_list: List[type[OperationAbstract]] = [OperationGenericCheck]
|
|
47
|
+
|
|
48
|
+
def get_checkers() -> List[type[OperationAbstract]]:
|
|
49
|
+
if sys.version_info < (3, 10):
|
|
50
|
+
from importlib_metadata import entry_points
|
|
51
|
+
else:
|
|
52
|
+
from importlib.metadata import entry_points
|
|
53
|
+
checkers: List[type[OperationAbstract]] = _checkers_list
|
|
54
|
+
discovered_checkers = entry_points(group='fmu_manipulation_toolbox.checkers')
|
|
55
|
+
|
|
56
|
+
for checker in discovered_checkers:
|
|
57
|
+
entry = checker.load()
|
|
58
|
+
checker_class = entry()
|
|
59
|
+
if issubclass(checker_class, OperationAbstract):
|
|
60
|
+
logger.debug(f"Addon checker: {checker.name}")
|
|
61
|
+
checkers.append(checker_class)
|
|
43
62
|
|
|
44
|
-
|
|
63
|
+
return checkers
|
|
45
64
|
|
|
46
65
|
|
|
47
66
|
def add_from_file(checker_filename: str):
|
|
@@ -59,7 +78,7 @@ def add_from_file(checker_filename: str):
|
|
|
59
78
|
|
|
60
79
|
for checker_name, checker_class in inspect.getmembers(checker_module, inspect.isclass):
|
|
61
80
|
if OperationAbstract in checker_class.__bases__:
|
|
62
|
-
|
|
81
|
+
_checkers_list.append(checker_class)
|
|
63
82
|
logger.info(f"Adding checker: {checker_filename}|{checker_name}")
|
|
64
83
|
|
|
65
84
|
except AttributeError:
|
|
@@ -65,6 +65,9 @@ def fmucontainer(command_options: Sequence[str]):
|
|
|
65
65
|
parser.add_argument("-dump-json", action="store_true", dest="dump", default=False,
|
|
66
66
|
help="Dump a JSON file for each container.")
|
|
67
67
|
|
|
68
|
+
parser.add_argument("-vr", action="store_true", dest="ts_multiplier", default=False,
|
|
69
|
+
help="Add TS_MULTIPLIER input port to control step_size")
|
|
70
|
+
|
|
68
71
|
config = parser.parse_args(command_options)
|
|
69
72
|
|
|
70
73
|
if config.debug:
|
|
@@ -87,7 +90,7 @@ def fmucontainer(command_options: Sequence[str]):
|
|
|
87
90
|
auto_input=config.auto_input, auto_output=config.auto_output,
|
|
88
91
|
auto_local=config.auto_local, mt=config.mt, sequential=config.sequential,
|
|
89
92
|
profiling=config.profiling, fmu_directory=fmu_directory, debug=config.debug,
|
|
90
|
-
auto_parameter=config.auto_parameter)
|
|
93
|
+
auto_parameter=config.auto_parameter, ts_multiplier=config.ts_multiplier)
|
|
91
94
|
except FileNotFoundError as e:
|
|
92
95
|
logger.fatal(f"Cannot read file: {e}")
|
|
93
96
|
sys.exit(-1)
|
|
@@ -9,7 +9,7 @@ from ..operations import (OperationSummary, OperationError, OperationRemoveRegex
|
|
|
9
9
|
OperationStripTopLevel, OperationRenameFromCSV, OperationSaveNamesToCSV, FMU, FMUError)
|
|
10
10
|
from ..remoting import (OperationAddFrontendWin32, OperationAddFrontendWin64, OperationAddRemotingWin32,
|
|
11
11
|
OperationAddRemotingWin64)
|
|
12
|
-
from ..checker import
|
|
12
|
+
from ..checker import get_checkers
|
|
13
13
|
from ..version import __version__ as version
|
|
14
14
|
from ..help import Help
|
|
15
15
|
|
|
@@ -69,7 +69,7 @@ def fmutool(command_options: Sequence[str]):
|
|
|
69
69
|
add_option('-only-locals', action='append_const', dest='apply_on', const='local')
|
|
70
70
|
# Checker
|
|
71
71
|
add_option('-summary', action='append_const', dest='operations_list', const=OperationSummary())
|
|
72
|
-
add_option('-check', action='append_const', dest='operations_list', const=[checker() for checker in
|
|
72
|
+
add_option('-check', action='append_const', dest='operations_list', const=[checker() for checker in get_checkers()])
|
|
73
73
|
|
|
74
74
|
cli_options = parser.parse_args(command_options)
|
|
75
75
|
# handle the "no operation" use case
|
|
@@ -426,7 +426,7 @@ class FMUContainer:
|
|
|
426
426
|
<Category name="fmucontainer"/>
|
|
427
427
|
</LogCategories>
|
|
428
428
|
|
|
429
|
-
<DefaultExperiment stepSize="{step_size}"
|
|
429
|
+
<DefaultExperiment stepSize="{step_size}"{default_experiment_times}/>
|
|
430
430
|
|
|
431
431
|
<ModelVariables>
|
|
432
432
|
<ScalarVariable valueReference="0" name="time" causality="independent"><Real /></ScalarVariable>
|
|
@@ -460,7 +460,7 @@ class FMUContainer:
|
|
|
460
460
|
<Category name="fmucontainer"/>
|
|
461
461
|
</LogCategories>
|
|
462
462
|
|
|
463
|
-
<DefaultExperiment stepSize="{step_size}"
|
|
463
|
+
<DefaultExperiment stepSize="{step_size}"{default_experiment_times}/>
|
|
464
464
|
|
|
465
465
|
<ModelVariables>
|
|
466
466
|
<Float64 valueReference="0" name="time" causality="independent"/>
|
|
@@ -681,7 +681,7 @@ class FMUContainer:
|
|
|
681
681
|
logger.warning(f"{cport} is not connected")
|
|
682
682
|
|
|
683
683
|
def make_fmu(self, fmu_filename: Union[str, Path], step_size: Optional[float] = None, debug=False, mt=False,
|
|
684
|
-
profiling=False, sequential=False):
|
|
684
|
+
profiling=False, sequential=False, ts_multiplier=False):
|
|
685
685
|
if isinstance(fmu_filename, str):
|
|
686
686
|
fmu_filename = Path(fmu_filename)
|
|
687
687
|
|
|
@@ -695,7 +695,7 @@ class FMUContainer:
|
|
|
695
695
|
base_directory = self.fmu_directory / fmu_filename.with_suffix('')
|
|
696
696
|
resources_directory = self.make_fmu_skeleton(base_directory)
|
|
697
697
|
with open(base_directory / "modelDescription.xml", "wt") as xml_file:
|
|
698
|
-
self.make_fmu_xml(xml_file, step_size, profiling)
|
|
698
|
+
self.make_fmu_xml(xml_file, step_size, profiling, ts_multiplier)
|
|
699
699
|
with open(resources_directory / "container.txt", "wt") as txt_file:
|
|
700
700
|
self.make_fmu_txt(txt_file, step_size, mt, profiling, sequential)
|
|
701
701
|
|
|
@@ -703,7 +703,7 @@ class FMUContainer:
|
|
|
703
703
|
if not debug:
|
|
704
704
|
self.make_fmu_cleanup(base_directory)
|
|
705
705
|
|
|
706
|
-
def make_fmu_xml(self, xml_file, step_size: float, profiling: bool):
|
|
706
|
+
def make_fmu_xml(self, xml_file, step_size: float, profiling: bool, ts_multiplier: bool):
|
|
707
707
|
timestamp = datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')
|
|
708
708
|
guid = str(uuid.uuid4())
|
|
709
709
|
embedded_fmu = ", ".join([fmu_name for fmu_name in self.involved_fmu])
|
|
@@ -732,13 +732,19 @@ class FMUContainer:
|
|
|
732
732
|
else:
|
|
733
733
|
logger.info(f"stop_time={self.stop_time}")
|
|
734
734
|
|
|
735
|
+
default_experiment_times = ""
|
|
736
|
+
if self.start_time is not None:
|
|
737
|
+
default_experiment_times += f' startTime="{self.start_time}"'
|
|
738
|
+
if self.stop_time is not None:
|
|
739
|
+
default_experiment_times += f' stopTime="{self.stop_time}"'
|
|
740
|
+
|
|
735
741
|
if self.fmi_version == 2:
|
|
736
742
|
xml_file.write(self.HEADER_XML_2.format(identifier=self.identifier, tool_version=tool_version,
|
|
737
743
|
timestamp=timestamp, guid=guid, embedded_fmu=embedded_fmu,
|
|
738
744
|
author=author,
|
|
739
745
|
only_once=capabilities['canBeInstantiatedOnlyOncePerProcess'],
|
|
740
746
|
execution_tool=capabilities['needsExecutionTool'],
|
|
741
|
-
|
|
747
|
+
default_experiment_times=default_experiment_times,
|
|
742
748
|
step_size=step_size))
|
|
743
749
|
elif self.fmi_version == 3:
|
|
744
750
|
xml_file.write(self.HEADER_XML_3.format(identifier=self.identifier, tool_version=tool_version,
|
|
@@ -746,12 +752,24 @@ class FMUContainer:
|
|
|
746
752
|
author=author,
|
|
747
753
|
only_once=capabilities['canBeInstantiatedOnlyOncePerProcess'],
|
|
748
754
|
execution_tool=capabilities['needsExecutionTool'],
|
|
749
|
-
|
|
755
|
+
default_experiment_times=default_experiment_times,
|
|
750
756
|
step_size=step_size))
|
|
751
757
|
|
|
752
758
|
vr_time = self.vr_table.add_vr("real64", local=True)
|
|
753
759
|
logger.debug(f"Time vr = {vr_time}")
|
|
754
760
|
|
|
761
|
+
vr_ts_multiplier = self.vr_table.add_vr("integer32", local=True)
|
|
762
|
+
if ts_multiplier:
|
|
763
|
+
logger.debug(f"TS Multiplier vr = {vr_ts_multiplier}")
|
|
764
|
+
port = EmbeddedFMUPort("integer32", {"valueReference": vr_ts_multiplier,
|
|
765
|
+
"name": f"container.ts_multiplier",
|
|
766
|
+
"causality": "input",
|
|
767
|
+
"description": f"Timestep multiplier",
|
|
768
|
+
"variability": "discrete",
|
|
769
|
+
"start": 1,
|
|
770
|
+
"initial": "exact"})
|
|
771
|
+
print(f" {port.xml(vr_ts_multiplier, fmi_version=self.fmi_version)}", file=xml_file)
|
|
772
|
+
|
|
755
773
|
if profiling:
|
|
756
774
|
for fmu in self.involved_fmu.values():
|
|
757
775
|
vr = self.vr_table.add_vr("real64", local=True)
|
|
@@ -915,6 +933,8 @@ class FMUContainer:
|
|
|
915
933
|
if profiling:
|
|
916
934
|
for profiling_port, _ in enumerate(self.involved_fmu.values()):
|
|
917
935
|
print(f"{profiling_port + 1} 1 -2 {profiling_port + 1}", file=txt_file)
|
|
936
|
+
elif type_name == "integer32":
|
|
937
|
+
print(f"0 1 -1 0", file=txt_file) # TS Multiplier
|
|
918
938
|
|
|
919
939
|
for input_port in inputs_per_type[type_name]:
|
|
920
940
|
cport_string = [f"{fmu_rank[cport.fmu.name]} {cport.port.vr}" for cport in input_port.cport_list]
|
fmu_manipulation_toolbox/gui.py
CHANGED
|
@@ -16,7 +16,7 @@ from .operations import *
|
|
|
16
16
|
from .remoting import (OperationAddRemotingWin32, OperationAddRemotingWin64, OperationAddFrontendWin32,
|
|
17
17
|
OperationAddFrontendWin64)
|
|
18
18
|
from .assembly import Assembly, AssemblyNode
|
|
19
|
-
from .checker import
|
|
19
|
+
from .checker import get_checkers
|
|
20
20
|
from .help import Help
|
|
21
21
|
from .version import __version__ as version
|
|
22
22
|
|
|
@@ -414,7 +414,7 @@ class MainWindow(WindowWithLayout):
|
|
|
414
414
|
("Add Win64 remoting", '-add-remoting-win64', 'info', OperationAddRemotingWin64),
|
|
415
415
|
("Add Win32 frontend", '-add-frontend-win32', 'info', OperationAddFrontendWin32),
|
|
416
416
|
("Add Win64 frontend", '-add-frontend-win64', 'info', OperationAddFrontendWin64),
|
|
417
|
-
("Check", '-check', 'info',
|
|
417
|
+
("Check", '-check', 'info', get_checkers()),
|
|
418
418
|
]
|
|
419
419
|
|
|
420
420
|
width = 5
|
|
@@ -69,7 +69,13 @@ class FMUPort:
|
|
|
69
69
|
print(f" <{self.fmi_type} {self.dict_level(1)}/>", file=file)
|
|
70
70
|
print(f" </ScalarVariable>", file=file)
|
|
71
71
|
elif fmi_version == 3:
|
|
72
|
-
|
|
72
|
+
start_value = self.get("start", "")
|
|
73
|
+
if self.fmi_type in ("String", "Binary") and start_value:
|
|
74
|
+
print(f" <{self.fmi_type} {self.dict_level(0)}>", file=file)
|
|
75
|
+
print(f' <Start value="{start_value}"/>', file=file)
|
|
76
|
+
print(f" </{self.fmi_type}>", file=file)
|
|
77
|
+
else:
|
|
78
|
+
print(f" <{self.fmi_type} {self.dict_level(0)}/>", file=file)
|
|
73
79
|
else:
|
|
74
80
|
raise FMUError(f"FMUPort writing: unsupported FMI version {fmi_version}")
|
|
75
81
|
|
|
@@ -177,6 +183,8 @@ class Manipulation:
|
|
|
177
183
|
self.current_port = FMUPort()
|
|
178
184
|
self.current_port.fmi_type = name
|
|
179
185
|
self.current_port.push_attrs(attrs)
|
|
186
|
+
elif self.fmu.fmi_version == 3 and name == "Start":
|
|
187
|
+
self.current_port.push_attrs({"start": attrs.get("value", "")})
|
|
180
188
|
elif name == 'CoSimulation':
|
|
181
189
|
self.operation.cosimulation_attrs(attrs)
|
|
182
190
|
elif name == 'DefaultExperiment':
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -111,16 +111,10 @@ class FMUSplitter:
|
|
|
111
111
|
fmu_file.writestr(file[len(directory):], data)
|
|
112
112
|
logger.info(f"FMU Extraction of '{filename}'")
|
|
113
113
|
|
|
114
|
-
|
|
115
114
|
class FMUSplitterDescription:
|
|
116
115
|
def __init__(self, zip):
|
|
117
116
|
self.zip = zip
|
|
118
|
-
self.links: Dict[str, Dict[int, FMUSplitterLink]] = {
|
|
119
|
-
"Real": {},
|
|
120
|
-
"Integer": {},
|
|
121
|
-
"Boolean": {},
|
|
122
|
-
"String": {}
|
|
123
|
-
}
|
|
117
|
+
self.links: Dict[str, Dict[int, FMUSplitterLink]] = dict((el, {}) for el in EmbeddedFMUPort.ALL_TYPES)
|
|
124
118
|
self.vr_to_name: Dict[str, Dict[str, Dict[int, Dict[str, str]]]] = {} # name, fmi_type, vr <-> {name, causality}
|
|
125
119
|
self.config: Dict[str, Any] = {
|
|
126
120
|
"auto_input": False,
|
|
@@ -133,10 +127,11 @@ class FMUSplitterDescription:
|
|
|
133
127
|
|
|
134
128
|
# used for modelDescription.xml parsing
|
|
135
129
|
self.current_fmu_filename = None
|
|
130
|
+
self.current_fmi_version = None
|
|
136
131
|
self.current_vr = None
|
|
137
132
|
self.current_name = None
|
|
138
133
|
self.current_causality = None
|
|
139
|
-
self.supported_fmi_types: Tuple[str] = ()
|
|
134
|
+
self.supported_fmi_types: Tuple[str] = tuple()
|
|
140
135
|
|
|
141
136
|
@staticmethod
|
|
142
137
|
def get_line(file):
|
|
@@ -146,14 +141,23 @@ class FMUSplitterDescription:
|
|
|
146
141
|
return line
|
|
147
142
|
raise StopIteration
|
|
148
143
|
|
|
149
|
-
def start_element(self,
|
|
150
|
-
if
|
|
144
|
+
def start_element(self, tag, attrs):
|
|
145
|
+
if tag == "fmiModelDescription":
|
|
146
|
+
self.current_fmi_version = attrs["fmiVersion"]
|
|
147
|
+
elif tag == "ScalarVariable":
|
|
151
148
|
self.current_name = attrs["name"]
|
|
152
149
|
self.current_vr = int(attrs["valueReference"])
|
|
153
150
|
self.current_causality = attrs["causality"]
|
|
154
|
-
elif
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
elif self.current_fmi_version == "2.0" and tag in EmbeddedFMUPort.FMI_TO_CONTAINER[2]:
|
|
152
|
+
fmi_type = EmbeddedFMUPort.FMI_TO_CONTAINER[2][tag]
|
|
153
|
+
self.vr_to_name[self.current_fmu_filename][fmi_type][self.current_vr] = {
|
|
154
|
+
"name": self.current_name,
|
|
155
|
+
"causality": self.current_causality}
|
|
156
|
+
elif self.current_fmi_version == "3.0" and tag in EmbeddedFMUPort.FMI_TO_CONTAINER[3]:
|
|
157
|
+
fmi_type = EmbeddedFMUPort.FMI_TO_CONTAINER[3][tag]
|
|
158
|
+
self.vr_to_name[self.current_fmu_filename][fmi_type][int(attrs["valueReference"])] = {
|
|
159
|
+
"name": attrs["name"],
|
|
160
|
+
"causality": attrs["causality"]}
|
|
157
161
|
else:
|
|
158
162
|
self.current_vr = None
|
|
159
163
|
self.current_name = None
|
|
@@ -166,14 +170,10 @@ class FMUSplitterDescription:
|
|
|
166
170
|
else:
|
|
167
171
|
filename = f"{directory}/modelDescription.xml"
|
|
168
172
|
|
|
169
|
-
self.vr_to_name[fmu_filename] = {
|
|
170
|
-
"Real": {},
|
|
171
|
-
"Integer": {},
|
|
172
|
-
"Boolean": {},
|
|
173
|
-
"String": {}
|
|
174
|
-
}
|
|
173
|
+
self.vr_to_name[fmu_filename] = dict((el, {}) for el in EmbeddedFMUPort.ALL_TYPES)
|
|
175
174
|
parser = xml.parsers.expat.ParserCreate()
|
|
176
175
|
self.current_fmu_filename = fmu_filename
|
|
176
|
+
self.current_fmi_version = None
|
|
177
177
|
self.current_vr = None
|
|
178
178
|
self.current_name = None
|
|
179
179
|
self.current_causality = None
|
|
@@ -266,14 +266,14 @@ class FMUSplitterDescription:
|
|
|
266
266
|
def parse_txt_file(self, txt_filename: str):
|
|
267
267
|
self.parse_model_description(str(Path(txt_filename).parent.parent), ".")
|
|
268
268
|
logger.debug(f"Parsing container file '{txt_filename}'")
|
|
269
|
-
|
|
270
269
|
with (self.zip.open(txt_filename) as file):
|
|
271
270
|
self.parse_txt_file_header(file, txt_filename)
|
|
272
271
|
self.parse_txt_file_ports(file)
|
|
273
272
|
|
|
274
273
|
for fmu_filename in self.config["candidate_fmu"]:
|
|
275
274
|
# Inputs per FMUs
|
|
276
|
-
|
|
275
|
+
|
|
276
|
+
for fmi_type in self.supported_fmi_types:
|
|
277
277
|
nb_input = int(self.get_line(file))
|
|
278
278
|
for i in range(nb_input):
|
|
279
279
|
local, vr = self.get_line(file).split(" ")
|
|
@@ -285,7 +285,7 @@ class FMUSplitterDescription:
|
|
|
285
285
|
link.to_port.append(FMUSplitterPort(fmu_filename,
|
|
286
286
|
self.vr_to_name[fmu_filename][fmi_type][int(vr)]["name"]))
|
|
287
287
|
|
|
288
|
-
for fmi_type in
|
|
288
|
+
for fmi_type in self.supported_fmi_types:
|
|
289
289
|
nb_start = int(self.get_line(file))
|
|
290
290
|
for i in range(nb_start):
|
|
291
291
|
tokens = self.get_line(file).split(" ")
|
|
@@ -299,7 +299,7 @@ class FMUSplitterDescription:
|
|
|
299
299
|
self.config["start"] = [start_definition]
|
|
300
300
|
|
|
301
301
|
# Output per FMUs
|
|
302
|
-
for fmi_type in
|
|
302
|
+
for fmi_type in self.supported_fmi_types:
|
|
303
303
|
nb_output = int(self.get_line(file))
|
|
304
304
|
|
|
305
305
|
for i in range(nb_output):
|
|
@@ -311,6 +311,10 @@ class FMUSplitterDescription:
|
|
|
311
311
|
self.links[fmi_type][local] = link
|
|
312
312
|
link.from_port = FMUSplitterPort(fmu_filename,
|
|
313
313
|
self.vr_to_name[fmu_filename][fmi_type][int(vr)]["name"])
|
|
314
|
+
#conversion
|
|
315
|
+
nb_conversion = int(self.get_line(file))
|
|
316
|
+
for i in range(nb_conversion):
|
|
317
|
+
self.get_line(file)
|
|
314
318
|
|
|
315
319
|
logger.debug("End of parsing.")
|
|
316
320
|
|
{fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmu_manipulation_toolbox
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.1
|
|
4
4
|
Summary: FMU Manipulation Toolbox is a python application for modifying Functional Mock-up Units (FMUs) without recompilation or bundling them into FMU Containers
|
|
5
5
|
Home-page: https://github.com/grouperenault/fmu_manipulation_toolbox/
|
|
6
6
|
Author: Nicolas.LAURENT@Renault.com
|
{fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/RECORD
RENAMED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
fmu_manipulation_toolbox/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
fmu_manipulation_toolbox/__main__.py,sha256=
|
|
3
|
-
fmu_manipulation_toolbox/__version__.py,sha256=
|
|
4
|
-
fmu_manipulation_toolbox/assembly.py,sha256
|
|
5
|
-
fmu_manipulation_toolbox/checker.py,sha256=
|
|
6
|
-
fmu_manipulation_toolbox/container.py,sha256=
|
|
7
|
-
fmu_manipulation_toolbox/gui.py,sha256
|
|
2
|
+
fmu_manipulation_toolbox/__main__.py,sha256=Ixgo_5YS_khXseMujNPsVzaerkHPugLPYPV7FIi5umo,364
|
|
3
|
+
fmu_manipulation_toolbox/__version__.py,sha256=F1YnOtakt3tZZDQQNxPG2WjLDNM0C_-tnWfumOBOxOI,9
|
|
4
|
+
fmu_manipulation_toolbox/assembly.py,sha256=-i9iQLKiPyjdFZyxHmB1FgL3NYmRPfTWVs9lf3fC5sE,27022
|
|
5
|
+
fmu_manipulation_toolbox/checker.py,sha256=RmIYd6s4p2S9wdv-uSILfVm__QTZSUJCiq6hr_G5rxA,3119
|
|
6
|
+
fmu_manipulation_toolbox/container.py,sha256=dUjgOlTjzIOYDrc9vuxdL5g8WYxmDzhIzP0W8X_QcIE,46894
|
|
7
|
+
fmu_manipulation_toolbox/gui.py,sha256=-DyWY2MoECr3FGRYdS60Ltoayhd3O0uOCtkQ4YXE8xc,29201
|
|
8
8
|
fmu_manipulation_toolbox/gui_style.py,sha256=s6WdrnNd_lCMWhuBf5LKK8wrfLXCU7pFTLUfvqkJVno,6633
|
|
9
9
|
fmu_manipulation_toolbox/help.py,sha256=j8xmnCrwQpaW-SZ8hSqA1dlTXgaqzQWc4Yr3RH_oqck,6012
|
|
10
|
-
fmu_manipulation_toolbox/operations.py,sha256=
|
|
10
|
+
fmu_manipulation_toolbox/operations.py,sha256=ZV6BRXszwvmqJwUCnTFkWfIYvfK4i-OHN69kffkmGbI,21075
|
|
11
11
|
fmu_manipulation_toolbox/remoting.py,sha256=N25MDFkIcEWe9CIT1M4L9kea3j-8E7i2I1VOI6zIAdw,3876
|
|
12
|
-
fmu_manipulation_toolbox/split.py,sha256=
|
|
12
|
+
fmu_manipulation_toolbox/split.py,sha256=yFaW6yhvFjOXpRynWzitR7o7uSrxb-RxeFzmQNxUFHI,14147
|
|
13
13
|
fmu_manipulation_toolbox/version.py,sha256=OhBLkZ1-nhC77kyvffPNAf6m8OZe1bYTnNf_PWs1NvM,392
|
|
14
14
|
fmu_manipulation_toolbox/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
fmu_manipulation_toolbox/cli/fmucontainer.py,sha256=
|
|
15
|
+
fmu_manipulation_toolbox/cli/fmucontainer.py,sha256=C-gJvPcz_0YNqbLatgDHC1PC5WjcW8SslfpZCS5k9qs,5047
|
|
16
16
|
fmu_manipulation_toolbox/cli/fmusplit.py,sha256=VMDYjmvIsjPHJINZaOt1Zy8D0so6d99285LbS8v-Tro,1734
|
|
17
|
-
fmu_manipulation_toolbox/cli/fmutool.py,sha256=
|
|
17
|
+
fmu_manipulation_toolbox/cli/fmutool.py,sha256=TEDZxRVfFT_HHfXsslE6U4E5mhEMmxvbHJjCQX4WI2c,6088
|
|
18
18
|
fmu_manipulation_toolbox/cli/utils.py,sha256=gNhdlFYSSNSb0fovzS0crnxgmqqKXe0KtoZZFhRKhfg,1375
|
|
19
19
|
fmu_manipulation_toolbox/resources/checkbox-checked-disabled.png,sha256=FWIuyrXlaNLLePHfXj7j9ca5rT8Hgr14KCe1EqTCZyk,2288
|
|
20
20
|
fmu_manipulation_toolbox/resources/checkbox-checked-hover.png,sha256=KNlV-d_aJNTTvUVXKGT9DBY30sIs2LwocLJrFKNKv8k,2419
|
|
@@ -33,7 +33,7 @@ fmu_manipulation_toolbox/resources/icon_fmu.png,sha256=EuygB2xcoM2WAfKKdyKG_UvTL
|
|
|
33
33
|
fmu_manipulation_toolbox/resources/license.txt,sha256=5ODuU8g8pIkK-NMWXu_rjZ6k7gM7b-N2rmg87-2Kmqw,1583
|
|
34
34
|
fmu_manipulation_toolbox/resources/mask.png,sha256=px1U4hQGL0AmZ4BQPknOVREpMpTSejbah3ntkpqAzFA,3008
|
|
35
35
|
fmu_manipulation_toolbox/resources/model.png,sha256=EAf_HnZJe8zYGZygerG1MMt2U-tMMZlifzXPj4_iORA,208788
|
|
36
|
-
fmu_manipulation_toolbox/resources/darwin64/container.dylib,sha256=
|
|
36
|
+
fmu_manipulation_toolbox/resources/darwin64/container.dylib,sha256=zpruIma2DMFAwn14kIbG3IxiLkfC8PDG89OjFaXMY_Y,161560
|
|
37
37
|
fmu_manipulation_toolbox/resources/fmi-2.0/fmi2Annotation.xsd,sha256=OGfyJtaJntKypX5KDpuZ-nV1oYLZ6HV16pkpKOmYox4,2731
|
|
38
38
|
fmu_manipulation_toolbox/resources/fmi-2.0/fmi2AttributeGroups.xsd,sha256=HwyV7LBse-PQSv4z1xjmtzPU3Hjnv4mluq9YdSBNHMQ,3704
|
|
39
39
|
fmu_manipulation_toolbox/resources/fmi-2.0/fmi2ModelDescription.xsd,sha256=JM4j_9q-pc40XYHb28jfT3iV3aYM5JLqD5aRjO72K1E,18939
|
|
@@ -53,19 +53,19 @@ fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Type.xsd,sha256=TaHRoUBIFtmdEwBKB
|
|
|
53
53
|
fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Unit.xsd,sha256=CK_F2t5LfyQ6eSNJ8soTFMVK9DU8vD2WiMi2MQvjB0g,3746
|
|
54
54
|
fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Variable.xsd,sha256=3YU-3q1-c-namz7sMe5cxnmOVOJsRSmfWR02PKv3xaU,19171
|
|
55
55
|
fmu_manipulation_toolbox/resources/fmi-3.0/fmi3VariableDependency.xsd,sha256=YQSBwXt4IsDlyegY8bX-qQHGSfE5TipTPfo2g2yqq1c,3082
|
|
56
|
-
fmu_manipulation_toolbox/resources/linux32/client_sm.so,sha256=
|
|
56
|
+
fmu_manipulation_toolbox/resources/linux32/client_sm.so,sha256=TQa6UMAVKfdVLO6adH17cw_PeYX68AjWhREMygvsrMY,34756
|
|
57
57
|
fmu_manipulation_toolbox/resources/linux32/server_sm,sha256=gzKU0BTeaRkvhTMQtHHj3K8uYFyEdyGGn_mZy_jG9xo,21304
|
|
58
|
-
fmu_manipulation_toolbox/resources/linux64/client_sm.so,sha256=
|
|
59
|
-
fmu_manipulation_toolbox/resources/linux64/container.so,sha256=
|
|
58
|
+
fmu_manipulation_toolbox/resources/linux64/client_sm.so,sha256=zKqTUEgbroHc-NQj5WmS8-B1sZEBu3jJPvZRQJ9S9iA,32592
|
|
59
|
+
fmu_manipulation_toolbox/resources/linux64/container.so,sha256=EeJdbmr-oQVTUPNtUQfnYtfracVtdoRueOuIII5WcBI,135520
|
|
60
60
|
fmu_manipulation_toolbox/resources/linux64/server_sm,sha256=MZn6vITN2qpBHYt_RaK2VnFFp00hk8fTALBHmXPtLwc,22608
|
|
61
|
-
fmu_manipulation_toolbox/resources/win32/client_sm.dll,sha256=
|
|
62
|
-
fmu_manipulation_toolbox/resources/win32/server_sm.exe,sha256=
|
|
63
|
-
fmu_manipulation_toolbox/resources/win64/client_sm.dll,sha256=
|
|
64
|
-
fmu_manipulation_toolbox/resources/win64/container.dll,sha256=
|
|
65
|
-
fmu_manipulation_toolbox/resources/win64/server_sm.exe,sha256=
|
|
66
|
-
fmu_manipulation_toolbox-1.
|
|
67
|
-
fmu_manipulation_toolbox-1.
|
|
68
|
-
fmu_manipulation_toolbox-1.
|
|
69
|
-
fmu_manipulation_toolbox-1.
|
|
70
|
-
fmu_manipulation_toolbox-1.
|
|
71
|
-
fmu_manipulation_toolbox-1.
|
|
61
|
+
fmu_manipulation_toolbox/resources/win32/client_sm.dll,sha256=OZH0q8D8gr0JgMUTeb48z5y-CjmecqcA8EWukwmQjbM,17920
|
|
62
|
+
fmu_manipulation_toolbox/resources/win32/server_sm.exe,sha256=cOk25w7HmJrQptetQvWTSFSODfCz0aVVniD_hNZwtYg,15360
|
|
63
|
+
fmu_manipulation_toolbox/resources/win64/client_sm.dll,sha256=XUhJMOUGiF1Gzedf7sQu5UtucfQ7Hoy9N0lrsVbBNgQ,21504
|
|
64
|
+
fmu_manipulation_toolbox/resources/win64/container.dll,sha256=FXoB8zGRc3qm7ydGaGq1ow-2-usbzDJQeGTJfCunLyI,98816
|
|
65
|
+
fmu_manipulation_toolbox/resources/win64/server_sm.exe,sha256=xuTcp83QJ-0pctU8Q3D9YGhQCAkPCBgc_nHA3w42onw,18432
|
|
66
|
+
fmu_manipulation_toolbox-1.9.1.dist-info/licenses/LICENSE.txt,sha256=c_862mzyk6ownO3Gt6cVs0-53IXLi_-ZEQFNDVabESw,1285
|
|
67
|
+
fmu_manipulation_toolbox-1.9.1.dist-info/METADATA,sha256=t2dJhOk02gbTS2bcZp8mX0DdwpYiHOvdkb8V3Bt5fbA,1155
|
|
68
|
+
fmu_manipulation_toolbox-1.9.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
69
|
+
fmu_manipulation_toolbox-1.9.1.dist-info/entry_points.txt,sha256=HjOZkflbI1IuSY8BpOZre20m24M4GDQGCJfPIa7NrlY,264
|
|
70
|
+
fmu_manipulation_toolbox-1.9.1.dist-info/top_level.txt,sha256=9D_h-5BMjSqf9z-XFkbJL_bMppR2XNYW3WNuPkXou0k,25
|
|
71
|
+
fmu_manipulation_toolbox-1.9.1.dist-info/RECORD,,
|
{fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fmu_manipulation_toolbox-1.9rc9.dist-info → fmu_manipulation_toolbox-1.9.1.dist-info}/top_level.txt
RENAMED
|
File without changes
|