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
pythonfmu3/variables.py
CHANGED
|
@@ -1,400 +1,400 @@
|
|
|
1
|
-
"""Classes describing interface variables."""
|
|
2
|
-
from abc import ABC
|
|
3
|
-
from enum import Enum
|
|
4
|
-
import importlib
|
|
5
|
-
from typing import Any, Optional, List
|
|
6
|
-
from xml.etree.ElementTree import Element, SubElement
|
|
7
|
-
from collections.abc import Iterable
|
|
8
|
-
from collections import ChainMap
|
|
9
|
-
from functools import reduce
|
|
10
|
-
|
|
11
|
-
from .enums import Fmi3Causality, Fmi3Initial, Fmi3Variability
|
|
12
|
-
|
|
13
|
-
MAX_LENGTH = 1000
|
|
14
|
-
|
|
15
|
-
def flatten(lst):
|
|
16
|
-
for item in lst:
|
|
17
|
-
if isinstance(item, Iterable) and not isinstance(item, (str, bytes)):
|
|
18
|
-
yield from flatten(item)
|
|
19
|
-
else:
|
|
20
|
-
yield item
|
|
21
|
-
|
|
22
|
-
def check_numpy():
|
|
23
|
-
try:
|
|
24
|
-
importlib.import_module('numpy')
|
|
25
|
-
except ModuleNotFoundError:
|
|
26
|
-
raise ModuleNotFoundError("Numpy is not installed, it is required for Array support")
|
|
27
|
-
|
|
28
|
-
class ModelVariable(ABC):
|
|
29
|
-
"""Abstract FMI model variable definition.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
name (str): Variable name
|
|
33
|
-
causality (:obj:`Fmi3Causality`, optional): Variable causality
|
|
34
|
-
description (str, optional): Variable description
|
|
35
|
-
initial (:obj:`Fmi3Initial`, optional): Variable initial status
|
|
36
|
-
variability (:obj:`Fmi3Variability`, optional): Variable variability
|
|
37
|
-
"""
|
|
38
|
-
def __init__(
|
|
39
|
-
self,
|
|
40
|
-
name: str,
|
|
41
|
-
causality: Optional[Fmi3Causality] = None,
|
|
42
|
-
description: Optional[str] = None,
|
|
43
|
-
initial: Optional[Fmi3Initial] = None,
|
|
44
|
-
variability: Optional[Fmi3Variability] = None,
|
|
45
|
-
declared_type: Optional[str] = None,
|
|
46
|
-
getter: Any = None,
|
|
47
|
-
setter: Any = None
|
|
48
|
-
):
|
|
49
|
-
self.getter = getter
|
|
50
|
-
self.setter = setter
|
|
51
|
-
self._type = None
|
|
52
|
-
self.local_name = name.split(".")[-1]
|
|
53
|
-
self.__attrs = {
|
|
54
|
-
"name": name,
|
|
55
|
-
"valueReference": None,
|
|
56
|
-
"description": description,
|
|
57
|
-
"causality": causality,
|
|
58
|
-
"variability": variability,
|
|
59
|
-
"initial": initial,
|
|
60
|
-
"declaredType": declared_type,
|
|
61
|
-
# 'canHandleMultipleSetPerTimeInstant': # Only for ME
|
|
62
|
-
}
|
|
63
|
-
self._extras = {}
|
|
64
|
-
|
|
65
|
-
@property
|
|
66
|
-
def causality(self) -> Optional[Fmi3Causality]:
|
|
67
|
-
""":obj:`Fmi3Causality` or None: Variable causality - None if not set"""
|
|
68
|
-
return self.__attrs["causality"]
|
|
69
|
-
|
|
70
|
-
@property
|
|
71
|
-
def description(self) -> Optional[str]:
|
|
72
|
-
"""str or None: Variable description - None if not set"""
|
|
73
|
-
return self.__attrs["description"]
|
|
74
|
-
|
|
75
|
-
@property
|
|
76
|
-
def initial(self) -> Optional[Fmi3Initial]:
|
|
77
|
-
""":obj:`Fmi3Initial` or None: Variable initial status - None if not set"""
|
|
78
|
-
return self.__attrs["initial"]
|
|
79
|
-
|
|
80
|
-
@property
|
|
81
|
-
def name(self) -> str:
|
|
82
|
-
"""str: Variable name"""
|
|
83
|
-
return self.__attrs["name"]
|
|
84
|
-
|
|
85
|
-
@property
|
|
86
|
-
def value_reference(self) -> int:
|
|
87
|
-
"""int: Variable reference index"""
|
|
88
|
-
return self.__attrs["valueReference"]
|
|
89
|
-
|
|
90
|
-
@value_reference.setter
|
|
91
|
-
def value_reference(self, value: int):
|
|
92
|
-
if self.__attrs["valueReference"] is not None:
|
|
93
|
-
raise RuntimeError("Value reference already set.")
|
|
94
|
-
self.__attrs["valueReference"] = value
|
|
95
|
-
|
|
96
|
-
@property
|
|
97
|
-
def declared_type(self) -> str:
|
|
98
|
-
"""str: declared type"""
|
|
99
|
-
return self.__attrs["declaredType"]
|
|
100
|
-
|
|
101
|
-
@declared_type.setter
|
|
102
|
-
def declared_type(self, value: str):
|
|
103
|
-
if self.__attrs["declaredType"] is not None:
|
|
104
|
-
raise RuntimeError("Declared type already set.")
|
|
105
|
-
self.__attrs["declaredType"] = value
|
|
106
|
-
|
|
107
|
-
@property
|
|
108
|
-
def variability(self) -> Optional[Fmi3Variability]:
|
|
109
|
-
""":obj:`Fmi3Variability` or None: Variable variability - None if not set"""
|
|
110
|
-
return self.__attrs["variability"]
|
|
111
|
-
|
|
112
|
-
@staticmethod
|
|
113
|
-
def requires_start(v: 'ModelVariable') -> bool:
|
|
114
|
-
"""Test if a variable requires a start attribute
|
|
115
|
-
|
|
116
|
-
Returns:
|
|
117
|
-
True if successful, False otherwise
|
|
118
|
-
"""
|
|
119
|
-
return (
|
|
120
|
-
v.initial == Fmi3Initial.exact
|
|
121
|
-
or v.initial == Fmi3Initial.approx
|
|
122
|
-
or v.causality == Fmi3Causality.input
|
|
123
|
-
or v.causality == Fmi3Causality.parameter
|
|
124
|
-
or v.variability == Fmi3Variability.constant
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
def to_xml(self) -> Element:
|
|
128
|
-
"""Convert the variable to XML node.
|
|
129
|
-
|
|
130
|
-
Returns
|
|
131
|
-
xml.etree.ElementTree.Element: XML node
|
|
132
|
-
"""
|
|
133
|
-
attrib = dict()
|
|
134
|
-
for key, value in ChainMap(self._extras, self.__attrs).items():
|
|
135
|
-
if value is not None:
|
|
136
|
-
attrib[key] = str(value.name if isinstance(value, Enum) else value)
|
|
137
|
-
return Element(self._type, attrib)
|
|
138
|
-
|
|
139
|
-
def __repr__(self) -> str:
|
|
140
|
-
return f"{self.__class__.__name__}" \
|
|
141
|
-
f"(name={self.name}, " \
|
|
142
|
-
f"causality={self.causality}, " \
|
|
143
|
-
f"variability={self.variability})"
|
|
144
|
-
|
|
145
|
-
class Start(object):
|
|
146
|
-
def __init__(self, startValue):
|
|
147
|
-
self.value = startValue
|
|
148
|
-
|
|
149
|
-
def to_xml(self) -> Element:
|
|
150
|
-
attrib = dict()
|
|
151
|
-
attrib["value"] = self.value
|
|
152
|
-
return Element("Start", attrib)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
class Dimension(object):
|
|
156
|
-
def __init__(self, start: str = "", valueReference: str = ""):
|
|
157
|
-
if start and valueReference and any((start, valueReference)):
|
|
158
|
-
raise RuntimeError("start and valueReference attributes are mutally exclusive for Dimension element")
|
|
159
|
-
|
|
160
|
-
self.start = start
|
|
161
|
-
self.value_reference = valueReference
|
|
162
|
-
|
|
163
|
-
def size(self, vars : List[ModelVariable]):
|
|
164
|
-
if self.start:
|
|
165
|
-
return self.start
|
|
166
|
-
else:
|
|
167
|
-
result = next((value for vr, value in vars.items() if vr == int(self.value_reference)), None)
|
|
168
|
-
return result.getter()
|
|
169
|
-
|
|
170
|
-
def to_xml(self) -> Element:
|
|
171
|
-
attrib = dict()
|
|
172
|
-
|
|
173
|
-
if self.start:
|
|
174
|
-
attrib["start"] = self.start
|
|
175
|
-
else:
|
|
176
|
-
attrib['valueReference'] = self.value_reference
|
|
177
|
-
ele = Element("Dimension", attrib)
|
|
178
|
-
return ele
|
|
179
|
-
|
|
180
|
-
class Float64(ModelVariable):
|
|
181
|
-
def __init__(self, name: str, start: Optional[Any] = None, derivative: Optional[Any] = None, dimensions: List[Dimension] = [], unit: Optional[str] = None, **kwargs):
|
|
182
|
-
super().__init__(name, **kwargs)
|
|
183
|
-
self.__attrs = {"start": start, "derivative": derivative}
|
|
184
|
-
self._type = "Float64"
|
|
185
|
-
self._unit = unit
|
|
186
|
-
if dimensions:
|
|
187
|
-
check_numpy()
|
|
188
|
-
self.__dimensions = dimensions
|
|
189
|
-
|
|
190
|
-
@property
|
|
191
|
-
def start(self) -> Optional[Any]:
|
|
192
|
-
return self.__attrs["start"]
|
|
193
|
-
|
|
194
|
-
@start.setter
|
|
195
|
-
def start(self, value: float):
|
|
196
|
-
self.__attrs["start"] = value
|
|
197
|
-
|
|
198
|
-
@property
|
|
199
|
-
def unit(self) -> Optional[Any]:
|
|
200
|
-
return self._unit
|
|
201
|
-
|
|
202
|
-
@unit.setter
|
|
203
|
-
def unit(self, value: str):
|
|
204
|
-
self._unit = value
|
|
205
|
-
|
|
206
|
-
@property
|
|
207
|
-
def derivative(self):
|
|
208
|
-
return self.__attrs["derivative"]
|
|
209
|
-
|
|
210
|
-
@property
|
|
211
|
-
def dimensions(self) -> List[Dimension]:
|
|
212
|
-
return self.__dimensions
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
def to_xml(self) -> Element:
|
|
216
|
-
attrib = dict()
|
|
217
|
-
for key, value in self.__attrs.items():
|
|
218
|
-
if value is not None:
|
|
219
|
-
# In order to not loose precision, a number of this type should be
|
|
220
|
-
# stored on an XML file with at least 16 significant digits
|
|
221
|
-
output = ""
|
|
222
|
-
if len(self.dimensions) > 0:
|
|
223
|
-
output = " ".join([f"{val:.16g}" for val in flatten(value)])
|
|
224
|
-
if len(output) > MAX_LENGTH:
|
|
225
|
-
output = output[0]
|
|
226
|
-
else:
|
|
227
|
-
output = f"{value:.16g}"
|
|
228
|
-
attrib[key] = output
|
|
229
|
-
|
|
230
|
-
if self.unit:
|
|
231
|
-
attrib["unit"] = self.unit
|
|
232
|
-
|
|
233
|
-
self._extras = attrib
|
|
234
|
-
parent = super().to_xml()
|
|
235
|
-
|
|
236
|
-
for dimension in self.__dimensions:
|
|
237
|
-
parent.append(dimension.to_xml())
|
|
238
|
-
|
|
239
|
-
return parent
|
|
240
|
-
|
|
241
|
-
def size(self, vars):
|
|
242
|
-
return reduce(lambda x, dim: x * int(dim.size(vars)), self.__dimensions, 1)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
class Int32(ModelVariable):
|
|
246
|
-
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
247
|
-
super().__init__(name, **kwargs)
|
|
248
|
-
self.__attrs = {"start": start}
|
|
249
|
-
self._type = "Int32";
|
|
250
|
-
|
|
251
|
-
@property
|
|
252
|
-
def start(self) -> Optional[Any]:
|
|
253
|
-
return self.__attrs["start"]
|
|
254
|
-
|
|
255
|
-
@start.setter
|
|
256
|
-
def start(self, value: int):
|
|
257
|
-
self.__attrs["start"] = value
|
|
258
|
-
|
|
259
|
-
def to_xml(self) -> Element:
|
|
260
|
-
attrib = dict()
|
|
261
|
-
for key, value in self.__attrs.items():
|
|
262
|
-
if value is not None:
|
|
263
|
-
attrib[key] = str(value)
|
|
264
|
-
self._extras = attrib
|
|
265
|
-
parent = super().to_xml()
|
|
266
|
-
|
|
267
|
-
return parent
|
|
268
|
-
|
|
269
|
-
class Int64(ModelVariable):
|
|
270
|
-
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
271
|
-
super().__init__(name, **kwargs)
|
|
272
|
-
self.__attrs = {"start": start}
|
|
273
|
-
self._type = "Int64";
|
|
274
|
-
|
|
275
|
-
@property
|
|
276
|
-
def start(self) -> Optional[Any]:
|
|
277
|
-
return self.__attrs["start"]
|
|
278
|
-
|
|
279
|
-
@start.setter
|
|
280
|
-
def start(self, value: int):
|
|
281
|
-
self.__attrs["start"] = value
|
|
282
|
-
|
|
283
|
-
def to_xml(self) -> Element:
|
|
284
|
-
attrib = dict()
|
|
285
|
-
for key, value in self.__attrs.items():
|
|
286
|
-
if value is not None:
|
|
287
|
-
attrib[key] = str(value)
|
|
288
|
-
self._extras = attrib
|
|
289
|
-
parent = super().to_xml()
|
|
290
|
-
|
|
291
|
-
return parent
|
|
292
|
-
|
|
293
|
-
class UInt64(ModelVariable):
|
|
294
|
-
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
295
|
-
super().__init__(name, **kwargs)
|
|
296
|
-
self.__attrs = {"start": start}
|
|
297
|
-
self._type = "UInt64";
|
|
298
|
-
|
|
299
|
-
@property
|
|
300
|
-
def start(self) -> Optional[Any]:
|
|
301
|
-
return self.__attrs["start"]
|
|
302
|
-
|
|
303
|
-
@start.setter
|
|
304
|
-
def start(self, value: int):
|
|
305
|
-
self.__attrs["start"] = value
|
|
306
|
-
|
|
307
|
-
def to_xml(self) -> Element:
|
|
308
|
-
attrib = dict()
|
|
309
|
-
for key, value in self.__attrs.items():
|
|
310
|
-
if value is not None:
|
|
311
|
-
attrib[key] = str(value)
|
|
312
|
-
self._extras = attrib
|
|
313
|
-
parent = super().to_xml()
|
|
314
|
-
|
|
315
|
-
return parent
|
|
316
|
-
|
|
317
|
-
class Boolean(ModelVariable):
|
|
318
|
-
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
319
|
-
super().__init__(name, **kwargs)
|
|
320
|
-
self.__attrs = {"start": start}
|
|
321
|
-
self._type = "Boolean"
|
|
322
|
-
|
|
323
|
-
@property
|
|
324
|
-
def start(self) -> Optional[Any]:
|
|
325
|
-
return self.__attrs["start"]
|
|
326
|
-
|
|
327
|
-
@start.setter
|
|
328
|
-
def start(self, value: float):
|
|
329
|
-
self.__attrs["start"] = value
|
|
330
|
-
|
|
331
|
-
def to_xml(self) -> Element:
|
|
332
|
-
attrib = dict()
|
|
333
|
-
for key, value in self.__attrs.items():
|
|
334
|
-
if value is not None:
|
|
335
|
-
attrib[key] = str(value).lower()
|
|
336
|
-
self._extras = attrib
|
|
337
|
-
parent = super().to_xml()
|
|
338
|
-
|
|
339
|
-
return parent
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
class String(ModelVariable):
|
|
343
|
-
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
344
|
-
super().__init__(name, **kwargs)
|
|
345
|
-
self.__attrs = dict()
|
|
346
|
-
self._type = "String"
|
|
347
|
-
self._start = Start(start)
|
|
348
|
-
|
|
349
|
-
@property
|
|
350
|
-
def start(self) -> Optional[Any]:
|
|
351
|
-
return self._start.value
|
|
352
|
-
|
|
353
|
-
@start.setter
|
|
354
|
-
def start(self, value: float):
|
|
355
|
-
self._start.value = value
|
|
356
|
-
|
|
357
|
-
def to_xml(self) -> Element:
|
|
358
|
-
attrib = dict()
|
|
359
|
-
for key, value in self.__attrs.items():
|
|
360
|
-
if value is not None:
|
|
361
|
-
attrib[key] = str(value)
|
|
362
|
-
self._extras = attrib
|
|
363
|
-
parent = super().to_xml()
|
|
364
|
-
|
|
365
|
-
if self.start is not None:
|
|
366
|
-
parent.append(self._start.to_xml())
|
|
367
|
-
|
|
368
|
-
return parent
|
|
369
|
-
|
|
370
|
-
class Enumeration(ModelVariable):
|
|
371
|
-
def __init__(self, name: str, start: Optional[Any] = None, declared_type: Optional[Any] = None, **kwargs):
|
|
372
|
-
super().__init__(name, **kwargs)
|
|
373
|
-
self.__attrs = {"start": start, "declaredType": declared_type}
|
|
374
|
-
self._type = "Enumeration"
|
|
375
|
-
|
|
376
|
-
@property
|
|
377
|
-
def start(self) -> Optional[Any]:
|
|
378
|
-
return self.__attrs["start"]
|
|
379
|
-
|
|
380
|
-
@start.setter
|
|
381
|
-
def start(self, value: float):
|
|
382
|
-
self.__attrs["start"] = value
|
|
383
|
-
|
|
384
|
-
@property
|
|
385
|
-
def declared_type(self) -> Optional[Any]:
|
|
386
|
-
return self.__attrs["declaredType"]
|
|
387
|
-
|
|
388
|
-
@declared_type.setter
|
|
389
|
-
def declared_type(self, value: float):
|
|
390
|
-
self.__attrs["declaredType"] = value
|
|
391
|
-
|
|
392
|
-
def to_xml(self) -> Element:
|
|
393
|
-
attrib = dict()
|
|
394
|
-
for key, value in self.__attrs.items():
|
|
395
|
-
if value is not None:
|
|
396
|
-
attrib[key] = str(value)
|
|
397
|
-
self._extras = attrib
|
|
398
|
-
parent = super().to_xml()
|
|
399
|
-
|
|
400
|
-
return parent
|
|
1
|
+
"""Classes describing interface variables."""
|
|
2
|
+
from abc import ABC
|
|
3
|
+
from enum import Enum
|
|
4
|
+
import importlib
|
|
5
|
+
from typing import Any, Optional, List
|
|
6
|
+
from xml.etree.ElementTree import Element, SubElement
|
|
7
|
+
from collections.abc import Iterable
|
|
8
|
+
from collections import ChainMap
|
|
9
|
+
from functools import reduce
|
|
10
|
+
|
|
11
|
+
from .enums import Fmi3Causality, Fmi3Initial, Fmi3Variability
|
|
12
|
+
|
|
13
|
+
MAX_LENGTH = 1000
|
|
14
|
+
|
|
15
|
+
def flatten(lst):
|
|
16
|
+
for item in lst:
|
|
17
|
+
if isinstance(item, Iterable) and not isinstance(item, (str, bytes)):
|
|
18
|
+
yield from flatten(item)
|
|
19
|
+
else:
|
|
20
|
+
yield item
|
|
21
|
+
|
|
22
|
+
def check_numpy():
|
|
23
|
+
try:
|
|
24
|
+
importlib.import_module('numpy')
|
|
25
|
+
except ModuleNotFoundError:
|
|
26
|
+
raise ModuleNotFoundError("Numpy is not installed, it is required for Array support")
|
|
27
|
+
|
|
28
|
+
class ModelVariable(ABC):
|
|
29
|
+
"""Abstract FMI model variable definition.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
name (str): Variable name
|
|
33
|
+
causality (:obj:`Fmi3Causality`, optional): Variable causality
|
|
34
|
+
description (str, optional): Variable description
|
|
35
|
+
initial (:obj:`Fmi3Initial`, optional): Variable initial status
|
|
36
|
+
variability (:obj:`Fmi3Variability`, optional): Variable variability
|
|
37
|
+
"""
|
|
38
|
+
def __init__(
|
|
39
|
+
self,
|
|
40
|
+
name: str,
|
|
41
|
+
causality: Optional[Fmi3Causality] = None,
|
|
42
|
+
description: Optional[str] = None,
|
|
43
|
+
initial: Optional[Fmi3Initial] = None,
|
|
44
|
+
variability: Optional[Fmi3Variability] = None,
|
|
45
|
+
declared_type: Optional[str] = None,
|
|
46
|
+
getter: Any = None,
|
|
47
|
+
setter: Any = None
|
|
48
|
+
):
|
|
49
|
+
self.getter = getter
|
|
50
|
+
self.setter = setter
|
|
51
|
+
self._type = None
|
|
52
|
+
self.local_name = name.split(".")[-1]
|
|
53
|
+
self.__attrs = {
|
|
54
|
+
"name": name,
|
|
55
|
+
"valueReference": None,
|
|
56
|
+
"description": description,
|
|
57
|
+
"causality": causality,
|
|
58
|
+
"variability": variability,
|
|
59
|
+
"initial": initial,
|
|
60
|
+
"declaredType": declared_type,
|
|
61
|
+
# 'canHandleMultipleSetPerTimeInstant': # Only for ME
|
|
62
|
+
}
|
|
63
|
+
self._extras = {}
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def causality(self) -> Optional[Fmi3Causality]:
|
|
67
|
+
""":obj:`Fmi3Causality` or None: Variable causality - None if not set"""
|
|
68
|
+
return self.__attrs["causality"]
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def description(self) -> Optional[str]:
|
|
72
|
+
"""str or None: Variable description - None if not set"""
|
|
73
|
+
return self.__attrs["description"]
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def initial(self) -> Optional[Fmi3Initial]:
|
|
77
|
+
""":obj:`Fmi3Initial` or None: Variable initial status - None if not set"""
|
|
78
|
+
return self.__attrs["initial"]
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def name(self) -> str:
|
|
82
|
+
"""str: Variable name"""
|
|
83
|
+
return self.__attrs["name"]
|
|
84
|
+
|
|
85
|
+
@property
|
|
86
|
+
def value_reference(self) -> int:
|
|
87
|
+
"""int: Variable reference index"""
|
|
88
|
+
return self.__attrs["valueReference"]
|
|
89
|
+
|
|
90
|
+
@value_reference.setter
|
|
91
|
+
def value_reference(self, value: int):
|
|
92
|
+
if self.__attrs["valueReference"] is not None:
|
|
93
|
+
raise RuntimeError("Value reference already set.")
|
|
94
|
+
self.__attrs["valueReference"] = value
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def declared_type(self) -> str:
|
|
98
|
+
"""str: declared type"""
|
|
99
|
+
return self.__attrs["declaredType"]
|
|
100
|
+
|
|
101
|
+
@declared_type.setter
|
|
102
|
+
def declared_type(self, value: str):
|
|
103
|
+
if self.__attrs["declaredType"] is not None:
|
|
104
|
+
raise RuntimeError("Declared type already set.")
|
|
105
|
+
self.__attrs["declaredType"] = value
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def variability(self) -> Optional[Fmi3Variability]:
|
|
109
|
+
""":obj:`Fmi3Variability` or None: Variable variability - None if not set"""
|
|
110
|
+
return self.__attrs["variability"]
|
|
111
|
+
|
|
112
|
+
@staticmethod
|
|
113
|
+
def requires_start(v: 'ModelVariable') -> bool:
|
|
114
|
+
"""Test if a variable requires a start attribute
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
True if successful, False otherwise
|
|
118
|
+
"""
|
|
119
|
+
return (
|
|
120
|
+
v.initial == Fmi3Initial.exact
|
|
121
|
+
or v.initial == Fmi3Initial.approx
|
|
122
|
+
or v.causality == Fmi3Causality.input
|
|
123
|
+
or v.causality == Fmi3Causality.parameter
|
|
124
|
+
or v.variability == Fmi3Variability.constant
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
def to_xml(self) -> Element:
|
|
128
|
+
"""Convert the variable to XML node.
|
|
129
|
+
|
|
130
|
+
Returns
|
|
131
|
+
xml.etree.ElementTree.Element: XML node
|
|
132
|
+
"""
|
|
133
|
+
attrib = dict()
|
|
134
|
+
for key, value in ChainMap(self._extras, self.__attrs).items():
|
|
135
|
+
if value is not None:
|
|
136
|
+
attrib[key] = str(value.name if isinstance(value, Enum) else value)
|
|
137
|
+
return Element(self._type, attrib)
|
|
138
|
+
|
|
139
|
+
def __repr__(self) -> str:
|
|
140
|
+
return f"{self.__class__.__name__}" \
|
|
141
|
+
f"(name={self.name}, " \
|
|
142
|
+
f"causality={self.causality}, " \
|
|
143
|
+
f"variability={self.variability})"
|
|
144
|
+
|
|
145
|
+
class Start(object):
|
|
146
|
+
def __init__(self, startValue):
|
|
147
|
+
self.value = startValue
|
|
148
|
+
|
|
149
|
+
def to_xml(self) -> Element:
|
|
150
|
+
attrib = dict()
|
|
151
|
+
attrib["value"] = self.value
|
|
152
|
+
return Element("Start", attrib)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class Dimension(object):
|
|
156
|
+
def __init__(self, start: str = "", valueReference: str = ""):
|
|
157
|
+
if start and valueReference and any((start, valueReference)):
|
|
158
|
+
raise RuntimeError("start and valueReference attributes are mutally exclusive for Dimension element")
|
|
159
|
+
|
|
160
|
+
self.start = start
|
|
161
|
+
self.value_reference = valueReference
|
|
162
|
+
|
|
163
|
+
def size(self, vars : List[ModelVariable]):
|
|
164
|
+
if self.start:
|
|
165
|
+
return self.start
|
|
166
|
+
else:
|
|
167
|
+
result = next((value for vr, value in vars.items() if vr == int(self.value_reference)), None)
|
|
168
|
+
return result.getter()
|
|
169
|
+
|
|
170
|
+
def to_xml(self) -> Element:
|
|
171
|
+
attrib = dict()
|
|
172
|
+
|
|
173
|
+
if self.start:
|
|
174
|
+
attrib["start"] = self.start
|
|
175
|
+
else:
|
|
176
|
+
attrib['valueReference'] = self.value_reference
|
|
177
|
+
ele = Element("Dimension", attrib)
|
|
178
|
+
return ele
|
|
179
|
+
|
|
180
|
+
class Float64(ModelVariable):
|
|
181
|
+
def __init__(self, name: str, start: Optional[Any] = None, derivative: Optional[Any] = None, dimensions: List[Dimension] = [], unit: Optional[str] = None, **kwargs):
|
|
182
|
+
super().__init__(name, **kwargs)
|
|
183
|
+
self.__attrs = {"start": start, "derivative": derivative}
|
|
184
|
+
self._type = "Float64"
|
|
185
|
+
self._unit = unit
|
|
186
|
+
if dimensions:
|
|
187
|
+
check_numpy()
|
|
188
|
+
self.__dimensions = dimensions
|
|
189
|
+
|
|
190
|
+
@property
|
|
191
|
+
def start(self) -> Optional[Any]:
|
|
192
|
+
return self.__attrs["start"]
|
|
193
|
+
|
|
194
|
+
@start.setter
|
|
195
|
+
def start(self, value: float):
|
|
196
|
+
self.__attrs["start"] = value
|
|
197
|
+
|
|
198
|
+
@property
|
|
199
|
+
def unit(self) -> Optional[Any]:
|
|
200
|
+
return self._unit
|
|
201
|
+
|
|
202
|
+
@unit.setter
|
|
203
|
+
def unit(self, value: str):
|
|
204
|
+
self._unit = value
|
|
205
|
+
|
|
206
|
+
@property
|
|
207
|
+
def derivative(self):
|
|
208
|
+
return self.__attrs["derivative"]
|
|
209
|
+
|
|
210
|
+
@property
|
|
211
|
+
def dimensions(self) -> List[Dimension]:
|
|
212
|
+
return self.__dimensions
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def to_xml(self) -> Element:
|
|
216
|
+
attrib = dict()
|
|
217
|
+
for key, value in self.__attrs.items():
|
|
218
|
+
if value is not None:
|
|
219
|
+
# In order to not loose precision, a number of this type should be
|
|
220
|
+
# stored on an XML file with at least 16 significant digits
|
|
221
|
+
output = ""
|
|
222
|
+
if len(self.dimensions) > 0:
|
|
223
|
+
output = " ".join([f"{val:.16g}" for val in flatten(value)])
|
|
224
|
+
if len(output) > MAX_LENGTH:
|
|
225
|
+
output = output[0]
|
|
226
|
+
else:
|
|
227
|
+
output = f"{value:.16g}"
|
|
228
|
+
attrib[key] = output
|
|
229
|
+
|
|
230
|
+
if self.unit:
|
|
231
|
+
attrib["unit"] = self.unit
|
|
232
|
+
|
|
233
|
+
self._extras = attrib
|
|
234
|
+
parent = super().to_xml()
|
|
235
|
+
|
|
236
|
+
for dimension in self.__dimensions:
|
|
237
|
+
parent.append(dimension.to_xml())
|
|
238
|
+
|
|
239
|
+
return parent
|
|
240
|
+
|
|
241
|
+
def size(self, vars):
|
|
242
|
+
return reduce(lambda x, dim: x * int(dim.size(vars)), self.__dimensions, 1)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
class Int32(ModelVariable):
|
|
246
|
+
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
247
|
+
super().__init__(name, **kwargs)
|
|
248
|
+
self.__attrs = {"start": start}
|
|
249
|
+
self._type = "Int32";
|
|
250
|
+
|
|
251
|
+
@property
|
|
252
|
+
def start(self) -> Optional[Any]:
|
|
253
|
+
return self.__attrs["start"]
|
|
254
|
+
|
|
255
|
+
@start.setter
|
|
256
|
+
def start(self, value: int):
|
|
257
|
+
self.__attrs["start"] = value
|
|
258
|
+
|
|
259
|
+
def to_xml(self) -> Element:
|
|
260
|
+
attrib = dict()
|
|
261
|
+
for key, value in self.__attrs.items():
|
|
262
|
+
if value is not None:
|
|
263
|
+
attrib[key] = str(value)
|
|
264
|
+
self._extras = attrib
|
|
265
|
+
parent = super().to_xml()
|
|
266
|
+
|
|
267
|
+
return parent
|
|
268
|
+
|
|
269
|
+
class Int64(ModelVariable):
|
|
270
|
+
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
271
|
+
super().__init__(name, **kwargs)
|
|
272
|
+
self.__attrs = {"start": start}
|
|
273
|
+
self._type = "Int64";
|
|
274
|
+
|
|
275
|
+
@property
|
|
276
|
+
def start(self) -> Optional[Any]:
|
|
277
|
+
return self.__attrs["start"]
|
|
278
|
+
|
|
279
|
+
@start.setter
|
|
280
|
+
def start(self, value: int):
|
|
281
|
+
self.__attrs["start"] = value
|
|
282
|
+
|
|
283
|
+
def to_xml(self) -> Element:
|
|
284
|
+
attrib = dict()
|
|
285
|
+
for key, value in self.__attrs.items():
|
|
286
|
+
if value is not None:
|
|
287
|
+
attrib[key] = str(value)
|
|
288
|
+
self._extras = attrib
|
|
289
|
+
parent = super().to_xml()
|
|
290
|
+
|
|
291
|
+
return parent
|
|
292
|
+
|
|
293
|
+
class UInt64(ModelVariable):
|
|
294
|
+
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
295
|
+
super().__init__(name, **kwargs)
|
|
296
|
+
self.__attrs = {"start": start}
|
|
297
|
+
self._type = "UInt64";
|
|
298
|
+
|
|
299
|
+
@property
|
|
300
|
+
def start(self) -> Optional[Any]:
|
|
301
|
+
return self.__attrs["start"]
|
|
302
|
+
|
|
303
|
+
@start.setter
|
|
304
|
+
def start(self, value: int):
|
|
305
|
+
self.__attrs["start"] = value
|
|
306
|
+
|
|
307
|
+
def to_xml(self) -> Element:
|
|
308
|
+
attrib = dict()
|
|
309
|
+
for key, value in self.__attrs.items():
|
|
310
|
+
if value is not None:
|
|
311
|
+
attrib[key] = str(value)
|
|
312
|
+
self._extras = attrib
|
|
313
|
+
parent = super().to_xml()
|
|
314
|
+
|
|
315
|
+
return parent
|
|
316
|
+
|
|
317
|
+
class Boolean(ModelVariable):
|
|
318
|
+
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
319
|
+
super().__init__(name, **kwargs)
|
|
320
|
+
self.__attrs = {"start": start}
|
|
321
|
+
self._type = "Boolean"
|
|
322
|
+
|
|
323
|
+
@property
|
|
324
|
+
def start(self) -> Optional[Any]:
|
|
325
|
+
return self.__attrs["start"]
|
|
326
|
+
|
|
327
|
+
@start.setter
|
|
328
|
+
def start(self, value: float):
|
|
329
|
+
self.__attrs["start"] = value
|
|
330
|
+
|
|
331
|
+
def to_xml(self) -> Element:
|
|
332
|
+
attrib = dict()
|
|
333
|
+
for key, value in self.__attrs.items():
|
|
334
|
+
if value is not None:
|
|
335
|
+
attrib[key] = str(value).lower()
|
|
336
|
+
self._extras = attrib
|
|
337
|
+
parent = super().to_xml()
|
|
338
|
+
|
|
339
|
+
return parent
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class String(ModelVariable):
|
|
343
|
+
def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
|
|
344
|
+
super().__init__(name, **kwargs)
|
|
345
|
+
self.__attrs = dict()
|
|
346
|
+
self._type = "String"
|
|
347
|
+
self._start = Start(start)
|
|
348
|
+
|
|
349
|
+
@property
|
|
350
|
+
def start(self) -> Optional[Any]:
|
|
351
|
+
return self._start.value
|
|
352
|
+
|
|
353
|
+
@start.setter
|
|
354
|
+
def start(self, value: float):
|
|
355
|
+
self._start.value = value
|
|
356
|
+
|
|
357
|
+
def to_xml(self) -> Element:
|
|
358
|
+
attrib = dict()
|
|
359
|
+
for key, value in self.__attrs.items():
|
|
360
|
+
if value is not None:
|
|
361
|
+
attrib[key] = str(value)
|
|
362
|
+
self._extras = attrib
|
|
363
|
+
parent = super().to_xml()
|
|
364
|
+
|
|
365
|
+
if self.start is not None:
|
|
366
|
+
parent.append(self._start.to_xml())
|
|
367
|
+
|
|
368
|
+
return parent
|
|
369
|
+
|
|
370
|
+
class Enumeration(ModelVariable):
|
|
371
|
+
def __init__(self, name: str, start: Optional[Any] = None, declared_type: Optional[Any] = None, **kwargs):
|
|
372
|
+
super().__init__(name, **kwargs)
|
|
373
|
+
self.__attrs = {"start": start, "declaredType": declared_type}
|
|
374
|
+
self._type = "Enumeration"
|
|
375
|
+
|
|
376
|
+
@property
|
|
377
|
+
def start(self) -> Optional[Any]:
|
|
378
|
+
return self.__attrs["start"]
|
|
379
|
+
|
|
380
|
+
@start.setter
|
|
381
|
+
def start(self, value: float):
|
|
382
|
+
self.__attrs["start"] = value
|
|
383
|
+
|
|
384
|
+
@property
|
|
385
|
+
def declared_type(self) -> Optional[Any]:
|
|
386
|
+
return self.__attrs["declaredType"]
|
|
387
|
+
|
|
388
|
+
@declared_type.setter
|
|
389
|
+
def declared_type(self, value: float):
|
|
390
|
+
self.__attrs["declaredType"] = value
|
|
391
|
+
|
|
392
|
+
def to_xml(self) -> Element:
|
|
393
|
+
attrib = dict()
|
|
394
|
+
for key, value in self.__attrs.items():
|
|
395
|
+
if value is not None:
|
|
396
|
+
attrib[key] = str(value)
|
|
397
|
+
self._extras = attrib
|
|
398
|
+
parent = super().to_xml()
|
|
399
|
+
|
|
400
|
+
return parent
|