fmu-manipulation-toolbox 1.9rc6__tar.gz → 1.9rc7__tar.gz
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-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/PKG-INFO +1 -1
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/README.md +49 -20
- fmu_manipulation_toolbox-1.9rc7/fmu_manipulation_toolbox/__version__.py +1 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/cli/fmutool.py +10 -1
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/container.py +19 -16
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/remoting.py +4 -2
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/darwin64/container.dylib +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/linux32/client_sm.so +0 -0
- fmu_manipulation_toolbox-1.9rc7/fmu_manipulation_toolbox/resources/linux32/server_sm +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/linux64/client_sm.so +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/linux64/container.so +0 -0
- fmu_manipulation_toolbox-1.9rc7/fmu_manipulation_toolbox/resources/linux64/server_sm +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/win32/client_sm.dll +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/win32/server_sm.exe +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/win64/client_sm.dll +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/win64/container.dll +0 -0
- fmu_manipulation_toolbox-1.9rc7/fmu_manipulation_toolbox/resources/win64/server_sm.exe +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox.egg-info/PKG-INFO +1 -1
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/tests/test_suite.py +50 -4
- fmu_manipulation_toolbox-1.9rc6/fmu_manipulation_toolbox/__version__.py +0 -1
- fmu_manipulation_toolbox-1.9rc6/fmu_manipulation_toolbox/resources/linux32/server_sm +0 -0
- fmu_manipulation_toolbox-1.9rc6/fmu_manipulation_toolbox/resources/linux64/server_sm +0 -0
- fmu_manipulation_toolbox-1.9rc6/fmu_manipulation_toolbox/resources/win64/server_sm.exe +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/LICENSE.txt +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/__init__.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/__main__.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/assembly.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/checker.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/cli/__init__.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/cli/fmucontainer.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/cli/fmusplit.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/cli/utils.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/gui.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/gui_style.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/help.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/operations.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/checkbox-checked-disabled.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/checkbox-checked-hover.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/checkbox-checked.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/checkbox-unchecked-disabled.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/checkbox-unchecked-hover.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/checkbox-unchecked.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/container.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/drop_fmu.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-2.0/fmi2Annotation.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-2.0/fmi2AttributeGroups.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-2.0/fmi2ModelDescription.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-2.0/fmi2ScalarVariable.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-2.0/fmi2Type.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-2.0/fmi2Unit.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-2.0/fmi2VariableDependency.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Annotation.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3AttributeGroups.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3BuildDescription.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3InterfaceType.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3LayeredStandardManifest.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3ModelDescription.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Terminal.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3TerminalsAndIcons.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Type.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Unit.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3Variable.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmi-3.0/fmi3VariableDependency.xsd +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmu.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/fmu_manipulation_toolbox.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/help.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/icon-round.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/icon.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/icon_fmu.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/license.txt +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/mask.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/resources/model.png +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/split.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/version.py +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox.egg-info/SOURCES.txt +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox.egg-info/dependency_links.txt +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox.egg-info/entry_points.txt +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox.egg-info/requires.txt +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox.egg-info/top_level.txt +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/setup.cfg +0 -0
- {fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmu_manipulation_toolbox
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9rc7
|
|
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
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
|
-
FMU Manipulation Toolbox is a python package which help to analyse
|
|
4
|
-
without recompilation. It is highly customizable
|
|
3
|
+
FMU Manipulation Toolbox is a python package which help to analyse, modify or combine
|
|
4
|
+
[Functional Mock-up Units (FMUs)](http://fmi-standard.org/) without recompilation. It is highly customizable as it comes with
|
|
5
|
+
a Python API.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
FMU Manipulation Toolbox can be used in different ways :
|
|
8
|
+
- Using a Graphical User Interface: suitable for end user
|
|
9
|
+
- Using a Command Line Interface: useful in
|
|
10
|
+
- Using a python API: the most efficient for automation (CI/CD, transformation scripts, ...)
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
Major features:
|
|
13
|
+
- Analyse FMU content: list ports and their attributes, check compliance of `ModelDescription.xml` with XSD, ...
|
|
14
|
+
- Alter FMU by modifying its `modelDescription.xml` file. NOTE: manipulating this file can be a dangerous
|
|
15
|
+
thing! Communicating with the FMU-developer and adapting the way the FMU is generated is preferable when
|
|
16
|
+
possible.
|
|
17
|
+
- Add binary interface. Typical use case is porting a 32bits FMUs to 64bits (or vice et versa).
|
|
18
|
+
- Nest FMUs in a [FMU Container](doc/container.md)
|
|
19
|
+
|
|
20
|
+
FMI versions 2.0 and 3.0 are supported.
|
|
10
21
|
|
|
11
22
|
## Installation
|
|
12
23
|
|
|
@@ -17,29 +28,39 @@ Two options available to install FMU Manipulation Toolbox:
|
|
|
17
28
|
- Compile and install from [github repository](https://github.com/grouperenault/fmu_manipulation_toolbox). You will need
|
|
18
29
|
- Python required packages. See [`requirements.txt`](requirements.txt).
|
|
19
30
|
- C compiler (C99 or later)
|
|
20
|
-
- CMake (>= 3.
|
|
31
|
+
- CMake (>= 3.20)
|
|
32
|
+
|
|
21
33
|
|
|
22
34
|
### Supported platforms
|
|
23
|
-
|
|
24
|
-
|
|
35
|
+
|
|
36
|
+
FMU Manipulation Toolbox is packaged for:
|
|
37
|
+
- Windows 10/11 (primary platform)
|
|
25
38
|
- Linux (Ubuntu 22.04)
|
|
39
|
+
- Darwin
|
|
26
40
|
|
|
27
|
-
Compilation is reported to work on:
|
|
28
|
-
- MacOS (Apple Silicon and Intel)
|
|
29
41
|
|
|
30
42
|
## Graphical User Interface
|
|
31
43
|
|
|
32
|
-
FMU Manipulation Toolbox is released with a GUI. You can launch it with the following command `fmutool`
|
|
33
|
-
(without any option)
|
|
44
|
+
FMU Manipulation Toolbox is released with a GUI. You can launch it with the following command `fmutool-gui`
|
|
34
45
|
|
|
35
46
|

|
|
36
47
|
|
|
48
|
+
Button colors descriptions:
|
|
49
|
+
- red: remove information from the `modelDescription.xml`
|
|
50
|
+
- orange: alter `modelDescription.xml`
|
|
51
|
+
- green: add component into the FMU or check it
|
|
52
|
+
- violet: extract and save
|
|
53
|
+
- blue: filter actions scope or exit
|
|
54
|
+
|
|
55
|
+
**Original FMU is never modified**. Use `Save` button to get modified copy of the original FMU.
|
|
56
|
+
|
|
37
57
|
|
|
38
58
|
## Command Line Interface
|
|
39
59
|
|
|
40
60
|
FMU Manipulation Toolbox comes with 2 commands:
|
|
41
61
|
- `fmutool`: a versatile analysis and manipulation tool for FMU.
|
|
42
|
-
- `fmucontainer`: group
|
|
62
|
+
- `fmucontainer`: group FMUs inside FMU Containers. (see [container/README.md](container/README.md))
|
|
63
|
+
- `fmusplit: to extract FMUs from a FMU Container.
|
|
43
64
|
|
|
44
65
|
|
|
45
66
|
### Analysis and Manipulation tool:
|
|
@@ -163,14 +184,13 @@ You can write your own FMU Manipulation scripts. Once you downloaded fmutool mod
|
|
|
163
184
|
adding the `import` statement lets you access the API :
|
|
164
185
|
|
|
165
186
|
```python
|
|
166
|
-
from fmu_manipulation_toolbox.operations import
|
|
167
|
-
|
|
168
|
-
OperationRenameFromCSV
|
|
187
|
+
from fmu_manipulation_toolbox.operations import ...
|
|
169
188
|
```
|
|
170
189
|
|
|
190
|
+
|
|
171
191
|
### remove toplevel bus (if any)
|
|
172
192
|
|
|
173
|
-
|
|
193
|
+
Given a FMU with the following I/O structure
|
|
174
194
|
```
|
|
175
195
|
├── Parameters
|
|
176
196
|
│ ├── Foo
|
|
@@ -194,6 +214,8 @@ The following transformation will lead into:
|
|
|
194
214
|
|
|
195
215
|
The following code will do this transformation:
|
|
196
216
|
```python
|
|
217
|
+
from fmu_manipulation_toolbox.operations import FMU, OperationStripTopLevel
|
|
218
|
+
|
|
197
219
|
fmu = FMU(r"bouncing_ball.fmu")
|
|
198
220
|
operation = OperationStripTopLevel()
|
|
199
221
|
fmu.apply_operation(operation)
|
|
@@ -205,8 +227,10 @@ fmu.repack(r"bouncing_ball-modified.fmu")
|
|
|
205
227
|
The following code will dump all FMU's Scalars names into a CSV:
|
|
206
228
|
|
|
207
229
|
```python
|
|
230
|
+
from fmu_manipulation_toolbox.operations import FMU, OperationSaveNamesToCSV
|
|
231
|
+
|
|
208
232
|
fmu = FMU(r"bouncing_ball.fmu")
|
|
209
|
-
operation =
|
|
233
|
+
operation = OperationSaveNamesToCSV()
|
|
210
234
|
fmu.apply_operation(operation)
|
|
211
235
|
operation.write_csv(r"bouncing_ball.csv")
|
|
212
236
|
```
|
|
@@ -224,15 +248,20 @@ g;g;4;parameter;fixed
|
|
|
224
248
|
e;e;5;parameter;tunable
|
|
225
249
|
```
|
|
226
250
|
|
|
251
|
+
|
|
227
252
|
### Read CSV and rename FMU ports
|
|
228
253
|
|
|
229
|
-
CSV file should contain
|
|
254
|
+
CSV file should contain 2 columns:
|
|
230
255
|
1. the current name
|
|
231
256
|
2. the new name
|
|
232
257
|
|
|
233
258
|
```python
|
|
259
|
+
from fmu_manipulation_toolbox.operations import FMU, OperationRenameFromCSV
|
|
260
|
+
|
|
234
261
|
fmu = FMU(r"bouncing_ball.fmu")
|
|
235
262
|
operation = OperationRenameFromCSV(r"bouncing_ball-modified.csv")
|
|
236
263
|
fmu.apply_operation(operation)
|
|
237
264
|
fmu.repack(r"bouncing_ball-renamed.fmu")
|
|
238
265
|
```
|
|
266
|
+
|
|
267
|
+
More operations exist in [`Operation.py`](fmu_manipulation_toolbox/operations.py)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'V1.9-rc7'
|
|
@@ -89,7 +89,16 @@ def fmutool():
|
|
|
89
89
|
for causality in cli_options.apply_on:
|
|
90
90
|
logger.info(f" - causality = {causality}")
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
# Checker operations are added as a list into operations_list
|
|
93
|
+
def operation_iterator():
|
|
94
|
+
for op in cli_options.operations_list:
|
|
95
|
+
if isinstance(op, list):
|
|
96
|
+
for sub_op in op:
|
|
97
|
+
yield sub_op
|
|
98
|
+
else:
|
|
99
|
+
yield op
|
|
100
|
+
|
|
101
|
+
for operation in operation_iterator():
|
|
93
102
|
logger.info(f" => {operation}")
|
|
94
103
|
try:
|
|
95
104
|
fmu.apply_operation(operation, cli_options.apply_on)
|
|
@@ -796,23 +796,26 @@ class FMUContainer:
|
|
|
796
796
|
def make_fmu_xml_epilog_2(self, xml_file, index_offset):
|
|
797
797
|
xml_file.write(" </ModelVariables>\n"
|
|
798
798
|
"\n"
|
|
799
|
-
" <ModelStructure>\n"
|
|
800
|
-
" <Outputs>\n")
|
|
799
|
+
" <ModelStructure>\n")
|
|
801
800
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
801
|
+
|
|
802
|
+
if self.outputs:
|
|
803
|
+
xml_file.write(" <Outputs>\n")
|
|
804
|
+
index = index_offset
|
|
805
|
+
for output in self.outputs.values():
|
|
806
|
+
if output.port.type_name in EmbeddedFMUPort.CONTAINER_TO_FMI[2]:
|
|
807
|
+
print(f' <Unknown index="{index}"/>', file=xml_file)
|
|
808
|
+
index += 1
|
|
809
|
+
xml_file.write(" </Outputs>\n"
|
|
810
|
+
" <InitialUnknowns>\n")
|
|
811
|
+
index = index_offset
|
|
812
|
+
for output in self.outputs.values():
|
|
813
|
+
if output.port.type_name in EmbeddedFMUPort.CONTAINER_TO_FMI[2]:
|
|
814
|
+
print(f' <Unknown index="{index}"/>', file=xml_file)
|
|
815
|
+
index += 1
|
|
816
|
+
xml_file.write(" </InitialUnknowns>\n")
|
|
817
|
+
|
|
818
|
+
xml_file.write(" </ModelStructure>\n"
|
|
816
819
|
"\n"
|
|
817
820
|
"</fmiModelDescription>")
|
|
818
821
|
|
|
@@ -60,9 +60,11 @@ class OperationAddRemotingWinAbstract(OperationAbstract):
|
|
|
60
60
|
fmu_bin[self.bitness_to] / "license.txt")
|
|
61
61
|
|
|
62
62
|
def port_attrs(self, fmu_port) -> int:
|
|
63
|
+
vr = int(fmu_port["valueReference"])
|
|
64
|
+
causality = fmu_port.get("causality", "local")
|
|
63
65
|
try:
|
|
64
|
-
self.vr[fmu_port.fmi_type].append(
|
|
65
|
-
if
|
|
66
|
+
self.vr[fmu_port.fmi_type].append(vr)
|
|
67
|
+
if causality in ("input", "parameter"):
|
|
66
68
|
self.nb_input += 1
|
|
67
69
|
else:
|
|
68
70
|
self.nb_output += 1
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmu_manipulation_toolbox
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9rc7
|
|
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
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import unittest
|
|
2
2
|
import sys
|
|
3
3
|
from pathlib import Path
|
|
4
|
+
from fmpy.simulation import simulate_fmu
|
|
5
|
+
import numpy as np
|
|
4
6
|
|
|
5
7
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
6
8
|
from fmu_manipulation_toolbox.operations import *
|
|
@@ -14,11 +16,25 @@ class FMUManipulationToolboxTestSuite(unittest.TestCase):
|
|
|
14
16
|
super().__init__(*args, **kwargs)
|
|
15
17
|
self.fmu_filename = "operations/bouncing_ball.fmu"
|
|
16
18
|
|
|
19
|
+
def assert_simulation(self, filename: Union[Path, str], step_size: Optional[float] = None):
|
|
20
|
+
if isinstance(filename, str):
|
|
21
|
+
filename = Path(filename)
|
|
22
|
+
result_filename = filename.with_name("results-" + filename.with_suffix(".csv").name)
|
|
23
|
+
ref_filename = result_filename.with_stem("REF-" + result_filename.stem)
|
|
24
|
+
|
|
25
|
+
result = simulate_fmu(filename, step_size=step_size, stop_time=10, relative_tolerance=1e-9,
|
|
26
|
+
output_interval=step_size, validate=True)
|
|
27
|
+
|
|
28
|
+
np.savetxt(result_filename, result, delimiter=',', fmt="%.5e")
|
|
29
|
+
|
|
30
|
+
self.assert_identical_files(result_filename, ref_filename)
|
|
31
|
+
|
|
17
32
|
def assert_identical_files(self, filename1, filename2):
|
|
18
33
|
with open(filename1, mode="rt", newline=None) as a, open(filename2, mode="rt", newline=None) as b:
|
|
19
34
|
self.assertTrue(all(lineA == lineB for lineA, lineB in zip(a, b)))
|
|
20
35
|
|
|
21
|
-
|
|
36
|
+
@staticmethod
|
|
37
|
+
def assert_identical_files_but_guid(filename1, filename2):
|
|
22
38
|
with open(filename1, mode="rt", newline=None) as a, open(filename2, mode="rt", newline=None) as b:
|
|
23
39
|
for lineA, lineB in zip(a, b):
|
|
24
40
|
if not "guid" in lineA and not lineA == lineB:
|
|
@@ -51,10 +67,12 @@ class FMUManipulationToolboxTestSuite(unittest.TestCase):
|
|
|
51
67
|
|
|
52
68
|
@unittest.skipUnless(sys.platform.startswith("win"), "Supported only on Windows")
|
|
53
69
|
def test_add_remoting_win32(self):
|
|
54
|
-
fmu = FMU(
|
|
55
|
-
operation =
|
|
70
|
+
fmu = FMU("remoting/bouncing_ball-win32.fmu")
|
|
71
|
+
operation = OperationAddRemotingWin64()
|
|
56
72
|
fmu.apply_operation(operation)
|
|
57
|
-
fmu.repack("
|
|
73
|
+
fmu.repack("remoting/bouncing_ball-win64.fmu")
|
|
74
|
+
self.assert_simulation("remoting/bouncing_ball-win32.fmu")
|
|
75
|
+
self.assert_simulation("remoting/bouncing_ball-win64.fmu")
|
|
58
76
|
|
|
59
77
|
def test_remove_regexp(self):
|
|
60
78
|
self.assert_operation_match_ref("operations/bouncing_ball-removed.fmu",
|
|
@@ -72,6 +90,8 @@ class FMUManipulationToolboxTestSuite(unittest.TestCase):
|
|
|
72
90
|
"containers/bouncing_ball/bouncing/resources/container.txt")
|
|
73
91
|
self.assert_identical_files("containers/bouncing_ball/REF-bouncing.json",
|
|
74
92
|
"containers/bouncing_ball/bouncing.json")
|
|
93
|
+
if os.name == 'nt':
|
|
94
|
+
self.assert_simulation("containers/bouncing_ball/bouncing.fmu")
|
|
75
95
|
|
|
76
96
|
def test_container_bouncing_ball_seq(self):
|
|
77
97
|
assembly = Assembly("bouncing-seq.csv", fmu_directory=Path("containers/bouncing_ball"), mt=True, debug=True,
|
|
@@ -82,6 +102,8 @@ class FMUManipulationToolboxTestSuite(unittest.TestCase):
|
|
|
82
102
|
"containers/bouncing_ball/bouncing-seq/resources/container.txt")
|
|
83
103
|
self.assert_identical_files("containers/bouncing_ball/REF-bouncing-seq.json",
|
|
84
104
|
"containers/bouncing_ball/bouncing-seq.json")
|
|
105
|
+
if os.name == 'nt':
|
|
106
|
+
self.assert_simulation("containers/bouncing_ball/bouncing-seq.fmu")
|
|
85
107
|
|
|
86
108
|
def test_container_bouncing_ball_profiling(self):
|
|
87
109
|
assembly = Assembly("bouncing-profiling.csv", fmu_directory=Path("containers/bouncing_ball"), profiling=True,
|
|
@@ -94,6 +116,8 @@ class FMUManipulationToolboxTestSuite(unittest.TestCase):
|
|
|
94
116
|
"containers/bouncing_ball/bouncing-profiling.json")
|
|
95
117
|
self.assert_identical_files_but_guid("containers/bouncing_ball/REF-modelDescription-profiling.xml",
|
|
96
118
|
"containers/bouncing_ball/bouncing-profiling/modelDescription.xml")
|
|
119
|
+
if os.name == 'nt':
|
|
120
|
+
self.assert_simulation("containers/bouncing_ball/bouncing-profiling.fmu")
|
|
97
121
|
|
|
98
122
|
def test_container_bouncing_ball_profiling_3(self):
|
|
99
123
|
assembly = Assembly("bouncing-3.csv", fmu_directory=Path("containers/bouncing_ball"), profiling=True,
|
|
@@ -103,18 +127,24 @@ class FMUManipulationToolboxTestSuite(unittest.TestCase):
|
|
|
103
127
|
"containers/bouncing_ball/bouncing-3/resources/container.txt")
|
|
104
128
|
self.assert_identical_files_but_guid("containers/bouncing_ball/REF-modelDescription-3.xml",
|
|
105
129
|
"containers/bouncing_ball/bouncing-3/modelDescription.xml")
|
|
130
|
+
if os.name == 'nt':
|
|
131
|
+
self.assert_simulation("containers/bouncing_ball/bouncing-3.fmu")
|
|
106
132
|
|
|
107
133
|
def test_container_ssp(self):
|
|
108
134
|
assembly = Assembly("bouncing.ssp", fmu_directory=Path("containers/ssp"))
|
|
109
135
|
assembly.make_fmu(dump_json=True)
|
|
110
136
|
self.assert_identical_files("containers/ssp/REF-bouncing-dump.json",
|
|
111
137
|
"containers/ssp/bouncing-dump.json")
|
|
138
|
+
if os.name == 'nt':
|
|
139
|
+
self.assert_simulation("containers/ssp/bouncing.fmu")
|
|
112
140
|
|
|
113
141
|
def test_container_json_flat(self):
|
|
114
142
|
assembly = Assembly("flat.json", fmu_directory=Path("containers/arch"))
|
|
115
143
|
assembly.make_fmu(dump_json=True)
|
|
116
144
|
self.assert_identical_files("containers/arch/REF-flat-dump.json",
|
|
117
145
|
"containers/arch/flat-dump.json")
|
|
146
|
+
if os.name == 'nt':
|
|
147
|
+
self.assert_simulation("containers/arch/flat.fmu")
|
|
118
148
|
|
|
119
149
|
def test_container_subdir_flat(self):
|
|
120
150
|
container = FMUContainer("sub.fmu", fmu_directory=Path("containers/arch"))
|
|
@@ -123,18 +153,24 @@ class FMUManipulationToolboxTestSuite(unittest.TestCase):
|
|
|
123
153
|
container.get_fmu("sine.fmu")
|
|
124
154
|
container.add_implicit_rule()
|
|
125
155
|
container.make_fmu("sub.fmu", step_size=0.5)
|
|
156
|
+
if os.name == 'nt':
|
|
157
|
+
self.assert_simulation("containers/arch/sub.fmu")
|
|
126
158
|
|
|
127
159
|
def test_container_json_hierarchical(self):
|
|
128
160
|
assembly = Assembly("hierarchical.json", fmu_directory=Path("containers/arch"))
|
|
129
161
|
assembly.make_fmu(dump_json=True)
|
|
130
162
|
self.assert_identical_files("containers/arch/REF-hierarchical-dump.json",
|
|
131
163
|
"containers/arch/hierarchical-dump.json")
|
|
164
|
+
if os.name == 'nt':
|
|
165
|
+
self.assert_simulation("containers/arch/hierarchical.fmu")
|
|
132
166
|
|
|
133
167
|
def test_container_json_reversed(self):
|
|
134
168
|
assembly = Assembly("reversed.json", fmu_directory=Path("containers/arch"))
|
|
135
169
|
assembly.make_fmu(dump_json=True)
|
|
136
170
|
self.assert_identical_files("containers/arch/REF-reversed-dump.json",
|
|
137
171
|
"containers/arch/reversed-dump.json")
|
|
172
|
+
if os.name == 'nt':
|
|
173
|
+
self.assert_simulation("containers/arch/reversed.fmu")
|
|
138
174
|
|
|
139
175
|
def test_container_start(self):
|
|
140
176
|
assembly = Assembly("slx.json", fmu_directory=Path("containers/start"), debug=True)
|
|
@@ -143,12 +179,22 @@ class FMUManipulationToolboxTestSuite(unittest.TestCase):
|
|
|
143
179
|
"containers/start/container-slx/resources/container.txt")
|
|
144
180
|
self.assert_identical_files_but_guid("containers/start/REF-modelDescription.xml",
|
|
145
181
|
"containers/start/container-slx/modelDescription.xml")
|
|
182
|
+
if os.name == 'nt':
|
|
183
|
+
self.assert_simulation("containers/start/slx.fmu")
|
|
184
|
+
|
|
185
|
+
def test_container_vanderpol(self):
|
|
186
|
+
self.assert_simulation("containers/VanDerPol/VanDerPol.fmu", 0.1)
|
|
187
|
+
assembly = Assembly("VanDerPol.json", fmu_directory=Path("containers/VanDerPol"))
|
|
188
|
+
assembly.make_fmu()
|
|
189
|
+
self.assert_simulation("containers/VanDerPol/VanDerPol-Container.fmu", 0.1)
|
|
146
190
|
|
|
147
191
|
def test_fmi3_pt2(self):
|
|
148
192
|
assembly = Assembly("passthrough.json", fmu_directory=Path("fmi3/passthrough"), debug=True)
|
|
149
193
|
assembly.make_fmu(fmi_version=2)
|
|
150
194
|
self.assert_identical_files("fmi3/passthrough/REF-container.txt",
|
|
151
195
|
"fmi3/passthrough/container-passthrough/resources/container.txt")
|
|
196
|
+
if os.name == 'nt':
|
|
197
|
+
self.assert_simulation("fmi3/passthrough/container-passthrough.fmu")
|
|
152
198
|
|
|
153
199
|
def test_container_move(self):
|
|
154
200
|
#bb = Assembly("bouncing.csv", fmu_directory=Path("containers/bouncing_ball"))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'V1.9-rc6'
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/gui.py
RENAMED
|
File without changes
|
|
File without changes
|
{fmu_manipulation_toolbox-1.9rc6 → fmu_manipulation_toolbox-1.9rc7}/fmu_manipulation_toolbox/help.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|