pythonfmu3 0.2.2.2__py3-none-any.whl → 0.2.3__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/__init__.py +8 -8
- pythonfmu3/__main__.py +52 -52
- pythonfmu3/_version.py +1 -1
- pythonfmu3/builder.py +260 -260
- pythonfmu3/default_experiment.py +7 -7
- pythonfmu3/deploy.py +118 -118
- pythonfmu3/enums.py +48 -48
- pythonfmu3/fmi3slave.py +438 -438
- pythonfmu3/logmsg.py +14 -14
- pythonfmu3/osutil.py +22 -22
- pythonfmu3/pythonfmu-export/.clang-format +35 -35
- pythonfmu3/pythonfmu-export/CMakeLists.txt +59 -59
- pythonfmu3/pythonfmu-export/build_unix.sh +4 -4
- pythonfmu3/pythonfmu-export/build_win.sh +4 -4
- pythonfmu3/pythonfmu-export/src/CMakeLists.txt +45 -45
- pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_common.hpp +161 -161
- pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.cpp +192 -192
- pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.hpp +185 -185
- pythonfmu3/pythonfmu-export/src/cppfmu/fmi_functions.cpp +937 -937
- pythonfmu3/pythonfmu-export/src/fmi/fmi3FunctionTypes.h +638 -638
- pythonfmu3/pythonfmu-export/src/fmi/fmi3Functions.h +343 -343
- pythonfmu3/pythonfmu-export/src/fmi/fmi3PlatformTypes.h +94 -94
- pythonfmu3/pythonfmu-export/src/pythonfmu/IPyState.hpp +17 -17
- pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp +744 -744
- pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.hpp +111 -111
- pythonfmu3/pythonfmu-export/src/pythonfmu/PyState.hpp +84 -84
- pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
- pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
- pythonfmu3/tests/conftest.py +5 -5
- pythonfmu3/tests/data/csvdemo.csv +7 -7
- pythonfmu3/tests/slaves/PythonSlaveWithException.py +18 -18
- pythonfmu3/tests/slaves/localmodule.py +8 -8
- pythonfmu3/tests/slaves/pythonslave.py +52 -52
- pythonfmu3/tests/slaves/pythonslave_read_file.py +23 -23
- pythonfmu3/tests/slaves/slavewithdep.py +21 -21
- pythonfmu3/tests/test_builder.py +195 -195
- pythonfmu3/tests/test_deploy.py +48 -48
- pythonfmu3/tests/test_fmi3slave.py +152 -152
- pythonfmu3/tests/test_integration.py +350 -350
- pythonfmu3/tests/test_logger.py +180 -180
- pythonfmu3/tests/test_multiple_fmus.py +141 -141
- pythonfmu3/tests/test_variables.py +334 -334
- pythonfmu3/tests/utils.py +13 -13
- pythonfmu3/unit.py +62 -62
- pythonfmu3/variable_types.py +101 -101
- pythonfmu3/variables.py +400 -400
- {pythonfmu3-0.2.2.2.dist-info → pythonfmu3-0.2.3.dist-info}/METADATA +7 -9
- pythonfmu3-0.2.3.dist-info/RECORD +54 -0
- {pythonfmu3-0.2.2.2.dist-info → pythonfmu3-0.2.3.dist-info}/WHEEL +1 -1
- {pythonfmu3-0.2.2.2.dist-info → pythonfmu3-0.2.3.dist-info}/entry_points.txt +0 -1
- pythonfmu3-0.2.2.2.dist-info/LICENSE.txt → pythonfmu3-0.2.3.dist-info/licenses/LICENSE +23 -23
- pythonfmu3/pythonfmu-export/build/ALL_BUILD.vcxproj +0 -184
- pythonfmu3/pythonfmu-export/build/ALL_BUILD.vcxproj.filters +0 -8
- pythonfmu3/pythonfmu-export/build/CMakeCache.txt +0 -369
- pythonfmu3/pythonfmu-export/build/CMakeFiles/0ee4db0675778dfba98c7160896d5a45/generate.stamp.rule +0 -1
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeCCompiler.cmake +0 -72
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeCXXCompiler.cmake +0 -83
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeDetermineCompilerABI_C.bin +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeDetermineCompilerABI_CXX.bin +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeRCCompiler.cmake +0 -6
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeSystem.cmake +0 -15
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/CMakeCCompilerId.c +0 -838
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/CompilerIdC.exe +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/CompilerIdC.vcxproj +0 -71
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CMakeCCompilerId.obj +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.exe.recipe +0 -11
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CompilerIdC.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -826
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/CompilerIdCXX.exe +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/CompilerIdCXX.vcxproj +0 -71
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CMakeCXXCompilerId.obj +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.exe.recipe +0 -11
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CompilerIdCXX.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/VCTargetsPath.txt +0 -1
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/VCTargetsPath.vcxproj +0 -31
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/x64/Debug/VCTargetsPath.recipe +0 -11
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/x64/Debug/VCTargetsPath.tlog/VCTargetsPath.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeCCompiler.cmake +0 -81
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeCXXCompiler.cmake +0 -101
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeDetermineCompilerABI_C.bin +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeRCCompiler.cmake +0 -6
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeSystem.cmake +0 -15
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/CMakeCCompilerId.c +0 -904
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/CompilerIdC.exe +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/CompilerIdC.vcxproj +0 -72
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CMakeCCompilerId.obj +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.exe.recipe +0 -11
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CompilerIdC.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -919
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/CompilerIdCXX.exe +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/CompilerIdCXX.vcxproj +0 -72
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CMakeCXXCompilerId.obj +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.exe.recipe +0 -11
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CompilerIdCXX.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/VCTargetsPath.txt +0 -1
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/VCTargetsPath.vcxproj +0 -31
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/x64/Debug/VCTargetsPath.recipe +0 -11
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/x64/Debug/VCTargetsPath.tlog/VCTargetsPath.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/CMakeFiles/CMakeConfigureLog.yaml +0 -568
- pythonfmu3/pythonfmu-export/build/CMakeFiles/CMakeOutput.log +0 -357
- pythonfmu3/pythonfmu-export/build/CMakeFiles/TargetDirectories.txt +0 -3
- pythonfmu3/pythonfmu-export/build/CMakeFiles/cmake.check_cache +0 -1
- pythonfmu3/pythonfmu-export/build/CMakeFiles/generate.stamp +0 -1
- pythonfmu3/pythonfmu-export/build/CMakeFiles/generate.stamp.depend +0 -28
- pythonfmu3/pythonfmu-export/build/CMakeFiles/generate.stamp.list +0 -2
- pythonfmu3/pythonfmu-export/build/ZERO_CHECK.vcxproj +0 -174
- pythonfmu3/pythonfmu-export/build/ZERO_CHECK.vcxproj.filters +0 -13
- pythonfmu3/pythonfmu-export/build/cmake_install.cmake +0 -50
- pythonfmu3/pythonfmu-export/build/install_manifest.txt +0 -0
- pythonfmu3/pythonfmu-export/build/pythonfmu-export.sln +0 -53
- pythonfmu3/pythonfmu-export/build/src/CMakeFiles/generate.stamp +0 -1
- pythonfmu3/pythonfmu-export/build/src/CMakeFiles/generate.stamp.depend +0 -2
- pythonfmu3/pythonfmu-export/build/src/Debug/pythonfmu-export.pdb +0 -0
- pythonfmu3/pythonfmu-export/build/src/Release/pythonfmu-export.exp +0 -0
- pythonfmu3/pythonfmu-export/build/src/Release/pythonfmu-export.lib +0 -0
- pythonfmu3/pythonfmu-export/build/src/cmake_install.cmake +0 -34
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/PySlaveInstance.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/cppfmu_cs.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/exports.def +0 -1885
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/fmi_functions.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/objects.txt +0 -3
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CustomBuild.command.1.tlog +0 -10
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CustomBuild.read.1.tlog +0 -1
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CustomBuild.write.1.tlog +0 -2
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.command.1.tlog +0 -1
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.read.1.tlog +0 -1
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.read.3.tlog +0 -1
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.write.1.tlog +0 -1
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/pythonfmu-export.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/unsuccessfulbuild +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/vc142.pdb +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/MinSizeRel/objects.txt +0 -3
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/RelWithDebInfo/objects.txt +0 -3
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/PySlaveInstance.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/cppfmu_cs.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/exports.def +0 -538
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/fmi_functions.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/objects.txt +0 -3
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.dll.recipe +0 -14
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CustomBuild.command.1.tlog +0 -10
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CustomBuild.read.1.tlog +0 -1
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CustomBuild.write.1.tlog +0 -2
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.delete.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/pythonfmu-export.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/pythonfmu-export.write.1u.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.vcxproj +0 -414
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.vcxproj.filters +0 -48
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.recipe +0 -11
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.command.1.tlog +0 -10
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.read.1.tlog +0 -29
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.write.1.tlog +0 -3
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/ZERO_CHECK.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.recipe +0 -17
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/ALL_BUILD.lastbuildstate +0 -2
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.command.1.tlog +0 -10
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.read.1.tlog +0 -27
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.write.1.tlog +0 -2
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.recipe +0 -11
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.command.1.tlog +0 -10
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.read.1.tlog +0 -29
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.write.1.tlog +0 -3
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/ZERO_CHECK.lastbuildstate +0 -2
- pythonfmu3/resources/binaries/x86_64-windows1/pythonfmu-export.dll +0 -0
- pythonfmu3-0.2.2.2.dist-info/RECORD +0 -200
- {pythonfmu3-0.2.2.2.dist-info → pythonfmu3-0.2.3.dist-info}/top_level.txt +0 -0
|
@@ -1,335 +1,335 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
from random import randint
|
|
3
|
-
|
|
4
|
-
import pytest
|
|
5
|
-
import ctypes
|
|
6
|
-
|
|
7
|
-
from xml.etree import ElementTree
|
|
8
|
-
|
|
9
|
-
from pythonfmu3 import Fmi3Slave
|
|
10
|
-
from pythonfmu3.enums import Fmi3Causality, Fmi3Initial, Fmi3Variability
|
|
11
|
-
from pythonfmu3.variables import flatten, Boolean, Int32, UInt64, Float64, ModelVariable, String, Dimension
|
|
12
|
-
|
|
13
|
-
from .utils import PY2FMI, UInt64ValType
|
|
14
|
-
|
|
15
|
-
MODEL_VARIABLE_ATTRIBUTES = ["name", "valueReference", "description", "causality", "variability", "initial"]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def test_ModelVariable_reference_set_once_only():
|
|
19
|
-
v = ModelVariable('variable')
|
|
20
|
-
v.value_reference = 22
|
|
21
|
-
|
|
22
|
-
with pytest.raises(RuntimeError):
|
|
23
|
-
v.value_reference = 33
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@pytest.mark.parametrize("causality", list(Fmi3Causality) + [None])
|
|
27
|
-
@pytest.mark.parametrize("initial", list(Fmi3Initial) + [None])
|
|
28
|
-
@pytest.mark.parametrize("variability", list(Fmi3Variability) + [None])
|
|
29
|
-
@pytest.mark.parametrize("name, description", [
|
|
30
|
-
("var", None),
|
|
31
|
-
("var", "description of var"),
|
|
32
|
-
])
|
|
33
|
-
def test_ModelVariable_constructor(causality, initial, variability, name, description):
|
|
34
|
-
var = ModelVariable(name, causality, description, initial, variability)
|
|
35
|
-
|
|
36
|
-
assert var.name == name
|
|
37
|
-
assert var.value_reference is None
|
|
38
|
-
assert var.causality == causality
|
|
39
|
-
assert var.description == description
|
|
40
|
-
assert var.initial == initial
|
|
41
|
-
assert var.variability == variability
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@pytest.mark.parametrize("fmi_type,value", [
|
|
45
|
-
(Boolean, False),
|
|
46
|
-
(Int32, 22),
|
|
47
|
-
(UInt64, UInt64ValType(23)),
|
|
48
|
-
(Float64, 2./3.),
|
|
49
|
-
(String, "hello_world"),
|
|
50
|
-
])
|
|
51
|
-
def test_ModelVariable_getter(fmi_type, value):
|
|
52
|
-
|
|
53
|
-
class Slave(Fmi3Slave):
|
|
54
|
-
|
|
55
|
-
def __init__(self, **kwargs):
|
|
56
|
-
super().__init__(**kwargs)
|
|
57
|
-
self.var = [value]
|
|
58
|
-
self.register_variable(PY2FMI[type(value)]("var", getter=lambda: self.var[0]))
|
|
59
|
-
|
|
60
|
-
def do_step(self, t, dt):
|
|
61
|
-
return True
|
|
62
|
-
|
|
63
|
-
fmi_type_name = fmi_type.__qualname__.lower()
|
|
64
|
-
|
|
65
|
-
slave = Slave(instance_name="slaveInstance")
|
|
66
|
-
assert [getattr(val, "value", val) for val in getattr(slave, f"get_{fmi_type_name}")([0])] == [value]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@pytest.mark.parametrize("fmi_type,value", [
|
|
70
|
-
(Boolean, False),
|
|
71
|
-
(Int32, 22),
|
|
72
|
-
(UInt64, UInt64ValType(23)),
|
|
73
|
-
(Float64, 2./3.),
|
|
74
|
-
(String, "hello_world")
|
|
75
|
-
])
|
|
76
|
-
def test_ModelVariable_setter(fmi_type, value):
|
|
77
|
-
|
|
78
|
-
class Slave(Fmi3Slave):
|
|
79
|
-
|
|
80
|
-
def __init__(self, **kwargs):
|
|
81
|
-
super().__init__(**kwargs)
|
|
82
|
-
self.var = [None]
|
|
83
|
-
self.register_variable(
|
|
84
|
-
PY2FMI[type(value)](
|
|
85
|
-
"var",
|
|
86
|
-
getter=lambda: self.var[0],
|
|
87
|
-
setter=lambda v: self.var.__setitem__(0, v)
|
|
88
|
-
)
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
def do_step(self, t, dt):
|
|
92
|
-
return True
|
|
93
|
-
|
|
94
|
-
slave = Slave(instance_name="slaveInstance")
|
|
95
|
-
fmi_type_name = fmi_type.__qualname__.lower()
|
|
96
|
-
|
|
97
|
-
set_method = getattr(slave, f"set_{fmi_type_name}")
|
|
98
|
-
set_method([0, ], [value, ])
|
|
99
|
-
assert [getattr(val, "value", val) for val in getattr(slave, f"get_{fmi_type_name}")([0])] == [value]
|
|
100
|
-
|
|
101
|
-
@pytest.mark.requirements("numpy")
|
|
102
|
-
@pytest.mark.parametrize("fmi_type,value,dims", [
|
|
103
|
-
(Float64, [1.,2.,3.,4.], [4]),
|
|
104
|
-
(Float64, [1.,2.,3.,4.], [2, 2]),
|
|
105
|
-
])
|
|
106
|
-
def test_ModelVariable_getter_array(fmi_type, value, dims):
|
|
107
|
-
|
|
108
|
-
class Slave(Fmi3Slave):
|
|
109
|
-
|
|
110
|
-
def __init__(self, **kwargs):
|
|
111
|
-
super().__init__(**kwargs)
|
|
112
|
-
self.var = value
|
|
113
|
-
dimensions = [Dimension(start=val) for val in dims]
|
|
114
|
-
self.register_variable(PY2FMI[type(value[0])]("var", getter=lambda: self.var, dimensions=dimensions))
|
|
115
|
-
|
|
116
|
-
def do_step(self, t, dt):
|
|
117
|
-
return True
|
|
118
|
-
|
|
119
|
-
fmi_type_name = fmi_type.__qualname__.lower()
|
|
120
|
-
|
|
121
|
-
slave = Slave(instance_name="slaveInstance")
|
|
122
|
-
assert [getattr(val, "value", val) for val in getattr(slave, f"get_{fmi_type_name}")([0])] == value
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
@pytest.mark.requirements("numpy")
|
|
126
|
-
@pytest.mark.parametrize("fmi_type,value,dims", [
|
|
127
|
-
(Float64, [1.,2.,3.,4.], [4]),
|
|
128
|
-
(Float64, [1.,2.,3.,4.], [2, 2]),
|
|
129
|
-
])
|
|
130
|
-
def test_ModelVariable_setter_array(fmi_type, value, dims):
|
|
131
|
-
|
|
132
|
-
class Slave(Fmi3Slave):
|
|
133
|
-
|
|
134
|
-
def __init__(self, **kwargs):
|
|
135
|
-
super().__init__(**kwargs)
|
|
136
|
-
self.var = [None]*len(value)
|
|
137
|
-
dimensions = [Dimension(start=val) for val in dims]
|
|
138
|
-
self.register_variable(
|
|
139
|
-
PY2FMI[type(value[0])](
|
|
140
|
-
"var",
|
|
141
|
-
getter=lambda: self.var,
|
|
142
|
-
setter=lambda v: setattr(self, 'var', v),
|
|
143
|
-
dimensions=dimensions
|
|
144
|
-
)
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
def do_step(self, t, dt):
|
|
148
|
-
return True
|
|
149
|
-
|
|
150
|
-
slave = Slave(instance_name="slaveInstance")
|
|
151
|
-
fmi_type_name = fmi_type.__qualname__.lower()
|
|
152
|
-
|
|
153
|
-
set_method = getattr(slave, f"set_{fmi_type_name}")
|
|
154
|
-
set_method([0, ], value)
|
|
155
|
-
assert [getattr(val, "value", val) for val in getattr(slave, f"get_{fmi_type_name}")([0])] == value
|
|
156
|
-
|
|
157
|
-
@pytest.mark.parametrize("causality", list(Fmi3Causality) + [None])
|
|
158
|
-
@pytest.mark.parametrize("initial", list(Fmi3Initial) + [None])
|
|
159
|
-
@pytest.mark.parametrize("variability", list(Fmi3Variability) + [None])
|
|
160
|
-
@pytest.mark.parametrize("name, description", [
|
|
161
|
-
("var", None),
|
|
162
|
-
("var", "description of var"),
|
|
163
|
-
])
|
|
164
|
-
def test_ModelVariable_to_xml(causality, initial, variability, name, description):
|
|
165
|
-
var = ModelVariable(name, causality, description, initial, variability)
|
|
166
|
-
valueReference = randint(0, 25000)
|
|
167
|
-
var.value_reference = valueReference
|
|
168
|
-
|
|
169
|
-
node = var.to_xml()
|
|
170
|
-
assert node.tag == None
|
|
171
|
-
args = locals()
|
|
172
|
-
for attr in MODEL_VARIABLE_ATTRIBUTES:
|
|
173
|
-
value = args[attr]
|
|
174
|
-
if value is not None:
|
|
175
|
-
if isinstance(value, Enum):
|
|
176
|
-
assert node.attrib[attr] == value.name
|
|
177
|
-
else:
|
|
178
|
-
assert node.attrib[attr] == str(value)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
@pytest.mark.parametrize("var_type, value", [
|
|
182
|
-
(Boolean, True),
|
|
183
|
-
(Int32, 23),
|
|
184
|
-
(UInt64, UInt64ValType(23)),
|
|
185
|
-
(Float64, 15.),
|
|
186
|
-
(String, "hello")])
|
|
187
|
-
@pytest.mark.parametrize("causality", list(Fmi3Causality) + [None])
|
|
188
|
-
@pytest.mark.parametrize("initial", list(Fmi3Initial) + [None])
|
|
189
|
-
@pytest.mark.parametrize("variability", list(Fmi3Variability) + [None])
|
|
190
|
-
def test_ModelVariable_start(var_type, value, causality, initial, variability):
|
|
191
|
-
var_obj = var_type("var", causality=causality, description="a variable", initial=initial, variability=variability)
|
|
192
|
-
|
|
193
|
-
class PySlave(Fmi3Slave):
|
|
194
|
-
|
|
195
|
-
def __init__(self, **kwargs):
|
|
196
|
-
super().__init__(**kwargs)
|
|
197
|
-
setattr(self, "var", value)
|
|
198
|
-
self.register_variable(var_obj)
|
|
199
|
-
|
|
200
|
-
def do_step(self, current_time: float, step_size: float):
|
|
201
|
-
return True
|
|
202
|
-
|
|
203
|
-
slave = PySlave(instance_name="testInstance")
|
|
204
|
-
|
|
205
|
-
xml = slave.to_xml()
|
|
206
|
-
var_node = xml.find(f".//{var_obj._type}[@name='var']")
|
|
207
|
-
|
|
208
|
-
assert var_node is not None
|
|
209
|
-
|
|
210
|
-
if ModelVariable.requires_start(var_obj):
|
|
211
|
-
assert var_obj.start == value
|
|
212
|
-
else:
|
|
213
|
-
assert var_obj.start is None
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
@pytest.mark.parametrize("name,start", [
|
|
217
|
-
("boolean_name", None),
|
|
218
|
-
("boolean_another_name", False),
|
|
219
|
-
])
|
|
220
|
-
def test_Boolean_constructor(name, start):
|
|
221
|
-
r = Boolean(name, start)
|
|
222
|
-
|
|
223
|
-
assert r.start == start
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
@pytest.mark.parametrize("name,start", [
|
|
227
|
-
("boolean_name", None),
|
|
228
|
-
("boolean_another_name", True),
|
|
229
|
-
("boolean_yet_another", False),
|
|
230
|
-
])
|
|
231
|
-
def test_Boolean_to_xml(name, start):
|
|
232
|
-
r = Boolean(name, start)
|
|
233
|
-
xml = r.to_xml()
|
|
234
|
-
if start is not None:
|
|
235
|
-
assert xml.attrib['start'] == str(start).lower()
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
@pytest.mark.parametrize("name,start", [
|
|
239
|
-
("integer_name", None),
|
|
240
|
-
("integer_another_name", 42),
|
|
241
|
-
])
|
|
242
|
-
def test_Integer_constructor(name, start):
|
|
243
|
-
r = Int32(name, start)
|
|
244
|
-
|
|
245
|
-
assert r.start == start
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
@pytest.mark.parametrize("name,start", [
|
|
249
|
-
("integer_name", None),
|
|
250
|
-
("integer_another_name", 42),
|
|
251
|
-
])
|
|
252
|
-
def test_Integer_to_xml(name, start):
|
|
253
|
-
r = Int32(name, start)
|
|
254
|
-
xml = r.to_xml()
|
|
255
|
-
if start is not None:
|
|
256
|
-
assert xml.attrib['start'] == str(start)
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
@pytest.mark.parametrize("name,start", [
|
|
260
|
-
("real_name", None),
|
|
261
|
-
("real_another_name", 22.),
|
|
262
|
-
])
|
|
263
|
-
def test_Real_constructor(name, start):
|
|
264
|
-
r = Float64(name, start)
|
|
265
|
-
|
|
266
|
-
assert r.start == start
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
@pytest.mark.parametrize("name,start", [
|
|
270
|
-
("real_name", None),
|
|
271
|
-
("real_another_name", 22.),
|
|
272
|
-
])
|
|
273
|
-
def test_Real_to_xml(name, start):
|
|
274
|
-
r = Float64(name, start)
|
|
275
|
-
xml = r.to_xml()
|
|
276
|
-
if start is not None:
|
|
277
|
-
assert xml.attrib['start'] == f"{start:.16g}"
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
@pytest.mark.parametrize("name,start", [
|
|
281
|
-
("string_name", None),
|
|
282
|
-
("string_another_name", "dummy"),
|
|
283
|
-
])
|
|
284
|
-
def test_String_constructor(name, start):
|
|
285
|
-
r = String(name, start)
|
|
286
|
-
|
|
287
|
-
assert r.start == start
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
@pytest.mark.parametrize("name,start", [
|
|
291
|
-
("string_name", None),
|
|
292
|
-
("string_another_name", "dummy"),
|
|
293
|
-
])
|
|
294
|
-
def test_String_to_xml(name, start):
|
|
295
|
-
r = String(name, start)
|
|
296
|
-
xml = r.to_xml()
|
|
297
|
-
if start is not None:
|
|
298
|
-
start_elements = xml.findall('.//Start')
|
|
299
|
-
assert len(start_elements) == 1
|
|
300
|
-
assert start_elements[0].attrib['value'] == str(start)
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
@pytest.mark.requirements("numpy")
|
|
304
|
-
@pytest.mark.parametrize("name,start,dims", [
|
|
305
|
-
("array1", [1.,2.,3.,4.], [4]),
|
|
306
|
-
("array2", [1.,2.,3.,4.], [2, 2])
|
|
307
|
-
])
|
|
308
|
-
def test_array_to_xml(name, start, dims):
|
|
309
|
-
r = Float64(name, start, dimensions=[Dimension(start=val) for val in dims])
|
|
310
|
-
xml = r.to_xml()
|
|
311
|
-
if start is not None:
|
|
312
|
-
assert xml.attrib['start'] == " ".join([f"{val:.16g}" for val in flatten(start)])
|
|
313
|
-
if dims is not None:
|
|
314
|
-
xml_dims = xml.findall('.//Dimension')
|
|
315
|
-
assert len(xml_dims) == len(dims)
|
|
316
|
-
assert [xml_dim.attrib['start'] for xml_dim in xml_dims] == dims
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
@pytest.mark.requirements("numpy")
|
|
320
|
-
@pytest.mark.parametrize("name,start,dims", [
|
|
321
|
-
("array1", [1.,2.,3.,4.], [4]),
|
|
322
|
-
("array2", [1.,2.,3.,4.], [2, 2]),
|
|
323
|
-
("array3", [1.,2.,3.,4.,5.,6.,7.,8.], [2, 2, 2])
|
|
324
|
-
])
|
|
325
|
-
def test_array_output_to_xml(name, start, dims):
|
|
326
|
-
import numpy as np
|
|
327
|
-
start = np.reshape(start, newshape=dims)
|
|
328
|
-
r = Float64(name, start, dimensions=[Dimension(start=val) for val in dims], causality=Fmi3Causality.output)
|
|
329
|
-
xml = r.to_xml()
|
|
330
|
-
if start is not None:
|
|
331
|
-
assert xml.attrib['start'] == " ".join([f"{val:.16g}" for val in flatten(start)])
|
|
332
|
-
if dims is not None:
|
|
333
|
-
xml_dims = xml.findall('.//Dimension')
|
|
334
|
-
assert len(xml_dims) == len(dims)
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from random import randint
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
import ctypes
|
|
6
|
+
|
|
7
|
+
from xml.etree import ElementTree
|
|
8
|
+
|
|
9
|
+
from pythonfmu3 import Fmi3Slave
|
|
10
|
+
from pythonfmu3.enums import Fmi3Causality, Fmi3Initial, Fmi3Variability
|
|
11
|
+
from pythonfmu3.variables import flatten, Boolean, Int32, UInt64, Float64, ModelVariable, String, Dimension
|
|
12
|
+
|
|
13
|
+
from .utils import PY2FMI, UInt64ValType
|
|
14
|
+
|
|
15
|
+
MODEL_VARIABLE_ATTRIBUTES = ["name", "valueReference", "description", "causality", "variability", "initial"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_ModelVariable_reference_set_once_only():
|
|
19
|
+
v = ModelVariable('variable')
|
|
20
|
+
v.value_reference = 22
|
|
21
|
+
|
|
22
|
+
with pytest.raises(RuntimeError):
|
|
23
|
+
v.value_reference = 33
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.mark.parametrize("causality", list(Fmi3Causality) + [None])
|
|
27
|
+
@pytest.mark.parametrize("initial", list(Fmi3Initial) + [None])
|
|
28
|
+
@pytest.mark.parametrize("variability", list(Fmi3Variability) + [None])
|
|
29
|
+
@pytest.mark.parametrize("name, description", [
|
|
30
|
+
("var", None),
|
|
31
|
+
("var", "description of var"),
|
|
32
|
+
])
|
|
33
|
+
def test_ModelVariable_constructor(causality, initial, variability, name, description):
|
|
34
|
+
var = ModelVariable(name, causality, description, initial, variability)
|
|
35
|
+
|
|
36
|
+
assert var.name == name
|
|
37
|
+
assert var.value_reference is None
|
|
38
|
+
assert var.causality == causality
|
|
39
|
+
assert var.description == description
|
|
40
|
+
assert var.initial == initial
|
|
41
|
+
assert var.variability == variability
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@pytest.mark.parametrize("fmi_type,value", [
|
|
45
|
+
(Boolean, False),
|
|
46
|
+
(Int32, 22),
|
|
47
|
+
(UInt64, UInt64ValType(23)),
|
|
48
|
+
(Float64, 2./3.),
|
|
49
|
+
(String, "hello_world"),
|
|
50
|
+
])
|
|
51
|
+
def test_ModelVariable_getter(fmi_type, value):
|
|
52
|
+
|
|
53
|
+
class Slave(Fmi3Slave):
|
|
54
|
+
|
|
55
|
+
def __init__(self, **kwargs):
|
|
56
|
+
super().__init__(**kwargs)
|
|
57
|
+
self.var = [value]
|
|
58
|
+
self.register_variable(PY2FMI[type(value)]("var", getter=lambda: self.var[0]))
|
|
59
|
+
|
|
60
|
+
def do_step(self, t, dt):
|
|
61
|
+
return True
|
|
62
|
+
|
|
63
|
+
fmi_type_name = fmi_type.__qualname__.lower()
|
|
64
|
+
|
|
65
|
+
slave = Slave(instance_name="slaveInstance")
|
|
66
|
+
assert [getattr(val, "value", val) for val in getattr(slave, f"get_{fmi_type_name}")([0])] == [value]
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@pytest.mark.parametrize("fmi_type,value", [
|
|
70
|
+
(Boolean, False),
|
|
71
|
+
(Int32, 22),
|
|
72
|
+
(UInt64, UInt64ValType(23)),
|
|
73
|
+
(Float64, 2./3.),
|
|
74
|
+
(String, "hello_world")
|
|
75
|
+
])
|
|
76
|
+
def test_ModelVariable_setter(fmi_type, value):
|
|
77
|
+
|
|
78
|
+
class Slave(Fmi3Slave):
|
|
79
|
+
|
|
80
|
+
def __init__(self, **kwargs):
|
|
81
|
+
super().__init__(**kwargs)
|
|
82
|
+
self.var = [None]
|
|
83
|
+
self.register_variable(
|
|
84
|
+
PY2FMI[type(value)](
|
|
85
|
+
"var",
|
|
86
|
+
getter=lambda: self.var[0],
|
|
87
|
+
setter=lambda v: self.var.__setitem__(0, v)
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
def do_step(self, t, dt):
|
|
92
|
+
return True
|
|
93
|
+
|
|
94
|
+
slave = Slave(instance_name="slaveInstance")
|
|
95
|
+
fmi_type_name = fmi_type.__qualname__.lower()
|
|
96
|
+
|
|
97
|
+
set_method = getattr(slave, f"set_{fmi_type_name}")
|
|
98
|
+
set_method([0, ], [value, ])
|
|
99
|
+
assert [getattr(val, "value", val) for val in getattr(slave, f"get_{fmi_type_name}")([0])] == [value]
|
|
100
|
+
|
|
101
|
+
@pytest.mark.requirements("numpy")
|
|
102
|
+
@pytest.mark.parametrize("fmi_type,value,dims", [
|
|
103
|
+
(Float64, [1.,2.,3.,4.], [4]),
|
|
104
|
+
(Float64, [1.,2.,3.,4.], [2, 2]),
|
|
105
|
+
])
|
|
106
|
+
def test_ModelVariable_getter_array(fmi_type, value, dims):
|
|
107
|
+
|
|
108
|
+
class Slave(Fmi3Slave):
|
|
109
|
+
|
|
110
|
+
def __init__(self, **kwargs):
|
|
111
|
+
super().__init__(**kwargs)
|
|
112
|
+
self.var = value
|
|
113
|
+
dimensions = [Dimension(start=val) for val in dims]
|
|
114
|
+
self.register_variable(PY2FMI[type(value[0])]("var", getter=lambda: self.var, dimensions=dimensions))
|
|
115
|
+
|
|
116
|
+
def do_step(self, t, dt):
|
|
117
|
+
return True
|
|
118
|
+
|
|
119
|
+
fmi_type_name = fmi_type.__qualname__.lower()
|
|
120
|
+
|
|
121
|
+
slave = Slave(instance_name="slaveInstance")
|
|
122
|
+
assert [getattr(val, "value", val) for val in getattr(slave, f"get_{fmi_type_name}")([0])] == value
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@pytest.mark.requirements("numpy")
|
|
126
|
+
@pytest.mark.parametrize("fmi_type,value,dims", [
|
|
127
|
+
(Float64, [1.,2.,3.,4.], [4]),
|
|
128
|
+
(Float64, [1.,2.,3.,4.], [2, 2]),
|
|
129
|
+
])
|
|
130
|
+
def test_ModelVariable_setter_array(fmi_type, value, dims):
|
|
131
|
+
|
|
132
|
+
class Slave(Fmi3Slave):
|
|
133
|
+
|
|
134
|
+
def __init__(self, **kwargs):
|
|
135
|
+
super().__init__(**kwargs)
|
|
136
|
+
self.var = [None]*len(value)
|
|
137
|
+
dimensions = [Dimension(start=val) for val in dims]
|
|
138
|
+
self.register_variable(
|
|
139
|
+
PY2FMI[type(value[0])](
|
|
140
|
+
"var",
|
|
141
|
+
getter=lambda: self.var,
|
|
142
|
+
setter=lambda v: setattr(self, 'var', v),
|
|
143
|
+
dimensions=dimensions
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
def do_step(self, t, dt):
|
|
148
|
+
return True
|
|
149
|
+
|
|
150
|
+
slave = Slave(instance_name="slaveInstance")
|
|
151
|
+
fmi_type_name = fmi_type.__qualname__.lower()
|
|
152
|
+
|
|
153
|
+
set_method = getattr(slave, f"set_{fmi_type_name}")
|
|
154
|
+
set_method([0, ], value)
|
|
155
|
+
assert [getattr(val, "value", val) for val in getattr(slave, f"get_{fmi_type_name}")([0])] == value
|
|
156
|
+
|
|
157
|
+
@pytest.mark.parametrize("causality", list(Fmi3Causality) + [None])
|
|
158
|
+
@pytest.mark.parametrize("initial", list(Fmi3Initial) + [None])
|
|
159
|
+
@pytest.mark.parametrize("variability", list(Fmi3Variability) + [None])
|
|
160
|
+
@pytest.mark.parametrize("name, description", [
|
|
161
|
+
("var", None),
|
|
162
|
+
("var", "description of var"),
|
|
163
|
+
])
|
|
164
|
+
def test_ModelVariable_to_xml(causality, initial, variability, name, description):
|
|
165
|
+
var = ModelVariable(name, causality, description, initial, variability)
|
|
166
|
+
valueReference = randint(0, 25000)
|
|
167
|
+
var.value_reference = valueReference
|
|
168
|
+
|
|
169
|
+
node = var.to_xml()
|
|
170
|
+
assert node.tag == None
|
|
171
|
+
args = locals()
|
|
172
|
+
for attr in MODEL_VARIABLE_ATTRIBUTES:
|
|
173
|
+
value = args[attr]
|
|
174
|
+
if value is not None:
|
|
175
|
+
if isinstance(value, Enum):
|
|
176
|
+
assert node.attrib[attr] == value.name
|
|
177
|
+
else:
|
|
178
|
+
assert node.attrib[attr] == str(value)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
@pytest.mark.parametrize("var_type, value", [
|
|
182
|
+
(Boolean, True),
|
|
183
|
+
(Int32, 23),
|
|
184
|
+
(UInt64, UInt64ValType(23)),
|
|
185
|
+
(Float64, 15.),
|
|
186
|
+
(String, "hello")])
|
|
187
|
+
@pytest.mark.parametrize("causality", list(Fmi3Causality) + [None])
|
|
188
|
+
@pytest.mark.parametrize("initial", list(Fmi3Initial) + [None])
|
|
189
|
+
@pytest.mark.parametrize("variability", list(Fmi3Variability) + [None])
|
|
190
|
+
def test_ModelVariable_start(var_type, value, causality, initial, variability):
|
|
191
|
+
var_obj = var_type("var", causality=causality, description="a variable", initial=initial, variability=variability)
|
|
192
|
+
|
|
193
|
+
class PySlave(Fmi3Slave):
|
|
194
|
+
|
|
195
|
+
def __init__(self, **kwargs):
|
|
196
|
+
super().__init__(**kwargs)
|
|
197
|
+
setattr(self, "var", value)
|
|
198
|
+
self.register_variable(var_obj)
|
|
199
|
+
|
|
200
|
+
def do_step(self, current_time: float, step_size: float):
|
|
201
|
+
return True
|
|
202
|
+
|
|
203
|
+
slave = PySlave(instance_name="testInstance")
|
|
204
|
+
|
|
205
|
+
xml = slave.to_xml()
|
|
206
|
+
var_node = xml.find(f".//{var_obj._type}[@name='var']")
|
|
207
|
+
|
|
208
|
+
assert var_node is not None
|
|
209
|
+
|
|
210
|
+
if ModelVariable.requires_start(var_obj):
|
|
211
|
+
assert var_obj.start == value
|
|
212
|
+
else:
|
|
213
|
+
assert var_obj.start is None
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
@pytest.mark.parametrize("name,start", [
|
|
217
|
+
("boolean_name", None),
|
|
218
|
+
("boolean_another_name", False),
|
|
219
|
+
])
|
|
220
|
+
def test_Boolean_constructor(name, start):
|
|
221
|
+
r = Boolean(name, start)
|
|
222
|
+
|
|
223
|
+
assert r.start == start
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
@pytest.mark.parametrize("name,start", [
|
|
227
|
+
("boolean_name", None),
|
|
228
|
+
("boolean_another_name", True),
|
|
229
|
+
("boolean_yet_another", False),
|
|
230
|
+
])
|
|
231
|
+
def test_Boolean_to_xml(name, start):
|
|
232
|
+
r = Boolean(name, start)
|
|
233
|
+
xml = r.to_xml()
|
|
234
|
+
if start is not None:
|
|
235
|
+
assert xml.attrib['start'] == str(start).lower()
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
@pytest.mark.parametrize("name,start", [
|
|
239
|
+
("integer_name", None),
|
|
240
|
+
("integer_another_name", 42),
|
|
241
|
+
])
|
|
242
|
+
def test_Integer_constructor(name, start):
|
|
243
|
+
r = Int32(name, start)
|
|
244
|
+
|
|
245
|
+
assert r.start == start
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
@pytest.mark.parametrize("name,start", [
|
|
249
|
+
("integer_name", None),
|
|
250
|
+
("integer_another_name", 42),
|
|
251
|
+
])
|
|
252
|
+
def test_Integer_to_xml(name, start):
|
|
253
|
+
r = Int32(name, start)
|
|
254
|
+
xml = r.to_xml()
|
|
255
|
+
if start is not None:
|
|
256
|
+
assert xml.attrib['start'] == str(start)
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
@pytest.mark.parametrize("name,start", [
|
|
260
|
+
("real_name", None),
|
|
261
|
+
("real_another_name", 22.),
|
|
262
|
+
])
|
|
263
|
+
def test_Real_constructor(name, start):
|
|
264
|
+
r = Float64(name, start)
|
|
265
|
+
|
|
266
|
+
assert r.start == start
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
@pytest.mark.parametrize("name,start", [
|
|
270
|
+
("real_name", None),
|
|
271
|
+
("real_another_name", 22.),
|
|
272
|
+
])
|
|
273
|
+
def test_Real_to_xml(name, start):
|
|
274
|
+
r = Float64(name, start)
|
|
275
|
+
xml = r.to_xml()
|
|
276
|
+
if start is not None:
|
|
277
|
+
assert xml.attrib['start'] == f"{start:.16g}"
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
@pytest.mark.parametrize("name,start", [
|
|
281
|
+
("string_name", None),
|
|
282
|
+
("string_another_name", "dummy"),
|
|
283
|
+
])
|
|
284
|
+
def test_String_constructor(name, start):
|
|
285
|
+
r = String(name, start)
|
|
286
|
+
|
|
287
|
+
assert r.start == start
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
@pytest.mark.parametrize("name,start", [
|
|
291
|
+
("string_name", None),
|
|
292
|
+
("string_another_name", "dummy"),
|
|
293
|
+
])
|
|
294
|
+
def test_String_to_xml(name, start):
|
|
295
|
+
r = String(name, start)
|
|
296
|
+
xml = r.to_xml()
|
|
297
|
+
if start is not None:
|
|
298
|
+
start_elements = xml.findall('.//Start')
|
|
299
|
+
assert len(start_elements) == 1
|
|
300
|
+
assert start_elements[0].attrib['value'] == str(start)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
@pytest.mark.requirements("numpy")
|
|
304
|
+
@pytest.mark.parametrize("name,start,dims", [
|
|
305
|
+
("array1", [1.,2.,3.,4.], [4]),
|
|
306
|
+
("array2", [1.,2.,3.,4.], [2, 2])
|
|
307
|
+
])
|
|
308
|
+
def test_array_to_xml(name, start, dims):
|
|
309
|
+
r = Float64(name, start, dimensions=[Dimension(start=val) for val in dims])
|
|
310
|
+
xml = r.to_xml()
|
|
311
|
+
if start is not None:
|
|
312
|
+
assert xml.attrib['start'] == " ".join([f"{val:.16g}" for val in flatten(start)])
|
|
313
|
+
if dims is not None:
|
|
314
|
+
xml_dims = xml.findall('.//Dimension')
|
|
315
|
+
assert len(xml_dims) == len(dims)
|
|
316
|
+
assert [xml_dim.attrib['start'] for xml_dim in xml_dims] == dims
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
@pytest.mark.requirements("numpy")
|
|
320
|
+
@pytest.mark.parametrize("name,start,dims", [
|
|
321
|
+
("array1", [1.,2.,3.,4.], [4]),
|
|
322
|
+
("array2", [1.,2.,3.,4.], [2, 2]),
|
|
323
|
+
("array3", [1.,2.,3.,4.,5.,6.,7.,8.], [2, 2, 2])
|
|
324
|
+
])
|
|
325
|
+
def test_array_output_to_xml(name, start, dims):
|
|
326
|
+
import numpy as np
|
|
327
|
+
start = np.reshape(start, newshape=dims)
|
|
328
|
+
r = Float64(name, start, dimensions=[Dimension(start=val) for val in dims], causality=Fmi3Causality.output)
|
|
329
|
+
xml = r.to_xml()
|
|
330
|
+
if start is not None:
|
|
331
|
+
assert xml.attrib['start'] == " ".join([f"{val:.16g}" for val in flatten(start)])
|
|
332
|
+
if dims is not None:
|
|
333
|
+
xml_dims = xml.findall('.//Dimension')
|
|
334
|
+
assert len(xml_dims) == len(dims)
|
|
335
335
|
assert [xml_dim.attrib['start'] for xml_dim in xml_dims] == dims
|