pythonfmu3 0.1.13__tar.gz → 0.1.15__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 (62) hide show
  1. {pythonfmu3-0.1.13/pythonfmu3.egg-info → pythonfmu3-0.1.15}/PKG-INFO +6 -4
  2. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/README.md +5 -3
  3. pythonfmu3-0.1.15/pythonfmu3/_version.py +1 -0
  4. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp +7 -2
  5. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
  6. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
  7. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/test_variables.py +3 -1
  8. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/variables.py +17 -3
  9. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15/pythonfmu3.egg-info}/PKG-INFO +6 -4
  10. pythonfmu3-0.1.13/pythonfmu3/_version.py +0 -1
  11. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/LICENSE +0 -0
  12. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/MANIFEST.in +0 -0
  13. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/__init__.py +0 -0
  14. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/__main__.py +0 -0
  15. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/builder.py +0 -0
  16. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/default_experiment.py +0 -0
  17. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/deploy.py +0 -0
  18. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/enums.py +0 -0
  19. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/fmi3slave.py +0 -0
  20. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/logmsg.py +0 -0
  21. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/osutil.py +0 -0
  22. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/.clang-format +0 -0
  23. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/CMakeLists.txt +0 -0
  24. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/build_unix.sh +0 -0
  25. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/build_win.sh +0 -0
  26. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/CMakeLists.txt +0 -0
  27. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_common.hpp +0 -0
  28. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.cpp +0 -0
  29. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.hpp +0 -0
  30. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/cppfmu/fmi_functions.cpp +0 -0
  31. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/fmi/fmi3FunctionTypes.h +0 -0
  32. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/fmi/fmi3Functions.h +0 -0
  33. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/fmi/fmi3PlatformTypes.h +0 -0
  34. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/pythonfmu/IPyState.hpp +0 -0
  35. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.hpp +0 -0
  36. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/pythonfmu-export/src/pythonfmu/PyState.hpp +0 -0
  37. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/__init__.py +0 -0
  38. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/conftest.py +0 -0
  39. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/data/csvdemo.csv +0 -0
  40. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/data/hello.txt +0 -0
  41. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/slaves/PythonSlaveWithException.py +0 -0
  42. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/slaves/localmodule.py +0 -0
  43. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/slaves/pythonslave.py +0 -0
  44. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/slaves/pythonslave_read_file.py +0 -0
  45. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/slaves/slavewithdep.py +0 -0
  46. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/test_builder.py +0 -0
  47. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/test_deploy.py +0 -0
  48. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/test_fmi3slave.py +0 -0
  49. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/test_integration.py +0 -0
  50. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/test_logger.py +0 -0
  51. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/test_multiple_fmus.py +0 -0
  52. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/tests/utils.py +0 -0
  53. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/unit.py +0 -0
  54. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3/variable_types.py +0 -0
  55. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3.egg-info/SOURCES.txt +0 -0
  56. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3.egg-info/dependency_links.txt +0 -0
  57. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3.egg-info/entry_points.txt +0 -0
  58. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3.egg-info/not-zip-safe +0 -0
  59. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3.egg-info/requires.txt +0 -0
  60. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/pythonfmu3.egg-info/top_level.txt +0 -0
  61. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/setup.cfg +0 -0
  62. {pythonfmu3-0.1.13 → pythonfmu3-0.1.15}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pythonfmu3
3
- Version: 0.1.13
3
+ Version: 0.1.15
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
@@ -131,16 +131,18 @@ from pythonfmu3 import Fmi3Causality, Fmi3Slave, Boolean, Int32, Float64, String
131
131
 
132
132
  class PythonSlave(Fmi3Slave):
133
133
 
134
- author = "John Doe"
135
- description = "A simple description"
136
-
137
134
  def __init__(self, **kwargs):
138
135
  super().__init__(**kwargs)
139
136
 
137
+ self.author = "John Doe"
138
+ self.description = "A simple description"
139
+
140
+ self.time = 0.0
140
141
  self.intOut = 1
141
142
  self.realOut = 3.0
142
143
  self.booleanVariable = True
143
144
  self.stringVariable = "Hello World!"
145
+ self.register_variable(Float64("time", causality=Fmi3Causality.independent))
144
146
  self.register_variable(Int32("intOut", causality=Fmi3Causality.output))
145
147
  self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
146
148
  self.register_variable(Boolean("booleanVariable", causality=Fmi3Causality.local))
@@ -105,16 +105,18 @@ from pythonfmu3 import Fmi3Causality, Fmi3Slave, Boolean, Int32, Float64, String
105
105
 
106
106
  class PythonSlave(Fmi3Slave):
107
107
 
108
- author = "John Doe"
109
- description = "A simple description"
110
-
111
108
  def __init__(self, **kwargs):
112
109
  super().__init__(**kwargs)
113
110
 
111
+ self.author = "John Doe"
112
+ self.description = "A simple description"
113
+
114
+ self.time = 0.0
114
115
  self.intOut = 1
115
116
  self.realOut = 3.0
116
117
  self.booleanVariable = True
117
118
  self.stringVariable = "Hello World!"
119
+ self.register_variable(Float64("time", causality=Fmi3Causality.independent))
118
120
  self.register_variable(Int32("intOut", causality=Fmi3Causality.output))
119
121
  self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
120
122
  self.register_variable(Boolean("booleanVariable", causality=Fmi3Causality.local))
@@ -0,0 +1 @@
1
+ __version__ = "0.1.15"
@@ -444,9 +444,14 @@ void PySlaveInstance::GetUInt64(const cppfmu::FMIValueReference* vr, std::size_t
444
444
  }
445
445
 
446
446
  for (int i = 0; i < nvr; i++) {
447
- PyObject* value = PyList_GetItem(refs, i);
448
- values[i] = static_cast<cppfmu::FMIUInt64>(PyLong_AsUnsignedLongLong(value));
447
+ PyObject* item = PyList_GetItem(refs, i);
448
+ PyObject* value = PyObject_GetAttrString(item, "value");
449
+ if (value && PyLong_Check(value))
450
+ {
451
+ values[i] = static_cast<cppfmu::FMIUInt64>(PyLong_AsUnsignedLongLong(value));
452
+ }
449
453
  }
454
+
450
455
  Py_DECREF(refs);
451
456
  clearLogBuffer();
452
457
  });
@@ -295,7 +295,9 @@ def test_String_to_xml(name, start):
295
295
  r = String(name, start)
296
296
  xml = r.to_xml()
297
297
  if start is not None:
298
- assert xml.attrib['start'] == str(start)
298
+ start_elements = xml.findall('.//Start')
299
+ assert len(start_elements) == 1
300
+ assert start_elements[0].attrib['value'] == str(start)
299
301
 
300
302
 
301
303
  @pytest.mark.requirements("numpy")
@@ -132,6 +132,16 @@ class ModelVariable(ABC):
132
132
  f"causality={self.causality}, " \
133
133
  f"variability={self.variability})"
134
134
 
135
+ class Start(object):
136
+ def __init__(self, startValue):
137
+ self.value = startValue
138
+
139
+ def to_xml(self) -> Element:
140
+ attrib = dict()
141
+ attrib["value"] = self.value
142
+ return Element("Start", attrib)
143
+
144
+
135
145
  class Dimension(object):
136
146
  def __init__(self, start: str = "", valueReference: str = ""):
137
147
  if start and valueReference and any((start, valueReference)):
@@ -320,16 +330,17 @@ class Boolean(ModelVariable):
320
330
  class String(ModelVariable):
321
331
  def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
322
332
  super().__init__(name, **kwargs)
323
- self.__attrs = {"start": start}
333
+ self.__attrs = dict()
324
334
  self._type = "String"
335
+ self._start = Start(start)
325
336
 
326
337
  @property
327
338
  def start(self) -> Optional[Any]:
328
- return self.__attrs["start"]
339
+ return self._start.value
329
340
 
330
341
  @start.setter
331
342
  def start(self, value: float):
332
- self.__attrs["start"] = value
343
+ self._start.value = value
333
344
 
334
345
  def to_xml(self) -> Element:
335
346
  attrib = dict()
@@ -338,6 +349,9 @@ class String(ModelVariable):
338
349
  attrib[key] = str(value)
339
350
  self._extras = attrib
340
351
  parent = super().to_xml()
352
+
353
+ if self.start is not None:
354
+ parent.append(self._start.to_xml())
341
355
 
342
356
  return parent
343
357
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pythonfmu3
3
- Version: 0.1.13
3
+ Version: 0.1.15
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
@@ -131,16 +131,18 @@ from pythonfmu3 import Fmi3Causality, Fmi3Slave, Boolean, Int32, Float64, String
131
131
 
132
132
  class PythonSlave(Fmi3Slave):
133
133
 
134
- author = "John Doe"
135
- description = "A simple description"
136
-
137
134
  def __init__(self, **kwargs):
138
135
  super().__init__(**kwargs)
139
136
 
137
+ self.author = "John Doe"
138
+ self.description = "A simple description"
139
+
140
+ self.time = 0.0
140
141
  self.intOut = 1
141
142
  self.realOut = 3.0
142
143
  self.booleanVariable = True
143
144
  self.stringVariable = "Hello World!"
145
+ self.register_variable(Float64("time", causality=Fmi3Causality.independent))
144
146
  self.register_variable(Int32("intOut", causality=Fmi3Causality.output))
145
147
  self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
146
148
  self.register_variable(Boolean("booleanVariable", causality=Fmi3Causality.local))
@@ -1 +0,0 @@
1
- __version__ = "0.1.13"
File without changes
File without changes
File without changes
File without changes