fmu-manipulation-toolbox 1.8.4.3b0__py3-none-any.whl → 1.9rc1__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.
@@ -1 +1 @@
1
- 'V1.8.4.3-beta'
1
+ 'V1.9-pre1'
@@ -37,7 +37,7 @@ class Connection:
37
37
 
38
38
 
39
39
  class AssemblyNode:
40
- def __init__(self, name: Optional[str], step_size: float = None, mt=False, profiling=False,
40
+ def __init__(self, name: Optional[str], step_size: float = None, mt=False, profiling=False, sequential=False,
41
41
  auto_link=True, auto_input=True, auto_output=True, auto_parameter=False, auto_local=False):
42
42
  self.name = name
43
43
  if step_size:
@@ -50,6 +50,7 @@ class AssemblyNode:
50
50
  self.step_size = None
51
51
  self.mt = mt
52
52
  self.profiling = profiling
53
+ self.sequential = sequential
53
54
  self.auto_link = auto_link
54
55
  self.auto_input = auto_input
55
56
  self.auto_output = auto_output
@@ -100,12 +101,13 @@ class AssemblyNode:
100
101
  def add_start_value(self, fmu_filename: str, port_name: str, value: str):
101
102
  self.start_values[Port(fmu_filename, port_name)] = value
102
103
 
103
- def make_fmu(self, fmu_directory: Path, debug=False, description_pathname=None):
104
+ def make_fmu(self, fmu_directory: Path, debug=False, description_pathname=None, fmi_version=2):
104
105
  for node in self.children.values():
105
106
  node.make_fmu(fmu_directory, debug=debug)
106
107
 
107
108
  identifier = str(Path(self.name).stem)
108
- container = FMUContainer(identifier, fmu_directory, description_pathname=description_pathname)
109
+ container = FMUContainer(identifier, fmu_directory, description_pathname=description_pathname,
110
+ fmi_version=fmi_version)
109
111
 
110
112
  for fmu_name in self.fmu_names_list:
111
113
  container.get_fmu(fmu_name)
@@ -138,7 +140,8 @@ class AssemblyNode:
138
140
  for link_rule in wired.rule_link:
139
141
  self.add_link(link_rule[0], link_rule[1], link_rule[2], link_rule[3])
140
142
 
141
- container.make_fmu(self.name, self.step_size, mt=self.mt, profiling=self.profiling, debug=debug)
143
+ container.make_fmu(self.name, self.step_size, mt=self.mt, profiling=self.profiling, sequential=self.sequential,
144
+ debug=debug)
142
145
 
143
146
  for node in self.children.values():
144
147
  logger.info(f"Deleting transient FMU Container '{node.name}'")
@@ -216,7 +219,7 @@ class AssemblyError(Exception):
216
219
 
217
220
 
218
221
  class Assembly:
219
- def __init__(self, filename: str, step_size=None, auto_link=True, auto_input=True, debug=False,
222
+ def __init__(self, filename: str, step_size=None, auto_link=True, auto_input=True, debug=False, sequential=False,
220
223
  auto_output=True, mt=False, profiling=False, fmu_directory: Path = Path("."), auto_parameter=False,
221
224
  auto_local=False):
222
225
  self.filename = Path(filename)
@@ -228,6 +231,7 @@ class Assembly:
228
231
  self.default_auto_parameter = auto_parameter
229
232
  self.default_auto_local = auto_local
230
233
  self.default_mt = mt
234
+ self.default_sequential = sequential
231
235
  self.default_profiling = profiling
232
236
  self.fmu_directory = fmu_directory
233
237
  self.transient_filenames: List[Path] = []
@@ -238,7 +242,7 @@ class Assembly:
238
242
 
239
243
  self.input_pathname = fmu_directory / self.filename
240
244
  self.description_pathname = self.input_pathname # For inclusion in FMU
241
- self.root = None
245
+ self.root: Optional[AssemblyNode] = None
242
246
  self.read()
243
247
 
244
248
  def add_transient_file(self, filename: str):
@@ -283,8 +287,9 @@ class Assembly:
283
287
  name = str(self.filename.with_suffix(".fmu"))
284
288
  self.root = AssemblyNode(name, step_size=self.default_step_size, auto_link=self.default_auto_link,
285
289
  mt=self.default_mt, profiling=self.default_profiling,
286
- auto_input=self.default_auto_input, auto_output=self.default_auto_output,
287
- auto_parameter=self.default_auto_parameter, auto_local=self.default_auto_local)
290
+ sequential=self.default_sequential, auto_input=self.default_auto_input,
291
+ auto_output=self.default_auto_output, auto_parameter=self.default_auto_parameter,
292
+ auto_local=self.default_auto_local)
288
293
 
289
294
  with open(self.input_pathname) as file:
290
295
  reader = csv.reader(file, delimiter=';')
@@ -385,6 +390,7 @@ class Assembly:
385
390
  name = data.get("name", None) # 1
386
391
  mt = data.get("mt", self.default_mt) # 2
387
392
  profiling = data.get("profiling", self.default_profiling) # 3
393
+ sequential = data.get("sequential", self.default_sequential) # 3b
388
394
  auto_link = data.get("auto_link", self.default_auto_link) # 4
389
395
  auto_input = data.get("auto_input", self.default_auto_input) # 5
390
396
  auto_output = data.get("auto_output", self.default_auto_output) # 6
@@ -393,11 +399,12 @@ class Assembly:
393
399
  step_size = data.get("step_size", self.default_step_size) # 7
394
400
 
395
401
  node = AssemblyNode(name, step_size=step_size, auto_link=auto_link, mt=mt, profiling=profiling,
402
+ sequential=sequential,
396
403
  auto_input=auto_input, auto_output=auto_output, auto_parameter=auto_parameter,
397
404
  auto_local=auto_local)
398
405
 
399
406
  for key, value in data.items():
400
- if key in ('name', 'step_size', 'auto_link', 'auto_input', 'auto_output', 'mt', 'profiling',
407
+ if key in ('name', 'step_size', 'auto_link', 'auto_input', 'auto_output', 'mt', 'profiling', 'sequential',
401
408
  'auto_parameter', 'auto_local'):
402
409
  continue # Already read
403
410
 
@@ -455,6 +462,7 @@ class Assembly:
455
462
  json_node["name"] = node.name # 1
456
463
  json_node["mt"] = node.mt # 2
457
464
  json_node["profiling"] = node.profiling # 3
465
+ json_node["sequential"] = node.sequential # 3b
458
466
  json_node["auto_link"] = node.auto_link # 4
459
467
  json_node["auto_input"] = node.auto_input # 5
460
468
  json_node["auto_output"] = node.auto_output # 6
@@ -510,8 +518,9 @@ class Assembly:
510
518
  self.root = sdd.parse(self.description_pathname)
511
519
  self.root.name = str(self.filename.with_suffix(".fmu"))
512
520
 
513
- def make_fmu(self, dump_json=False):
514
- self.root.make_fmu(self.fmu_directory, debug=self.debug, description_pathname=self.description_pathname)
521
+ def make_fmu(self, dump_json=False, fmi_version=2):
522
+ self.root.make_fmu(self.fmu_directory, debug=self.debug, description_pathname=self.description_pathname,
523
+ fmi_version=fmi_version)
515
524
  if dump_json:
516
525
  dump_file = Path(self.input_pathname.stem + "-dump").with_suffix(".json")
517
526
  logger.info(f"Dump Json '{dump_file}'")