pythonfmu3 0.1.16__tar.gz → 0.1.17__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.
Files changed (64) hide show
  1. {pythonfmu3-0.1.16/pythonfmu3.egg-info → pythonfmu3-0.1.17}/PKG-INFO +4 -2
  2. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/README.md +3 -1
  3. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/__init__.py +2 -2
  4. pythonfmu3-0.1.17/pythonfmu3/_version.py +1 -0
  5. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/builder.py +23 -0
  6. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/fmi3slave.py +7 -2
  7. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/build_unix.sh +0 -0
  8. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.hpp +4 -1
  9. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/cppfmu/fmi_functions.cpp +15 -13
  10. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp +32 -6
  11. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.hpp +7 -1
  12. pythonfmu3-0.1.17/pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
  13. pythonfmu3-0.1.17/pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
  14. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/test_builder.py +20 -0
  15. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17/pythonfmu3.egg-info}/PKG-INFO +4 -2
  16. pythonfmu3-0.1.16/pythonfmu3/_version.py +0 -1
  17. pythonfmu3-0.1.16/pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
  18. pythonfmu3-0.1.16/pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
  19. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/LICENSE +0 -0
  20. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/MANIFEST.in +0 -0
  21. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/__main__.py +0 -0
  22. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/default_experiment.py +0 -0
  23. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/deploy.py +0 -0
  24. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/enums.py +0 -0
  25. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/logmsg.py +0 -0
  26. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/osutil.py +0 -0
  27. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/.clang-format +0 -0
  28. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/CMakeLists.txt +0 -0
  29. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/build_win.sh +0 -0
  30. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/CMakeLists.txt +0 -0
  31. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_common.hpp +0 -0
  32. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.cpp +0 -0
  33. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/fmi/fmi3FunctionTypes.h +0 -0
  34. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/fmi/fmi3Functions.h +0 -0
  35. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/fmi/fmi3PlatformTypes.h +0 -0
  36. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/pythonfmu/IPyState.hpp +0 -0
  37. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/pythonfmu-export/src/pythonfmu/PyState.hpp +0 -0
  38. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/__init__.py +0 -0
  39. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/conftest.py +0 -0
  40. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/data/csvdemo.csv +0 -0
  41. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/data/hello.txt +0 -0
  42. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/slaves/PythonSlaveWithException.py +0 -0
  43. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/slaves/localmodule.py +0 -0
  44. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/slaves/pythonslave.py +0 -0
  45. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/slaves/pythonslave_read_file.py +0 -0
  46. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/slaves/slavewithdep.py +0 -0
  47. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/test_deploy.py +0 -0
  48. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/test_fmi3slave.py +0 -0
  49. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/test_integration.py +0 -0
  50. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/test_logger.py +0 -0
  51. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/test_multiple_fmus.py +0 -0
  52. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/test_variables.py +0 -0
  53. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/tests/utils.py +0 -0
  54. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/unit.py +0 -0
  55. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/variable_types.py +0 -0
  56. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3/variables.py +0 -0
  57. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3.egg-info/SOURCES.txt +0 -0
  58. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3.egg-info/dependency_links.txt +0 -0
  59. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3.egg-info/entry_points.txt +0 -0
  60. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3.egg-info/not-zip-safe +0 -0
  61. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3.egg-info/requires.txt +0 -0
  62. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/pythonfmu3.egg-info/top_level.txt +0 -0
  63. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/setup.cfg +0 -0
  64. {pythonfmu3-0.1.16 → pythonfmu3-0.1.17}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pythonfmu3
3
- Version: 0.1.16
3
+ Version: 0.1.17
4
4
  Summary: A lightweight framework that enables the packaging of Python3.x code as co-simulation FMUs.
5
5
  Home-page: https://github.com/stephensmith25/PythonFMU3
6
6
  Author: Stephen Smith
@@ -62,7 +62,7 @@ pip install pythonfmu3
62
62
  3. Run `pythonfmu3 build` to create the fmu.
63
63
 
64
64
  ```
65
- usage: pythonfmu3 build [-h] -f SCRIPT_FILE [-d DEST] [--doc DOCUMENTATION_FOLDER] [--no-external-tool]
65
+ usage: pythonfmu3 build [-h] -f SCRIPT_FILE [-d DEST] [--doc DOCUMENTATION_FOLDER] [--terminals TERMINALS_FOLDER] [--no-external-tool]
66
66
  [--no-variable-step] [--interpolate-inputs] [--only-one-per-process] [--handle-state]
67
67
  [--serialize-state] [--use-memory-management]
68
68
  [Project files [Project files ...]]
@@ -79,6 +79,8 @@ optional arguments:
79
79
  -d DEST, --dest DEST Where to save the FMU.
80
80
  --doc DOCUMENTATION_FOLDER
81
81
  Documentation folder to include in the FMU.
82
+ --terminals TERMINALS_FOLDER
83
+ Folder of terminals to include in the FMU.
82
84
  --no-external-tool If given, needsExecutionTool=false
83
85
  --no-variable-step If given, canHandleVariableCommunicationStepSize=false
84
86
  --interpolate-inputs If given, canInterpolateInputs=true
@@ -36,7 +36,7 @@ pip install pythonfmu3
36
36
  3. Run `pythonfmu3 build` to create the fmu.
37
37
 
38
38
  ```
39
- usage: pythonfmu3 build [-h] -f SCRIPT_FILE [-d DEST] [--doc DOCUMENTATION_FOLDER] [--no-external-tool]
39
+ usage: pythonfmu3 build [-h] -f SCRIPT_FILE [-d DEST] [--doc DOCUMENTATION_FOLDER] [--terminals TERMINALS_FOLDER] [--no-external-tool]
40
40
  [--no-variable-step] [--interpolate-inputs] [--only-one-per-process] [--handle-state]
41
41
  [--serialize-state] [--use-memory-management]
42
42
  [Project files [Project files ...]]
@@ -53,6 +53,8 @@ optional arguments:
53
53
  -d DEST, --dest DEST Where to save the FMU.
54
54
  --doc DOCUMENTATION_FOLDER
55
55
  Documentation folder to include in the FMU.
56
+ --terminals TERMINALS_FOLDER
57
+ Folder of terminals to include in the FMU.
56
58
  --no-external-tool If given, needsExecutionTool=false
57
59
  --no-variable-step If given, canHandleVariableCommunicationStepSize=false
58
60
  --interpolate-inputs If given, canInterpolateInputs=true
@@ -1,7 +1,7 @@
1
1
  from ._version import __version__
2
2
  from .builder import FmuBuilder
3
- from .enums import Fmi3Causality, Fmi3Initial, Fmi3Variability
4
- from .fmi3slave import Fmi3Slave
3
+ from .enums import Fmi3Causality, Fmi3Initial, Fmi3Status, Fmi3Variability
4
+ from .fmi3slave import Fmi3Slave, Fmi3StepResult
5
5
  from .variables import Boolean, Enumeration, Int32, Int64, UInt64, Float64, String, Dimension
6
6
  from .default_experiment import DefaultExperiment
7
7
  from .variable_types import Float64Type, EnumerationType
@@ -0,0 +1 @@
1
+ __version__ = "0.1.17"
@@ -66,6 +66,7 @@ class FmuBuilder:
66
66
  dest: FilePath = ".",
67
67
  project_files: Iterable[FilePath] = set(),
68
68
  documentation_folder: Optional[FilePath] = None,
69
+ terminals_folder: Optional[FilePath] = None,
69
70
  **options,
70
71
  ) -> Path:
71
72
  script_file = Path(script_file)
@@ -85,6 +86,13 @@ class FmuBuilder:
85
86
  raise ValueError(
86
87
  f"The documentation folder does not exists {documentation_folder!s}"
87
88
  )
89
+
90
+ if terminals_folder is not None:
91
+ terminals_folder = Path(terminals_folder)
92
+ if not terminals_folder.exists():
93
+ raise ValueError(
94
+ f"The terminals folder does not exists {terminals_folder!s}"
95
+ )
88
96
 
89
97
  module_name = script_file.stem
90
98
 
@@ -178,6 +186,14 @@ class FmuBuilder:
178
186
  relative_f = f.relative_to(documentation_folder)
179
187
  zip_fmu.write(f, arcname=(documentation / relative_f))
180
188
 
189
+ if terminals_folder is not None:
190
+ terminals = Path("terminalsAndIcons")
191
+ for f in terminals_folder.rglob("*.xml"):
192
+ if f.is_file():
193
+ relative_f = f.relative_to(terminals_folder)
194
+ zip_fmu.write(f, arcname=(terminals / relative_f))
195
+
196
+
181
197
  # Add the model description
182
198
  xml_str = parseString(tostring(xml, "UTF-8"))
183
199
  zip_fmu.writestr(
@@ -215,6 +231,13 @@ def create_command_parser(parser: argparse.ArgumentParser):
215
231
  default=None
216
232
  )
217
233
 
234
+ parser.add_argument(
235
+ "--terminals",
236
+ dest="terminals_folder",
237
+ help="Folder containing terminals to include in the FMU.",
238
+ default=None
239
+ )
240
+
218
241
  for option in FMI3_MODEL_OPTIONS:
219
242
  action = "store_false" if option.value else "store_true"
220
243
  parser.add_argument(
@@ -5,7 +5,7 @@ import datetime
5
5
  from abc import ABC, abstractmethod
6
6
  from collections import OrderedDict, namedtuple
7
7
  from pathlib import Path
8
- from typing import Any, ClassVar, Dict, List, Optional
8
+ from typing import Any, ClassVar, Dict, List, NamedTuple, Optional
9
9
  from uuid import uuid1
10
10
  from xml.etree.ElementTree import Element, SubElement
11
11
 
@@ -27,6 +27,11 @@ FMI3_MODEL_OPTIONS: List[ModelOptions] = [
27
27
  ModelOptions("canSerializeFMUState", False, "serialize-state")
28
28
  ]
29
29
 
30
+ class Fmi3StepResult(NamedTuple):
31
+ status: Fmi3Status = Fmi3Status.ok
32
+ eventHandlingNeeded: bool = False
33
+ terminateSimulation: bool = False
34
+ earlyReturn: bool = False
30
35
 
31
36
  class Fmi3Slave(ABC):
32
37
  """Abstract facade class to execute Python through FMI standard."""
@@ -235,7 +240,7 @@ class Fmi3Slave(ABC):
235
240
  pass
236
241
 
237
242
  @abstractmethod
238
- def do_step(self, current_time: float, step_size: float) -> bool:
243
+ def do_step(self, current_time: float, step_size: float) -> Fmi3StepResult:
239
244
  pass
240
245
 
241
246
  def terminate(self):
@@ -124,10 +124,13 @@ public:
124
124
  FMIString value[]) const;
125
125
 
126
126
  // Called from fmi3DoStep()/fmiDoStep(). Must be implemented in model code.
127
- virtual bool DoStep(
127
+ virtual FMIStatus DoStep(
128
128
  FMIFloat64 currentCommunicationPoint,
129
129
  FMIFloat64 communicationStepSize,
130
130
  FMIBoolean newStep,
131
+ FMIBoolean* eventHandlingNeeded,
132
+ FMIBoolean* terminateSimulation,
133
+ FMIBoolean* earlyReturn,
131
134
  FMIFloat64& endOfStep) = 0;
132
135
 
133
136
  virtual void GetFMUstate(fmi3FMUState& state) = 0;
@@ -50,7 +50,7 @@ struct Component
50
50
  Component(cppfmu::FMIComponentEnvironment instanceEnvironment,
51
51
  cppfmu::FMICallbackLogger logCallback,
52
52
  cppfmu::FMIBoolean loggingOn) : loggerSettings{std::make_shared<cppfmu::Logger::Settings>()},
53
- logger{instanceEnvironment, logCallback, loggerSettings}, lastSuccessfulTime{std::numeric_limits<cppfmu::FMIFloat64>::quiet_NaN()}
53
+ logger{instanceEnvironment, logCallback, loggerSettings}
54
54
  {
55
55
  loggerSettings->debugLoggingEnabled = (loggingOn == cppfmu::FMITrue);
56
56
  }
@@ -62,7 +62,6 @@ struct Component
62
62
 
63
63
  // Co-simulation
64
64
  std::unique_ptr<cppfmu::SlaveInstance> slave;
65
- cppfmu::FMIFloat64 lastSuccessfulTime;
66
65
  };
67
66
  } // namespace
68
67
 
@@ -659,27 +658,30 @@ fmi3Status fmi3DoStep(
659
658
  fmi3Instance c,
660
659
  fmi3Float64 currentCommunicationPoint,
661
660
  fmi3Float64 communicationStepSize,
662
- fmi3Boolean /*noSetFMUStatePriorToCurrentPoint*/,
663
- fmi3Boolean*,
664
- fmi3Boolean*,
665
- fmi3Boolean*,
666
- fmi3Float64*)
661
+ fmi3Boolean noSetFmuStatePriorToCurrentPoint,
662
+ fmi3Boolean* eventHandlingNeeded ,
663
+ fmi3Boolean* terminateSimulation,
664
+ fmi3Boolean* earlyReturn,
665
+ fmi3Float64* lastSuccessfulTime)
667
666
  {
668
667
  const auto component = reinterpret_cast<Component*>(c);
669
668
  try {
670
669
  double endTime = currentCommunicationPoint;
671
- const auto ok = component->slave->DoStep(
670
+ const auto status = component->slave->DoStep(
672
671
  currentCommunicationPoint,
673
672
  communicationStepSize,
674
- fmi3True,
673
+ noSetFmuStatePriorToCurrentPoint,
674
+ eventHandlingNeeded,
675
+ terminateSimulation,
676
+ earlyReturn,
675
677
  endTime);
676
- if (ok) {
677
- component->lastSuccessfulTime =
678
+ if (status == fmi3Status::fmi3OK) {
679
+ *lastSuccessfulTime =
678
680
  currentCommunicationPoint + communicationStepSize;
679
681
  return fmi3OK;
680
682
  } else {
681
- component->lastSuccessfulTime = endTime;
682
- return fmi3Discard;
683
+ *lastSuccessfulTime = endTime;
684
+ return status;
683
685
  }
684
686
  } catch (const cppfmu::FatalError& e) {
685
687
  component->logger.Log(fmi3Fatal, "", e.what());
@@ -200,20 +200,46 @@ void PySlaveInstance::ExitInitializationMode()
200
200
  });
201
201
  }
202
202
 
203
- bool PySlaveInstance::DoStep(cppfmu::FMIFloat64 currentTime, cppfmu::FMIFloat64 stepSize, cppfmu::FMIBoolean, cppfmu::FMIFloat64& endOfStep)
204
- {
205
- bool status;
206
- py_safe_run([this, &status, currentTime, stepSize](PyGILState_STATE gilState) {
203
+ cppfmu::FMIStatus PySlaveInstance::DoStep(cppfmu::FMIFloat64 currentTime,
204
+ cppfmu::FMIFloat64 stepSize,
205
+ cppfmu::FMIBoolean noSetFmuStatePriorToCurrentPoint,
206
+ cppfmu::FMIBoolean* eventHandlingNeeded,
207
+ cppfmu::FMIBoolean* terminateSimulation,
208
+ cppfmu::FMIBoolean* earlyReturn,
209
+ cppfmu::FMIFloat64& endOfStep)
210
+ {
211
+ cppfmu::FMIStatus fmuStatus = cppfmu::FMIOK;
212
+ py_safe_run([this, &fmuStatus, currentTime, stepSize, terminateSimulation](PyGILState_STATE gilState) {
207
213
  auto f = PyObject_CallMethod(pInstance_, "do_step", "(dd)", currentTime, stepSize);
208
214
  if (f == nullptr) {
209
215
  handle_py_exception("[doStep] PyObject_CallMethod", gilState);
210
216
  }
211
- status = static_cast<bool>(PyObject_IsTrue(f));
217
+
218
+ if (PyObject_HasAttrString(f, "status")) {
219
+ PyObject* pyStatus = PyObject_GetAttrString(f, "status");
220
+ if (pyStatus) {
221
+ fmuStatus = static_cast<cppfmu::FMIStatus>(PyLong_AsLong(pyStatus));
222
+ Py_DECREF(pyStatus);
223
+ }
224
+ } else {
225
+ bool status = static_cast<bool>(PyObject_IsTrue(f));
226
+ if (!status) {
227
+ fmuStatus = cppfmu::FMIDiscard;
228
+ }
229
+ }
230
+
231
+ if (PyObject_HasAttrString(f, "terminateSimulation")) {
232
+ PyObject* pyTerminateSimulation = PyObject_GetAttrString(f, "terminateSimulation");
233
+ if (pyTerminateSimulation) {
234
+ *terminateSimulation = static_cast<bool>(PyObject_IsTrue(pyTerminateSimulation));
235
+ Py_DECREF(pyTerminateSimulation);
236
+ }
237
+ }
212
238
  Py_DECREF(f);
213
239
  clearLogBuffer();
214
240
  });
215
241
 
216
- return status;
242
+ return fmuStatus;
217
243
  }
218
244
 
219
245
  void PySlaveInstance::Reset()
@@ -25,7 +25,13 @@ public:
25
25
  void ExitInitializationMode() override;
26
26
  void Terminate() override;
27
27
  void Reset() override;
28
- bool DoStep(cppfmu::FMIFloat64 currentCommunicationPoint, cppfmu::FMIFloat64 communicationStepSize, cppfmu::FMIBoolean newStep, cppfmu::FMIFloat64& endOfStep) override;
28
+ cppfmu::FMIStatus DoStep(cppfmu::FMIFloat64 currentCommunicationPoint,
29
+ cppfmu::FMIFloat64 communicationStepSize,
30
+ cppfmu::FMIBoolean newStep,
31
+ cppfmu::FMIBoolean* eventHandlingNeeded,
32
+ cppfmu::FMIBoolean* terminateSimulation,
33
+ cppfmu::FMIBoolean* earlyReturn,
34
+ cppfmu::FMIFloat64& endOfStep) override;
29
35
 
30
36
  void SetFloat64(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIFloat64* value, std::size_t nValues) override;
31
37
  void SetInt32(const cppfmu::FMIValueReference* vr, std::size_t nvr, const cppfmu::FMIInt32* value) override;
@@ -176,3 +176,23 @@ def test_documentation(tmp_path):
176
176
 
177
177
  assert "documentation/index.html" in names
178
178
  assert "documentation/licenses/license.txt" in names
179
+
180
+
181
+ def test_terminals(tmp_path):
182
+ script_file = Path(__file__).parent / "slaves/pythonslave.py"
183
+ def build():
184
+ with tempfile.TemporaryDirectory() as terminals_dir:
185
+ terminals_dir = Path(terminals_dir)
186
+ terminal1 = terminals_dir / "terminal1.xml"
187
+ terminal1.write_text("Dummy Terminal 1")
188
+
189
+ terminal2 = terminals_dir / "terminal2.xml"
190
+ terminal2.write_text("Dummy Terminal 2")
191
+ return FmuBuilder.build_FMU(script_file, dest=tmp_path, terminals_folder=terminals_dir)
192
+
193
+ fmu = build()
194
+ with zipfile.ZipFile(fmu) as files:
195
+ names = files.namelist()
196
+
197
+ assert "terminalsAndIcons/terminal1.xml" in names
198
+ assert "terminalsAndIcons/terminal2.xml" in names
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pythonfmu3
3
- Version: 0.1.16
3
+ Version: 0.1.17
4
4
  Summary: A lightweight framework that enables the packaging of Python3.x code as co-simulation FMUs.
5
5
  Home-page: https://github.com/stephensmith25/PythonFMU3
6
6
  Author: Stephen Smith
@@ -62,7 +62,7 @@ pip install pythonfmu3
62
62
  3. Run `pythonfmu3 build` to create the fmu.
63
63
 
64
64
  ```
65
- usage: pythonfmu3 build [-h] -f SCRIPT_FILE [-d DEST] [--doc DOCUMENTATION_FOLDER] [--no-external-tool]
65
+ usage: pythonfmu3 build [-h] -f SCRIPT_FILE [-d DEST] [--doc DOCUMENTATION_FOLDER] [--terminals TERMINALS_FOLDER] [--no-external-tool]
66
66
  [--no-variable-step] [--interpolate-inputs] [--only-one-per-process] [--handle-state]
67
67
  [--serialize-state] [--use-memory-management]
68
68
  [Project files [Project files ...]]
@@ -79,6 +79,8 @@ optional arguments:
79
79
  -d DEST, --dest DEST Where to save the FMU.
80
80
  --doc DOCUMENTATION_FOLDER
81
81
  Documentation folder to include in the FMU.
82
+ --terminals TERMINALS_FOLDER
83
+ Folder of terminals to include in the FMU.
82
84
  --no-external-tool If given, needsExecutionTool=false
83
85
  --no-variable-step If given, canHandleVariableCommunicationStepSize=false
84
86
  --interpolate-inputs If given, canInterpolateInputs=true
@@ -1 +0,0 @@
1
- __version__ = "0.1.16"
File without changes
File without changes
File without changes
File without changes