pythonfmu3 0.1.13__py3-none-any.whl → 0.1.15__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.
- pythonfmu3/_version.py +1 -1
- pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp +7 -2
- pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
- pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
- pythonfmu3/tests/test_variables.py +3 -1
- pythonfmu3/variables.py +17 -3
- {pythonfmu3-0.1.13.dist-info → pythonfmu3-0.1.15.dist-info}/METADATA +6 -4
- {pythonfmu3-0.1.13.dist-info → pythonfmu3-0.1.15.dist-info}/RECORD +12 -12
- {pythonfmu3-0.1.13.dist-info → pythonfmu3-0.1.15.dist-info}/WHEEL +1 -1
- {pythonfmu3-0.1.13.dist-info → pythonfmu3-0.1.15.dist-info}/LICENSE +0 -0
- {pythonfmu3-0.1.13.dist-info → pythonfmu3-0.1.15.dist-info}/entry_points.txt +0 -0
- {pythonfmu3-0.1.13.dist-info → pythonfmu3-0.1.15.dist-info}/top_level.txt +0 -0
pythonfmu3/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "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*
|
|
448
|
-
|
|
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
|
});
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
-
|
|
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")
|
pythonfmu3/variables.py
CHANGED
|
@@ -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 =
|
|
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.
|
|
339
|
+
return self._start.value
|
|
329
340
|
|
|
330
341
|
@start.setter
|
|
331
342
|
def start(self, value: float):
|
|
332
|
-
self.
|
|
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.
|
|
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,6 +1,6 @@
|
|
|
1
1
|
pythonfmu3/__init__.py,sha256=PT1R0LpSInyVdXGJbkWMTQym6_SEU7CqUkG7OH5j1f0,396
|
|
2
2
|
pythonfmu3/__main__.py,sha256=gC1T8x2d02hhqshyNQGSS70SyCk-3I3t8zPqoRo2Xd8,1543
|
|
3
|
-
pythonfmu3/_version.py,sha256=
|
|
3
|
+
pythonfmu3/_version.py,sha256=qb0TalpSt1CbprnFyeLUKqgrqNtmnk9IoQQ7umAoXVY,23
|
|
4
4
|
pythonfmu3/builder.py,sha256=YLTeLLpiFOkoDYwnJ55GEhb3ham0xxROMjMN6bvaw5Y,8784
|
|
5
5
|
pythonfmu3/default_experiment.py,sha256=FJ0l0FpU7pT4Pox2RiA2y-Cb_e7DE2XlbWKySRYQaVk,293
|
|
6
6
|
pythonfmu3/deploy.py,sha256=eqFWVxZUkJCLvmq1-GuMNjn2j0VCGoaXPhRWrCk2Vxg,3741
|
|
@@ -10,7 +10,7 @@ pythonfmu3/logmsg.py,sha256=0wn11GLwq0LLWqyC2ktLRjQFWlpj07wWliZ8rUHx1gg,359
|
|
|
10
10
|
pythonfmu3/osutil.py,sha256=KMAoMf_BpqFQQUy3WzHnt9jiklkS1xy0syIbj7kNH6A,656
|
|
11
11
|
pythonfmu3/unit.py,sha256=SjOaywb5lVQbAO_iLjc_7Ly3nYrmAvIW2_hAGt12UFU,1475
|
|
12
12
|
pythonfmu3/variable_types.py,sha256=Q0D4wlGi3i3zE5UsmGJEpNh7SV_W8mn_8p_WIkwrLQA,2881
|
|
13
|
-
pythonfmu3/variables.py,sha256=
|
|
13
|
+
pythonfmu3/variables.py,sha256=hwYT6AfaSQIa1egVJrOxnDi5NEj1bk_VkQd9-hsoDII,11905
|
|
14
14
|
pythonfmu3/pythonfmu-export/.clang-format,sha256=ApbsHWYwilCXJ1iBux4nqOjLkaqgbGLsVrc_U3hX7WI,944
|
|
15
15
|
pythonfmu3/pythonfmu-export/CMakeLists.txt,sha256=p0-4Xh_sAaOI9AVb8lsUsMxJPc6bg9b_6CF6NJt5FHE,1847
|
|
16
16
|
pythonfmu3/pythonfmu-export/build_unix.sh,sha256=I5RrF2O6y0hRG_SN4ExKN_CCFYaa2l-ngKzqmBXnHmA,73
|
|
@@ -24,11 +24,11 @@ pythonfmu3/pythonfmu-export/src/fmi/fmi3FunctionTypes.h,sha256=Tk1WY0nAYBGiOAQ8z
|
|
|
24
24
|
pythonfmu3/pythonfmu-export/src/fmi/fmi3Functions.h,sha256=NsHuclp20wcuUInYf-91UXZbljTeu2cPXENqNEORdgU,16262
|
|
25
25
|
pythonfmu3/pythonfmu-export/src/fmi/fmi3PlatformTypes.h,sha256=ZCQLJgSbRGrMsBiQ4auaYCY4J3Hck6g3t1iZp5NEguw,4251
|
|
26
26
|
pythonfmu3/pythonfmu-export/src/pythonfmu/IPyState.hpp,sha256=GLiOjhKLDVEICersnqVwezwEshbxfdh_cyMxBJGFbu8,456
|
|
27
|
-
pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp,sha256=
|
|
27
|
+
pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp,sha256=pzHSx3Cfq7Lt7dcvMR5na7tyOrTs0RsNglnrAcRc0cs,24333
|
|
28
28
|
pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.hpp,sha256=Q8eulMAkv7YkfzCi2KSwxvYngv0I_nRbmfTJR9vT92M,4063
|
|
29
29
|
pythonfmu3/pythonfmu-export/src/pythonfmu/PyState.hpp,sha256=CjFEIrZu8b1jxQAIgfI_o36hyItW_SdQ5VSkImf7JNs,2977
|
|
30
|
-
pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so,sha256=
|
|
31
|
-
pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll,sha256=
|
|
30
|
+
pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so,sha256=abssHrtFiwtjugmJkjHL29TqmimbkydTsAEr5k7ryKc,365120
|
|
31
|
+
pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll,sha256=5S2ivGp0No5x-vJjb9iWBf2m7SLvDw_gcTgQycTcdKk,431104
|
|
32
32
|
pythonfmu3/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
33
|
pythonfmu3/tests/conftest.py,sha256=B6XxTnBdeF_tEJ3w2DlfPKUfvlk-oULgIhQtXkgOJIc,171
|
|
34
34
|
pythonfmu3/tests/test_builder.py,sha256=StR9oNmF6dtuxxKtPFlncLQN-O7n97nvHm6EFH4Qn14,6252
|
|
@@ -37,7 +37,7 @@ pythonfmu3/tests/test_fmi3slave.py,sha256=1uwTdfiFZNmU0yzIdC30kAuu95xsZSTMA9CGk_
|
|
|
37
37
|
pythonfmu3/tests/test_integration.py,sha256=2ewA-Mai5qbC5ujyYDLo_Em1NzGsfrgaYiugDZH53ow,10562
|
|
38
38
|
pythonfmu3/tests/test_logger.py,sha256=OcHQhxUtNBPH-0zdmheC4I9OWz1yu48W8MYDshNVkf8,5765
|
|
39
39
|
pythonfmu3/tests/test_multiple_fmus.py,sha256=NJC3aHu1PA4LlZjMmCfC3IKh-_IBu1h3QMkrKiDYFrY,3680
|
|
40
|
-
pythonfmu3/tests/test_variables.py,sha256=
|
|
40
|
+
pythonfmu3/tests/test_variables.py,sha256=t4r2TBruf58uYwjkp3r-RcZS5TrsOaVT_mDuoiUTQtg,9598
|
|
41
41
|
pythonfmu3/tests/utils.py,sha256=WusWSUGoBPenZL-FAKQlzaHN2aYXiznZM2fwCjoldwY,301
|
|
42
42
|
pythonfmu3/tests/data/csvdemo.csv,sha256=TiTUyzHyjQNXM4eXI33oJipc7w9_PJ8aMejRmwc52Xw,256
|
|
43
43
|
pythonfmu3/tests/data/hello.txt,sha256=wFNeS-K3n_2TKRMFQ2v4iTFOSj-uwF7P_Lt98xrZ5Ro,12
|
|
@@ -46,9 +46,9 @@ pythonfmu3/tests/slaves/localmodule.py,sha256=-q5Lmh2I88MG7nLTscms0n5xhHLkUDed1I
|
|
|
46
46
|
pythonfmu3/tests/slaves/pythonslave.py,sha256=H75vLhqshSWWvMj2NQt6a_aQhA6BGSkBVJstjjVE0AU,2024
|
|
47
47
|
pythonfmu3/tests/slaves/pythonslave_read_file.py,sha256=NIAmyZZGNAcnqf8R5jb1yFcQxj6iSMOAc13pY0GFtco,634
|
|
48
48
|
pythonfmu3/tests/slaves/slavewithdep.py,sha256=4yqxa0vsOTLLvtaUQFkjfU9OcwjDUtuUe-qIjnD-jrw,647
|
|
49
|
-
pythonfmu3-0.1.
|
|
50
|
-
pythonfmu3-0.1.
|
|
51
|
-
pythonfmu3-0.1.
|
|
52
|
-
pythonfmu3-0.1.
|
|
53
|
-
pythonfmu3-0.1.
|
|
54
|
-
pythonfmu3-0.1.
|
|
49
|
+
pythonfmu3-0.1.15.dist-info/LICENSE,sha256=24Cw_MPouLK-G_t8Hgjm59IS9BnPoL6SKkyuZ0xesXY,1155
|
|
50
|
+
pythonfmu3-0.1.15.dist-info/METADATA,sha256=wLt8-BEWjeq7FO4G_YnSEQXUd2387gE_YhY3oW4v3hc,7442
|
|
51
|
+
pythonfmu3-0.1.15.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
52
|
+
pythonfmu3-0.1.15.dist-info/entry_points.txt,sha256=GgkWYs0DKGHLcijMEYZGkhkHOK2RVUpjGwvl1fwyDwQ,60
|
|
53
|
+
pythonfmu3-0.1.15.dist-info/top_level.txt,sha256=6ne7bh_cME1hepxCx1BG8N5QVhVAufrp7LLok6vq7nE,11
|
|
54
|
+
pythonfmu3-0.1.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|