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.
Files changed (199) hide show
  1. pythonfmu3/__init__.py +8 -8
  2. pythonfmu3/__main__.py +52 -52
  3. pythonfmu3/_version.py +1 -1
  4. pythonfmu3/builder.py +260 -260
  5. pythonfmu3/default_experiment.py +7 -7
  6. pythonfmu3/deploy.py +118 -118
  7. pythonfmu3/enums.py +48 -48
  8. pythonfmu3/fmi3slave.py +438 -438
  9. pythonfmu3/logmsg.py +14 -14
  10. pythonfmu3/osutil.py +22 -22
  11. pythonfmu3/pythonfmu-export/.clang-format +35 -35
  12. pythonfmu3/pythonfmu-export/CMakeLists.txt +59 -59
  13. pythonfmu3/pythonfmu-export/build_unix.sh +4 -4
  14. pythonfmu3/pythonfmu-export/build_win.sh +4 -4
  15. pythonfmu3/pythonfmu-export/src/CMakeLists.txt +45 -45
  16. pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_common.hpp +161 -161
  17. pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.cpp +192 -192
  18. pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.hpp +185 -185
  19. pythonfmu3/pythonfmu-export/src/cppfmu/fmi_functions.cpp +937 -937
  20. pythonfmu3/pythonfmu-export/src/fmi/fmi3FunctionTypes.h +638 -638
  21. pythonfmu3/pythonfmu-export/src/fmi/fmi3Functions.h +343 -343
  22. pythonfmu3/pythonfmu-export/src/fmi/fmi3PlatformTypes.h +94 -94
  23. pythonfmu3/pythonfmu-export/src/pythonfmu/IPyState.hpp +17 -17
  24. pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp +744 -744
  25. pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.hpp +111 -111
  26. pythonfmu3/pythonfmu-export/src/pythonfmu/PyState.hpp +84 -84
  27. pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
  28. pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
  29. pythonfmu3/tests/conftest.py +5 -5
  30. pythonfmu3/tests/data/csvdemo.csv +7 -7
  31. pythonfmu3/tests/slaves/PythonSlaveWithException.py +18 -18
  32. pythonfmu3/tests/slaves/localmodule.py +8 -8
  33. pythonfmu3/tests/slaves/pythonslave.py +52 -52
  34. pythonfmu3/tests/slaves/pythonslave_read_file.py +23 -23
  35. pythonfmu3/tests/slaves/slavewithdep.py +21 -21
  36. pythonfmu3/tests/test_builder.py +195 -195
  37. pythonfmu3/tests/test_deploy.py +48 -48
  38. pythonfmu3/tests/test_fmi3slave.py +152 -152
  39. pythonfmu3/tests/test_integration.py +350 -350
  40. pythonfmu3/tests/test_logger.py +180 -180
  41. pythonfmu3/tests/test_multiple_fmus.py +141 -141
  42. pythonfmu3/tests/test_variables.py +334 -334
  43. pythonfmu3/tests/utils.py +13 -13
  44. pythonfmu3/unit.py +62 -62
  45. pythonfmu3/variable_types.py +101 -101
  46. pythonfmu3/variables.py +400 -400
  47. {pythonfmu3-0.2.2.2.dist-info → pythonfmu3-0.2.3.dist-info}/METADATA +7 -9
  48. pythonfmu3-0.2.3.dist-info/RECORD +54 -0
  49. {pythonfmu3-0.2.2.2.dist-info → pythonfmu3-0.2.3.dist-info}/WHEEL +1 -1
  50. {pythonfmu3-0.2.2.2.dist-info → pythonfmu3-0.2.3.dist-info}/entry_points.txt +0 -1
  51. pythonfmu3-0.2.2.2.dist-info/LICENSE.txt → pythonfmu3-0.2.3.dist-info/licenses/LICENSE +23 -23
  52. pythonfmu3/pythonfmu-export/build/ALL_BUILD.vcxproj +0 -184
  53. pythonfmu3/pythonfmu-export/build/ALL_BUILD.vcxproj.filters +0 -8
  54. pythonfmu3/pythonfmu-export/build/CMakeCache.txt +0 -369
  55. pythonfmu3/pythonfmu-export/build/CMakeFiles/0ee4db0675778dfba98c7160896d5a45/generate.stamp.rule +0 -1
  56. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeCCompiler.cmake +0 -72
  57. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeCXXCompiler.cmake +0 -83
  58. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeDetermineCompilerABI_C.bin +0 -0
  59. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeDetermineCompilerABI_CXX.bin +0 -0
  60. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeRCCompiler.cmake +0 -6
  61. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeSystem.cmake +0 -15
  62. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/CMakeCCompilerId.c +0 -838
  63. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/CompilerIdC.exe +0 -0
  64. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/CompilerIdC.vcxproj +0 -71
  65. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CMakeCCompilerId.obj +0 -0
  66. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.exe.recipe +0 -11
  67. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CL.command.1.tlog +0 -0
  68. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CL.read.1.tlog +0 -0
  69. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CL.write.1.tlog +0 -0
  70. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CompilerIdC.lastbuildstate +0 -2
  71. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/link.command.1.tlog +0 -0
  72. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/link.read.1.tlog +0 -0
  73. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/link.write.1.tlog +0 -0
  74. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -826
  75. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/CompilerIdCXX.exe +0 -0
  76. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/CompilerIdCXX.vcxproj +0 -71
  77. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CMakeCXXCompilerId.obj +0 -0
  78. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.exe.recipe +0 -11
  79. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.command.1.tlog +0 -0
  80. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.read.1.tlog +0 -0
  81. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.write.1.tlog +0 -0
  82. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CompilerIdCXX.lastbuildstate +0 -2
  83. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.command.1.tlog +0 -0
  84. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.read.1.tlog +0 -0
  85. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.write.1.tlog +0 -0
  86. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/VCTargetsPath.txt +0 -1
  87. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/VCTargetsPath.vcxproj +0 -31
  88. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/x64/Debug/VCTargetsPath.recipe +0 -11
  89. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/x64/Debug/VCTargetsPath.tlog/VCTargetsPath.lastbuildstate +0 -2
  90. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeCCompiler.cmake +0 -81
  91. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeCXXCompiler.cmake +0 -101
  92. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeDetermineCompilerABI_C.bin +0 -0
  93. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
  94. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeRCCompiler.cmake +0 -6
  95. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeSystem.cmake +0 -15
  96. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/CMakeCCompilerId.c +0 -904
  97. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/CompilerIdC.exe +0 -0
  98. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/CompilerIdC.vcxproj +0 -72
  99. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CMakeCCompilerId.obj +0 -0
  100. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.exe.recipe +0 -11
  101. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CL.command.1.tlog +0 -0
  102. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CL.read.1.tlog +0 -0
  103. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CL.write.1.tlog +0 -0
  104. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CompilerIdC.lastbuildstate +0 -2
  105. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/link.command.1.tlog +0 -0
  106. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/link.read.1.tlog +0 -0
  107. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/link.write.1.tlog +0 -0
  108. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -919
  109. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/CompilerIdCXX.exe +0 -0
  110. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/CompilerIdCXX.vcxproj +0 -72
  111. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CMakeCXXCompilerId.obj +0 -0
  112. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.exe.recipe +0 -11
  113. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.command.1.tlog +0 -0
  114. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.read.1.tlog +0 -0
  115. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.write.1.tlog +0 -0
  116. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CompilerIdCXX.lastbuildstate +0 -2
  117. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.command.1.tlog +0 -0
  118. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.read.1.tlog +0 -0
  119. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.write.1.tlog +0 -0
  120. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/VCTargetsPath.txt +0 -1
  121. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/VCTargetsPath.vcxproj +0 -31
  122. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/x64/Debug/VCTargetsPath.recipe +0 -11
  123. pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/x64/Debug/VCTargetsPath.tlog/VCTargetsPath.lastbuildstate +0 -2
  124. pythonfmu3/pythonfmu-export/build/CMakeFiles/CMakeConfigureLog.yaml +0 -568
  125. pythonfmu3/pythonfmu-export/build/CMakeFiles/CMakeOutput.log +0 -357
  126. pythonfmu3/pythonfmu-export/build/CMakeFiles/TargetDirectories.txt +0 -3
  127. pythonfmu3/pythonfmu-export/build/CMakeFiles/cmake.check_cache +0 -1
  128. pythonfmu3/pythonfmu-export/build/CMakeFiles/generate.stamp +0 -1
  129. pythonfmu3/pythonfmu-export/build/CMakeFiles/generate.stamp.depend +0 -28
  130. pythonfmu3/pythonfmu-export/build/CMakeFiles/generate.stamp.list +0 -2
  131. pythonfmu3/pythonfmu-export/build/ZERO_CHECK.vcxproj +0 -174
  132. pythonfmu3/pythonfmu-export/build/ZERO_CHECK.vcxproj.filters +0 -13
  133. pythonfmu3/pythonfmu-export/build/cmake_install.cmake +0 -50
  134. pythonfmu3/pythonfmu-export/build/install_manifest.txt +0 -0
  135. pythonfmu3/pythonfmu-export/build/pythonfmu-export.sln +0 -53
  136. pythonfmu3/pythonfmu-export/build/src/CMakeFiles/generate.stamp +0 -1
  137. pythonfmu3/pythonfmu-export/build/src/CMakeFiles/generate.stamp.depend +0 -2
  138. pythonfmu3/pythonfmu-export/build/src/Debug/pythonfmu-export.pdb +0 -0
  139. pythonfmu3/pythonfmu-export/build/src/Release/pythonfmu-export.exp +0 -0
  140. pythonfmu3/pythonfmu-export/build/src/Release/pythonfmu-export.lib +0 -0
  141. pythonfmu3/pythonfmu-export/build/src/cmake_install.cmake +0 -34
  142. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/PySlaveInstance.obj +0 -0
  143. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/cppfmu_cs.obj +0 -0
  144. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/exports.def +0 -1885
  145. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/fmi_functions.obj +0 -0
  146. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/objects.txt +0 -3
  147. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CL.command.1.tlog +0 -0
  148. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CL.read.1.tlog +0 -0
  149. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CL.write.1.tlog +0 -0
  150. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CustomBuild.command.1.tlog +0 -10
  151. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CustomBuild.read.1.tlog +0 -1
  152. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CustomBuild.write.1.tlog +0 -2
  153. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.command.1.tlog +0 -1
  154. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.read.1.tlog +0 -1
  155. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.read.3.tlog +0 -1
  156. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.write.1.tlog +0 -1
  157. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/pythonfmu-export.lastbuildstate +0 -2
  158. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/unsuccessfulbuild +0 -0
  159. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/vc142.pdb +0 -0
  160. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/MinSizeRel/objects.txt +0 -3
  161. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/RelWithDebInfo/objects.txt +0 -3
  162. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/PySlaveInstance.obj +0 -0
  163. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/cppfmu_cs.obj +0 -0
  164. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/exports.def +0 -538
  165. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/fmi_functions.obj +0 -0
  166. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/objects.txt +0 -3
  167. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.dll.recipe +0 -14
  168. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CL.command.1.tlog +0 -0
  169. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CL.read.1.tlog +0 -0
  170. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CL.write.1.tlog +0 -0
  171. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CustomBuild.command.1.tlog +0 -10
  172. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CustomBuild.read.1.tlog +0 -1
  173. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CustomBuild.write.1.tlog +0 -2
  174. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.command.1.tlog +0 -0
  175. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.delete.1.tlog +0 -0
  176. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.read.1.tlog +0 -0
  177. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.write.1.tlog +0 -0
  178. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/pythonfmu-export.lastbuildstate +0 -2
  179. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/pythonfmu-export.write.1u.tlog +0 -0
  180. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.vcxproj +0 -414
  181. pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.vcxproj.filters +0 -48
  182. pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.recipe +0 -11
  183. pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.command.1.tlog +0 -10
  184. pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.read.1.tlog +0 -29
  185. pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.write.1.tlog +0 -3
  186. pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/ZERO_CHECK.lastbuildstate +0 -2
  187. pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.recipe +0 -17
  188. pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/ALL_BUILD.lastbuildstate +0 -2
  189. pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.command.1.tlog +0 -10
  190. pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.read.1.tlog +0 -27
  191. pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.write.1.tlog +0 -2
  192. pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.recipe +0 -11
  193. pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.command.1.tlog +0 -10
  194. pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.read.1.tlog +0 -29
  195. pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.write.1.tlog +0 -3
  196. pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/ZERO_CHECK.lastbuildstate +0 -2
  197. pythonfmu3/resources/binaries/x86_64-windows1/pythonfmu-export.dll +0 -0
  198. pythonfmu3-0.2.2.2.dist-info/RECORD +0 -200
  199. {pythonfmu3-0.2.2.2.dist-info → pythonfmu3-0.2.3.dist-info}/top_level.txt +0 -0
@@ -1,937 +1,937 @@
1
- /* Copyright 2016-2019, SINTEF Ocean.
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
- */
6
- #include "cppfmu/cppfmu_cs.hpp"
7
-
8
- #include <exception>
9
- #include <limits>
10
-
11
- #define NOT_IMPLEMENTED throw std::logic_error("function " + std::string(__func__) + " not implemented")
12
-
13
-
14
- #define NOT_IMPLEMENTED_GETTER(suffix, var) fmi3Status fmi3Get##suffix( \
15
- fmi3Instance c, \
16
- const fmi3ValueReference vr[], \
17
- size_t nValueReferences, \
18
- var values[], \
19
- size_t nValues) { NOT_IMPLEMENTED;}
20
-
21
- #define NOT_IMPLEMENTED_SETTER(suffix, var) fmi3Status fmi3Set##suffix ( \
22
- fmi3Instance c, \
23
- const fmi3ValueReference vr[], \
24
- size_t nValueReferences, \
25
- const var values[], \
26
- size_t nValues) { NOT_IMPLEMENTED;}
27
-
28
- namespace
29
- {
30
- // A struct that holds all the data for one model instance.
31
- struct Component
32
- {
33
- enum class State
34
- {
35
- StartAndEnd = 1 << 0,
36
- ConfigurationMode = 1 << 1,
37
- Instantiated = 1 << 2,
38
- InitializationMode = 1 << 3,
39
- EventMode = 1 << 4,
40
- ContinuousTimeMode = 1 << 5,
41
- StepMode = 1 << 6,
42
- ClockActivationMode = 1 << 7,
43
- StepDiscarded = 1 << 8,
44
- ReconfigurationMode = 1 << 9,
45
- IntermediateUpdateMode = 1 << 10,
46
- Terminated = 1 << 11,
47
- modelError = 1 << 12,
48
- modelFatal = 1 << 13,
49
- };
50
- Component(cppfmu::FMIComponentEnvironment instanceEnvironment,
51
- cppfmu::FMICallbackLogger logCallback,
52
- cppfmu::FMIBoolean loggingOn) : loggerSettings{std::make_shared<cppfmu::Logger::Settings>()},
53
- logger{instanceEnvironment, logCallback, loggerSettings}
54
- {
55
- loggerSettings->debugLoggingEnabled = (loggingOn == cppfmu::FMITrue);
56
- }
57
-
58
- // General
59
- std::shared_ptr<cppfmu::Logger::Settings> loggerSettings;
60
- cppfmu::Logger logger;
61
- State state;
62
-
63
- // Co-simulation
64
- std::unique_ptr<cppfmu::SlaveInstance> slave;
65
- };
66
- } // namespace
67
-
68
-
69
- // FMI functions
70
- extern "C" {
71
-
72
- // =============================================================================
73
- // FMI 3.0 functions
74
- // =============================================================================
75
-
76
-
77
- const char* fmi3GetVersion()
78
- {
79
- return "3.0";
80
- }
81
-
82
-
83
- fmi3Instance fmi3InstantiateCoSimulation(
84
- fmi3String instanceName,
85
- fmi3String instantiationToken,
86
- fmi3String fmuResourceLocation,
87
- fmi3Boolean visible,
88
- fmi3Boolean loggingOn,
89
- fmi3Boolean eventModeUsed,
90
- fmi3Boolean earlyReturnAllowed,
91
- fmi3ValueReference const[],
92
- size_t nRequiredIntermediateVariables,
93
- fmi3InstanceEnvironment environment,
94
- fmi3LogMessageCallback logMessage,
95
- fmi3IntermediateUpdateCallback intermediateUpdate )
96
- {
97
- try {
98
- auto component = new Component(
99
- environment,
100
- logMessage,
101
- loggingOn);
102
- component->slave = CppfmuInstantiateSlave(
103
- instanceName,
104
- instantiationToken,
105
- fmuResourceLocation,
106
- "application/x-fmu-sharedlibrary",
107
- 0.0,
108
- visible,
109
- cppfmu::FMIFalse,
110
- component->logger);
111
- return component;
112
- } catch (const cppfmu::FatalError& e) {
113
- // functions->logger(nullptr, instanceName, fmi3Fatal, "", e.what());
114
- return nullptr;
115
- } catch (const std::exception& e) {
116
- // functions->logger(nullptr, instanceName, fmi3Error, "", e.what());
117
- return nullptr;
118
- }
119
- }
120
-
121
- fmi3Instance fmi3InstantiateModelExchange(
122
- fmi3String instanceName,
123
- fmi3String instantiationToken,
124
- fmi3String resourcePath,
125
- fmi3Boolean visible,
126
- fmi3Boolean loggingOn,
127
- fmi3InstanceEnvironment instanceEnvironment,
128
- fmi3LogMessageCallback logMessage)
129
- {
130
- throw std::logic_error("Unsupported FMU instance type requested (only co-simulation is supported)");
131
- }
132
-
133
- fmi3Instance fmi3InstantiateScheduledExecution(
134
- fmi3String instanceName,
135
- fmi3String instantiationToken,
136
- fmi3String resourcePath,
137
- fmi3Boolean visible,
138
- fmi3Boolean loggingOn,
139
- fmi3InstanceEnvironment instanceEnvironment,
140
- fmi3LogMessageCallback logMessage,
141
- fmi3ClockUpdateCallback clockUpdate,
142
- fmi3LockPreemptionCallback lockPreemption,
143
- fmi3UnlockPreemptionCallback unlockPreemption)
144
- {
145
- throw std::logic_error("Unsupported FMU instance type requested (only co-simulation is supported)");
146
- }
147
-
148
-
149
- void fmi3FreeInstance(fmi3Instance c)
150
- {
151
- const auto component = reinterpret_cast<Component*>(c);
152
- delete component;
153
- }
154
-
155
-
156
- fmi3Status fmi3SetDebugLogging(
157
- fmi3Instance c,
158
- fmi3Boolean loggingOn,
159
- size_t nCategories,
160
- const fmi3String categories[])
161
- {
162
- const auto component = reinterpret_cast<Component*>(c);
163
-
164
- std::vector<cppfmu::String> newCategories;
165
- for (size_t i = 0; i < nCategories; ++i) {
166
- newCategories.push_back(categories[i]);
167
- }
168
-
169
- component->loggerSettings->debugLoggingEnabled = (loggingOn == fmi3True);
170
- component->loggerSettings->loggedCategories.swap(newCategories);
171
- return fmi3OK;
172
- }
173
-
174
- fmi3Status fmi3EnterInitializationMode(fmi3Instance c, fmi3Boolean, fmi3Float64, fmi3Float64, fmi3Boolean, fmi3Float64)
175
- {
176
- const auto component = reinterpret_cast<Component*>(c);
177
- try {
178
- component->slave->EnterInitializationMode();
179
- return fmi3OK;
180
- } catch (const cppfmu::FatalError& e) {
181
- component->logger.Log(fmi3Fatal, "", e.what());
182
- return fmi3Fatal;
183
- } catch (const std::exception& e) {
184
- component->logger.Log(fmi3Error, "", e.what());
185
- return fmi3Error;
186
- }
187
- }
188
-
189
-
190
- fmi3Status fmi3ExitInitializationMode(fmi3Instance c)
191
- {
192
- const auto component = reinterpret_cast<Component*>(c);
193
- try {
194
- component->slave->ExitInitializationMode();
195
- return fmi3OK;
196
- } catch (const cppfmu::FatalError& e) {
197
- component->logger.Log(fmi3Fatal, "", e.what());
198
- return fmi3Fatal;
199
- } catch (const std::exception& e) {
200
- component->logger.Log(fmi3Error, "", e.what());
201
- return fmi3Error;
202
- }
203
- }
204
-
205
- fmi3Status fmi3EnterConfigurationMode(fmi3Instance c)
206
- {
207
-
208
- const auto component = reinterpret_cast<Component*>(c);
209
- component->state = Component::State::ConfigurationMode;
210
- return fmi3OK;
211
-
212
- }
213
-
214
- fmi3Status fmi3ExitConfigurationMode(fmi3Instance c)
215
- {
216
- const auto component = reinterpret_cast<Component*>(c);
217
- if (component->state == Component::State::ConfigurationMode)
218
- {
219
- component->state = Component::State::Instantiated;
220
-
221
- } else{
222
- component->state = Component::State::StepMode;
223
- }
224
- return fmi3OK;
225
- }
226
-
227
- fmi3Status fmi3EnterEventMode(fmi3Instance c)
228
- {
229
- const auto component = reinterpret_cast<Component*>(c);
230
- component->state = Component::State::EventMode;
231
- return fmi3OK;
232
- }
233
-
234
- fmi3Status fmi3EnterStepMode(fmi3Instance c)
235
- {
236
- const auto component = reinterpret_cast<Component*>(c);
237
- component->state = Component::State::StepMode;
238
- return fmi3OK;
239
- }
240
-
241
-
242
- fmi3Status fmi3Terminate(fmi3Instance c)
243
- {
244
- const auto component = reinterpret_cast<Component*>(c);
245
- try {
246
- component->slave->Terminate();
247
- return fmi3OK;
248
- } catch (const cppfmu::FatalError& e) {
249
- component->logger.Log(fmi3Fatal, "", e.what());
250
- return fmi3Fatal;
251
- } catch (const std::exception& e) {
252
- component->logger.Log(fmi3Error, "", e.what());
253
- return fmi3Error;
254
- }
255
- }
256
-
257
-
258
- fmi3Status fmi3Reset(fmi3Instance c)
259
- {
260
- const auto component = reinterpret_cast<Component*>(c);
261
- try {
262
- component->slave->Reset();
263
- return fmi3OK;
264
- } catch (const cppfmu::FatalError& e) {
265
- component->logger.Log(fmi3Fatal, "", e.what());
266
- return fmi3Fatal;
267
- } catch (const std::exception& e) {
268
- component->logger.Log(fmi3Error, "", e.what());
269
- return fmi3Error;
270
- }
271
- }
272
-
273
-
274
- fmi3Status fmi3GetFloat64(
275
- fmi3Instance c,
276
- const fmi3ValueReference vr[],
277
- size_t nvr,
278
- fmi3Float64 values[],
279
- size_t nValues)
280
- {
281
- const auto component = reinterpret_cast<Component*>(c);
282
- try {
283
- component->slave->GetFloat64(vr, nvr, values, nValues);
284
- return fmi3OK;
285
- } catch (const cppfmu::FatalError& e) {
286
- component->logger.Log(fmi3Fatal, "", e.what());
287
- return fmi3Fatal;
288
- } catch (const std::exception& e) {
289
- component->logger.Log(fmi3Error, "", e.what());
290
- return fmi3Error;
291
- }
292
- }
293
-
294
- fmi3Status fmi3GetInt32(
295
- fmi3Instance c,
296
- const fmi3ValueReference vr[],
297
- size_t nvr,
298
- fmi3Int32 values[],
299
- size_t nValues)
300
- {
301
- const auto component = reinterpret_cast<Component*>(c);
302
- try {
303
- component->slave->GetInt32(vr, nvr, values);
304
- return fmi3OK;
305
- } catch (const cppfmu::FatalError& e) {
306
- component->logger.Log(fmi3Fatal, "", e.what());
307
- return fmi3Fatal;
308
- } catch (const std::exception& e) {
309
- component->logger.Log(fmi3Error, "", e.what());
310
- return fmi3Error;
311
- }
312
- }
313
-
314
- fmi3Status fmi3GetInt64(
315
- fmi3Instance c,
316
- const fmi3ValueReference vr[],
317
- size_t nvr,
318
- fmi3Int64 values[],
319
- size_t nValues)
320
- {
321
- const auto component = reinterpret_cast<Component*>(c);
322
- try {
323
- component->slave->GetInt64(vr, nvr, values);
324
- return fmi3OK;
325
- } catch (const cppfmu::FatalError& e) {
326
- component->logger.Log(fmi3Fatal, "", e.what());
327
- return fmi3Fatal;
328
- } catch (const std::exception& e) {
329
- component->logger.Log(fmi3Error, "", e.what());
330
- return fmi3Error;
331
- }
332
- }
333
-
334
- fmi3Status fmi3GetUInt64(
335
- fmi3Instance c,
336
- const fmi3ValueReference vr[],
337
- size_t nvr,
338
- fmi3UInt64 values[],
339
- size_t nValues)
340
- {
341
- const auto component = reinterpret_cast<Component*>(c);
342
- try {
343
- component->slave->GetUInt64(vr, nvr, values);
344
- return fmi3OK;
345
- } catch (const cppfmu::FatalError& e) {
346
- component->logger.Log(fmi3Fatal, "", e.what());
347
- return fmi3Fatal;
348
- } catch (const std::exception& e) {
349
- component->logger.Log(fmi3Error, "", e.what());
350
- return fmi3Error;
351
- }
352
- }
353
-
354
- fmi3Status fmi3GetBoolean(
355
- fmi3Instance c,
356
- const fmi3ValueReference vr[],
357
- size_t nvr,
358
- fmi3Boolean values[],
359
- size_t nValues)
360
- {
361
- const auto component = reinterpret_cast<Component*>(c);
362
- try {
363
- component->slave->GetBoolean(vr, nvr, values);
364
- return fmi3OK;
365
- } catch (const cppfmu::FatalError& e) {
366
- component->logger.Log(fmi3Fatal, "", e.what());
367
- return fmi3Fatal;
368
- } catch (const std::exception& e) {
369
- component->logger.Log(fmi3Error, "", e.what());
370
- return fmi3Error;
371
- }
372
- }
373
-
374
- fmi3Status fmi3GetString(
375
- fmi3Instance c,
376
- const fmi3ValueReference vr[],
377
- size_t nvr,
378
- fmi3String values[],
379
- size_t nValues)
380
- {
381
- const auto component = reinterpret_cast<Component*>(c);
382
- try {
383
- component->slave->GetString(vr, nvr, values);
384
- return fmi3OK;
385
- } catch (const cppfmu::FatalError& e) {
386
- component->logger.Log(fmi3Fatal, "", e.what());
387
- return fmi3Fatal;
388
- } catch (const std::exception& e) {
389
- component->logger.Log(fmi3Error, "", e.what());
390
- return fmi3Error;
391
- }
392
- }
393
-
394
-
395
- fmi3Status fmi3SetFloat64(
396
- fmi3Instance c,
397
- const fmi3ValueReference vr[],
398
- size_t nvr,
399
- const fmi3Float64 value[],
400
- size_t nValues)
401
- {
402
- const auto component = reinterpret_cast<Component*>(c);
403
- try {
404
- component->slave->SetFloat64(vr, nvr, value, nValues);
405
- return fmi3OK;
406
- } catch (const cppfmu::FatalError& e) {
407
- component->logger.Log(fmi3Fatal, "", e.what());
408
- return fmi3Fatal;
409
- } catch (const std::exception& e) {
410
- component->logger.Log(fmi3Error, "", e.what());
411
- return fmi3Error;
412
- }
413
- }
414
-
415
- fmi3Status fmi3SetInt32(
416
- fmi3Instance c,
417
- const fmi3ValueReference vr[],
418
- size_t nvr,
419
- const fmi3Int32 values[],
420
- size_t nValues)
421
- {
422
- const auto component = reinterpret_cast<Component*>(c);
423
- try {
424
- component->slave->SetInt32(vr, nvr, values);
425
- return fmi3OK;
426
- } catch (const cppfmu::FatalError& e) {
427
- component->logger.Log(fmi3Fatal, "", e.what());
428
- return fmi3Fatal;
429
- } catch (const std::exception& e) {
430
- component->logger.Log(fmi3Error, "", e.what());
431
- return fmi3Error;
432
- }
433
- }
434
-
435
- fmi3Status fmi3SetInt64(
436
- fmi3Instance c,
437
- const fmi3ValueReference vr[],
438
- size_t nvr,
439
- const fmi3Int64 values[],
440
- size_t nValues)
441
- {
442
- const auto component = reinterpret_cast<Component*>(c);
443
- try {
444
- component->slave->SetInt64(vr, nvr, values);
445
- return fmi3OK;
446
- } catch (const cppfmu::FatalError& e) {
447
- component->logger.Log(fmi3Fatal, "", e.what());
448
- return fmi3Fatal;
449
- } catch (const std::exception& e) {
450
- component->logger.Log(fmi3Error, "", e.what());
451
- return fmi3Error;
452
- }
453
- }
454
-
455
- fmi3Status fmi3SetUInt64(
456
- fmi3Instance c,
457
- const fmi3ValueReference vr[],
458
- size_t nvr,
459
- const fmi3UInt64 values[],
460
- size_t nValues)
461
- {
462
- const auto component = reinterpret_cast<Component*>(c);
463
- try {
464
- component->slave->SetUInt64(vr, nvr, values);
465
- return fmi3OK;
466
- } catch (const cppfmu::FatalError& e) {
467
- component->logger.Log(fmi3Fatal, "", e.what());
468
- return fmi3Fatal;
469
- } catch (const std::exception& e) {
470
- component->logger.Log(fmi3Error, "", e.what());
471
- return fmi3Error;
472
- }
473
- }
474
-
475
- fmi3Status fmi3SetBoolean(
476
- fmi3Instance c,
477
- const fmi3ValueReference vr[],
478
- size_t nvr,
479
- const fmi3Boolean values[],
480
- size_t nValues)
481
- {
482
- const auto component = reinterpret_cast<Component*>(c);
483
- try {
484
- component->slave->SetBoolean(vr, nvr, values);
485
- return fmi3OK;
486
- } catch (const cppfmu::FatalError& e) {
487
- component->logger.Log(fmi3Fatal, "", e.what());
488
- return fmi3Fatal;
489
- } catch (const std::exception& e) {
490
- component->logger.Log(fmi3Error, "", e.what());
491
- return fmi3Error;
492
- }
493
- }
494
-
495
- fmi3Status fmi3SetString(
496
- fmi3Instance c,
497
- const fmi3ValueReference vr[],
498
- size_t nvr,
499
- const fmi3String values[],
500
- size_t nValues)
501
- {
502
- const auto component = reinterpret_cast<Component*>(c);
503
- try {
504
- component->slave->SetString(vr, nvr, values);
505
- return fmi3OK;
506
- } catch (const cppfmu::FatalError& e) {
507
- component->logger.Log(fmi3Fatal, "", e.what());
508
- return fmi3Fatal;
509
- } catch (const std::exception& e) {
510
- component->logger.Log(fmi3Error, "", e.what());
511
- return fmi3Error;
512
- }
513
- }
514
-
515
-
516
- fmi3Status fmi3GetFMUState(
517
- fmi3Instance c,
518
- fmi3FMUState* state)
519
- {
520
- const auto component = reinterpret_cast<Component*>(c);
521
- try {
522
- component->slave->GetFMUstate(*state);
523
- return fmi3OK;
524
- } catch (const cppfmu::FatalError& e) {
525
- component->logger.Log(fmi3Fatal, "", e.what());
526
- return fmi3Fatal;
527
- } catch (const std::exception& e) {
528
- component->logger.Log(fmi3Error, "", e.what());
529
- return fmi3Error;
530
- }
531
- }
532
-
533
- fmi3Status fmi3SetFMUState(
534
- fmi3Instance c,
535
- fmi3FMUState state)
536
- {
537
- const auto component = reinterpret_cast<Component*>(c);
538
- try {
539
- component->slave->SetFMUstate(state);
540
- return fmi3OK;
541
- } catch (const cppfmu::FatalError& e) {
542
- component->logger.Log(fmi3Fatal, "", e.what());
543
- return fmi3Fatal;
544
- } catch (const std::exception& e) {
545
- component->logger.Log(fmi3Error, "", e.what());
546
- return fmi3Error;
547
- }
548
- }
549
-
550
- fmi3Status fmi3FreeFMUState(
551
- fmi3Instance c,
552
- fmi3FMUState* state)
553
- {
554
- const auto component = reinterpret_cast<Component*>(c);
555
- try {
556
- component->slave->FreeFMUstate(*state);
557
- return fmi3OK;
558
- } catch (const cppfmu::FatalError& e) {
559
- component->logger.Log(fmi3Fatal, "", e.what());
560
- return fmi3Fatal;
561
- } catch (const std::exception& e) {
562
- component->logger.Log(fmi3Error, "", e.what());
563
- return fmi3Error;
564
- }
565
- }
566
-
567
- fmi3Status fmi3SerializedFMUStateSize(
568
- fmi3Instance c,
569
- fmi3FMUState state,
570
- size_t* size)
571
- {
572
- const auto component = reinterpret_cast<Component*>(c);
573
- try {
574
- *size = component->slave->SerializedFMUstateSize(state);
575
- return fmi3OK;
576
- } catch (const cppfmu::FatalError& e) {
577
- component->logger.Log(fmi3Fatal, "", e.what());
578
- return fmi3Fatal;
579
- } catch (const std::exception& e) {
580
- component->logger.Log(fmi3Error, "", e.what());
581
- return fmi3Error;
582
- }
583
- }
584
-
585
- fmi3Status fmi3SerializeFMUState(
586
- fmi3Instance c,
587
- fmi3FMUState state,
588
- fmi3Byte bytes[],
589
- size_t size)
590
- {
591
- const auto component = reinterpret_cast<Component*>(c);
592
- try {
593
- component->slave->SerializeFMUstate(state, bytes, size);
594
- return fmi3OK;
595
- } catch (const cppfmu::FatalError& e) {
596
- component->logger.Log(fmi3Fatal, "", e.what());
597
- return fmi3Fatal;
598
- } catch (const std::exception& e) {
599
- component->logger.Log(fmi3Error, "", e.what());
600
- return fmi3Error;
601
- }
602
- }
603
-
604
- fmi3Status fmi3DeserializeFMUState(
605
- fmi3Instance c,
606
- const fmi3Byte bytes[],
607
- size_t size,
608
- fmi3FMUState* state)
609
- {
610
- const auto component = reinterpret_cast<Component*>(c);
611
- try {
612
- component->slave->DeSerializeFMUstate(bytes, size, *state);
613
- return fmi3OK;
614
- } catch (const cppfmu::FatalError& e) {
615
- component->logger.Log(fmi3Fatal, "", e.what());
616
- return fmi3Fatal;
617
- } catch (const std::exception& e) {
618
- component->logger.Log(fmi3Error, "", e.what());
619
- return fmi3Error;
620
- }
621
- }
622
-
623
-
624
- fmi3Status fmi3GetDirectionalDerivative(
625
- fmi3Instance c,
626
- const fmi3ValueReference[],
627
- size_t,
628
- const fmi3ValueReference[],
629
- size_t,
630
- const fmi3Float64[],
631
- size_t,
632
- fmi3Float64[],
633
- size_t)
634
- {
635
- reinterpret_cast<Component*>(c)->logger.Log(
636
- fmi3Error,
637
- "cppfmu",
638
- "FMI function not supported: fmi3GetDirectionalDerivative");
639
- return fmi3Error;
640
- }
641
-
642
- fmi3Status fmi3GetOutputDerivatives(
643
- fmi3Instance c,
644
- const fmi3ValueReference[],
645
- size_t,
646
- const fmi3Int32[],
647
- fmi3Float64[],
648
- size_t)
649
- {
650
- reinterpret_cast<Component*>(c)->logger.Log(
651
- fmi3Error,
652
- "cppfmu",
653
- "FMI function not supported: fmiGetOutputDerivatives");
654
- return fmi3Error;
655
- }
656
-
657
- fmi3Status fmi3DoStep(
658
- fmi3Instance c,
659
- fmi3Float64 currentCommunicationPoint,
660
- fmi3Float64 communicationStepSize,
661
- fmi3Boolean noSetFmuStatePriorToCurrentPoint,
662
- fmi3Boolean* eventHandlingNeeded ,
663
- fmi3Boolean* terminateSimulation,
664
- fmi3Boolean* earlyReturn,
665
- fmi3Float64* lastSuccessfulTime)
666
- {
667
- const auto component = reinterpret_cast<Component*>(c);
668
- try {
669
- double endTime = currentCommunicationPoint;
670
- const auto status = component->slave->DoStep(
671
- currentCommunicationPoint,
672
- communicationStepSize,
673
- noSetFmuStatePriorToCurrentPoint,
674
- eventHandlingNeeded,
675
- terminateSimulation,
676
- earlyReturn,
677
- endTime);
678
- if (status == fmi3Status::fmi3OK) {
679
- *lastSuccessfulTime =
680
- currentCommunicationPoint + communicationStepSize;
681
- return fmi3OK;
682
- } else {
683
- *lastSuccessfulTime = endTime;
684
- return status;
685
- }
686
- } catch (const cppfmu::FatalError& e) {
687
- component->logger.Log(fmi3Fatal, "", e.what());
688
- return fmi3Fatal;
689
- } catch (const std::exception& e) {
690
- component->logger.Log(fmi3Error, "", e.what());
691
- return fmi3Error;
692
- }
693
- }
694
- }
695
-
696
- // NOT IMPLEMENTED
697
-
698
- NOT_IMPLEMENTED_GETTER(Float32, fmi3Float32);
699
- NOT_IMPLEMENTED_SETTER(Float32, fmi3Float32);
700
-
701
- NOT_IMPLEMENTED_GETTER(Int8, fmi3Int8);
702
- NOT_IMPLEMENTED_SETTER(Int8, fmi3Int8);
703
- NOT_IMPLEMENTED_GETTER(Int16, fmi3Int16);
704
- NOT_IMPLEMENTED_SETTER(Int16, fmi3Int16);
705
-
706
- NOT_IMPLEMENTED_GETTER(UInt8, fmi3UInt8);
707
- NOT_IMPLEMENTED_SETTER(UInt8, fmi3UInt8);
708
- NOT_IMPLEMENTED_GETTER(UInt16, fmi3UInt16);
709
- NOT_IMPLEMENTED_SETTER(UInt16, fmi3UInt16);
710
- NOT_IMPLEMENTED_GETTER(UInt32, fmi3UInt32);
711
- NOT_IMPLEMENTED_SETTER(UInt32, fmi3UInt32);
712
-
713
-
714
- fmi3Status fmi3GetClock(fmi3Instance instance,
715
- const fmi3ValueReference valueReferences[],
716
- size_t nValueReferences,
717
- fmi3Clock values[])
718
- {
719
- NOT_IMPLEMENTED;
720
- }
721
-
722
- fmi3Status fmi3SetClock(fmi3Instance instance,
723
- const fmi3ValueReference valueReferences[],
724
- size_t nValueReferences,
725
- const fmi3Clock values[])
726
- {
727
- NOT_IMPLEMENTED;
728
- }
729
-
730
- fmi3Status fmi3GetBinary(fmi3Instance instance,
731
- const fmi3ValueReference valueReferences[],
732
- size_t nValueReferences,
733
- size_t valueSizes[],
734
- fmi3Binary values[],
735
- size_t nValues)
736
- {
737
-
738
- NOT_IMPLEMENTED;
739
- }
740
-
741
- fmi3Status fmi3SetBinary(fmi3Instance instance,
742
- const fmi3ValueReference valueReferences[],
743
- size_t nValueReferences,
744
- const size_t valueSizes[],
745
- const fmi3Binary values[],
746
- size_t nValues)
747
- {
748
- NOT_IMPLEMENTED;
749
- }
750
-
751
- fmi3Status fmi3GetNumberOfVariableDependencies(fmi3Instance instance,
752
- fmi3ValueReference valueReference,
753
- size_t* nDependencies)
754
- {
755
- NOT_IMPLEMENTED;
756
- }
757
-
758
- fmi3Status fmi3GetVariableDependencies(fmi3Instance instance,
759
- fmi3ValueReference dependent,
760
- size_t elementIndicesOfDependent[],
761
- fmi3ValueReference independents[],
762
- size_t elementIndicesOfIndependents[],
763
- fmi3DependencyKind dependencyKinds[],
764
- size_t nDependencies)
765
- {
766
- NOT_IMPLEMENTED;
767
- }
768
-
769
- fmi3Status fmi3GetAdjointDerivative(fmi3Instance instance,
770
- const fmi3ValueReference unknowns[],
771
- size_t nUnknowns,
772
- const fmi3ValueReference knowns[],
773
- size_t nKnowns,
774
- const fmi3Float64 seed[],
775
- size_t nSeed,
776
- fmi3Float64 sensitivity[],
777
- size_t nSensitivity)
778
- {
779
- NOT_IMPLEMENTED;
780
- }
781
-
782
- fmi3Status fmi3GetIntervalDecimal(
783
- fmi3Instance instance,
784
- const fmi3ValueReference valueReferences[],
785
- size_t nValueReferences,
786
- fmi3Float64 intervals[],
787
- fmi3IntervalQualifier qualifiers[])
788
- {
789
- NOT_IMPLEMENTED;
790
- }
791
-
792
- fmi3Status fmi3GetIntervalFraction(
793
- fmi3Instance instance,
794
- const fmi3ValueReference valueReferences[],
795
- size_t nValueReferences,
796
- fmi3UInt64 intervalCounters[],
797
- fmi3UInt64 resolutions[],
798
- fmi3IntervalQualifier qualifiers[])
799
- {
800
- NOT_IMPLEMENTED;
801
- }
802
-
803
- fmi3Status
804
- fmi3GetShiftDecimal(fmi3Instance instance, const fmi3ValueReference valueReferences[],
805
- size_t nValueReferences, fmi3Float64 shifts[])
806
- {
807
- NOT_IMPLEMENTED;
808
- }
809
-
810
- fmi3Status
811
- fmi3GetShiftFraction(fmi3Instance instance, const fmi3ValueReference valueReferences[],
812
- size_t nValueReferences, fmi3UInt64 shiftCounters[], fmi3UInt64 resolutions[])
813
- {
814
- NOT_IMPLEMENTED;
815
- }
816
-
817
- fmi3Status
818
- fmi3SetIntervalDecimal(fmi3Instance instance, const fmi3ValueReference valueReferences[],
819
- size_t nValueReferences, const fmi3Float64 intervals[])
820
- {
821
- NOT_IMPLEMENTED;
822
- }
823
-
824
- fmi3Status
825
- fmi3SetIntervalFraction(fmi3Instance instance, const fmi3ValueReference valueReferences[],
826
- size_t nValueReferences, const fmi3UInt64 intervalCounters[],
827
- const fmi3UInt64 resolutions[])
828
- {
829
- NOT_IMPLEMENTED;
830
- }
831
-
832
- fmi3Status
833
- fmi3SetShiftDecimal(fmi3Instance instance, const fmi3ValueReference valueReferences[],
834
- size_t nValueReferences, const fmi3Float64 shifts[])
835
- {
836
- NOT_IMPLEMENTED;
837
- }
838
-
839
- fmi3Status
840
- fmi3SetShiftFraction(fmi3Instance instance, const fmi3ValueReference valueReferences[],
841
- size_t nValueReferences, const fmi3UInt64 shiftCounters[],
842
- const fmi3UInt64 resolutions[])
843
- {
844
- NOT_IMPLEMENTED;
845
- }
846
-
847
- fmi3Status
848
- fmi3EvaluateDiscreteStates(fmi3Instance instance)
849
- {
850
- NOT_IMPLEMENTED;
851
- }
852
-
853
- fmi3Status
854
- fmi3UpdateDiscreteStates(fmi3Instance instance, fmi3Boolean* discreteStatesNeedUpdate,
855
- fmi3Boolean* terminateSimulation,
856
- fmi3Boolean* nominalsOfContinuousStatesChanged,
857
- fmi3Boolean* valuesOfContinuousStatesChanged,
858
- fmi3Boolean* nextEventTimeDefined, fmi3Float64* nextEventTime)
859
- {
860
- NOT_IMPLEMENTED;
861
- }
862
-
863
- fmi3Status fmi3ActivateModelPartition(fmi3Instance instance, fmi3ValueReference clockReference,
864
- fmi3Float64 activationTime)
865
- {
866
- NOT_IMPLEMENTED;
867
- }
868
-
869
-
870
- // model exchange functions
871
- fmi3Status
872
- fmi3EnterContinuousTimeMode(fmi3Instance instance)
873
- {
874
- NOT_IMPLEMENTED;
875
- }
876
-
877
- fmi3Status
878
- fmi3CompletedIntegratorStep(fmi3Instance instance, fmi3Boolean noSetFMUStatePriorToCurrentPoint,
879
- fmi3Boolean* enterEventMode, fmi3Boolean* terminateSimulation)
880
- {
881
- NOT_IMPLEMENTED;
882
- }
883
-
884
- /* Providing independent variables and re-initialization of caching */
885
- fmi3Status
886
- fmi3SetTime(fmi3Instance instance, fmi3Float64 time)
887
- {
888
- NOT_IMPLEMENTED;
889
- }
890
-
891
- fmi3Status
892
- fmi3SetContinuousStates(fmi3Instance instance, const fmi3Float64 continuousStates[],
893
- size_t nContinuousStates)
894
- {
895
- NOT_IMPLEMENTED;
896
- }
897
-
898
- /* Evaluation of the model equations */
899
- fmi3Status
900
- fmi3GetContinuousStateDerivatives(fmi3Instance instance, fmi3Float64 derivatives[],
901
- size_t nContinuousStates)
902
- {
903
- NOT_IMPLEMENTED;
904
- }
905
-
906
- fmi3Status
907
- fmi3GetEventIndicators(fmi3Instance instance, fmi3Float64 eventIndicators[],
908
- size_t nEventIndicators)
909
- {
910
- NOT_IMPLEMENTED;
911
- }
912
-
913
- fmi3Status
914
- fmi3GetContinuousStates(fmi3Instance instance, fmi3Float64 continuousStates[],
915
- size_t nContinuousStates)
916
- {
917
- NOT_IMPLEMENTED;
918
- }
919
-
920
- fmi3Status
921
- fmi3GetNominalsOfContinuousStates(fmi3Instance instance, fmi3Float64 nominals[],
922
- size_t nContinuousStates)
923
- {
924
- NOT_IMPLEMENTED;
925
- }
926
-
927
- fmi3Status
928
- fmi3GetNumberOfEventIndicators(fmi3Instance instance, size_t* nEventIndicators)
929
- {
930
- NOT_IMPLEMENTED;
931
- }
932
-
933
- fmi3Status
934
- fmi3GetNumberOfContinuousStates(fmi3Instance instance, size_t* nContinuousStates)
935
- {
936
- NOT_IMPLEMENTED;
937
- }
1
+ /* Copyright 2016-2019, SINTEF Ocean.
2
+ * This Source Code Form is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ */
6
+ #include "cppfmu/cppfmu_cs.hpp"
7
+
8
+ #include <exception>
9
+ #include <limits>
10
+
11
+ #define NOT_IMPLEMENTED throw std::logic_error("function " + std::string(__func__) + " not implemented")
12
+
13
+
14
+ #define NOT_IMPLEMENTED_GETTER(suffix, var) fmi3Status fmi3Get##suffix( \
15
+ fmi3Instance c, \
16
+ const fmi3ValueReference vr[], \
17
+ size_t nValueReferences, \
18
+ var values[], \
19
+ size_t nValues) { NOT_IMPLEMENTED;}
20
+
21
+ #define NOT_IMPLEMENTED_SETTER(suffix, var) fmi3Status fmi3Set##suffix ( \
22
+ fmi3Instance c, \
23
+ const fmi3ValueReference vr[], \
24
+ size_t nValueReferences, \
25
+ const var values[], \
26
+ size_t nValues) { NOT_IMPLEMENTED;}
27
+
28
+ namespace
29
+ {
30
+ // A struct that holds all the data for one model instance.
31
+ struct Component
32
+ {
33
+ enum class State
34
+ {
35
+ StartAndEnd = 1 << 0,
36
+ ConfigurationMode = 1 << 1,
37
+ Instantiated = 1 << 2,
38
+ InitializationMode = 1 << 3,
39
+ EventMode = 1 << 4,
40
+ ContinuousTimeMode = 1 << 5,
41
+ StepMode = 1 << 6,
42
+ ClockActivationMode = 1 << 7,
43
+ StepDiscarded = 1 << 8,
44
+ ReconfigurationMode = 1 << 9,
45
+ IntermediateUpdateMode = 1 << 10,
46
+ Terminated = 1 << 11,
47
+ modelError = 1 << 12,
48
+ modelFatal = 1 << 13,
49
+ };
50
+ Component(cppfmu::FMIComponentEnvironment instanceEnvironment,
51
+ cppfmu::FMICallbackLogger logCallback,
52
+ cppfmu::FMIBoolean loggingOn) : loggerSettings{std::make_shared<cppfmu::Logger::Settings>()},
53
+ logger{instanceEnvironment, logCallback, loggerSettings}
54
+ {
55
+ loggerSettings->debugLoggingEnabled = (loggingOn == cppfmu::FMITrue);
56
+ }
57
+
58
+ // General
59
+ std::shared_ptr<cppfmu::Logger::Settings> loggerSettings;
60
+ cppfmu::Logger logger;
61
+ State state;
62
+
63
+ // Co-simulation
64
+ std::unique_ptr<cppfmu::SlaveInstance> slave;
65
+ };
66
+ } // namespace
67
+
68
+
69
+ // FMI functions
70
+ extern "C" {
71
+
72
+ // =============================================================================
73
+ // FMI 3.0 functions
74
+ // =============================================================================
75
+
76
+
77
+ const char* fmi3GetVersion()
78
+ {
79
+ return "3.0";
80
+ }
81
+
82
+
83
+ fmi3Instance fmi3InstantiateCoSimulation(
84
+ fmi3String instanceName,
85
+ fmi3String instantiationToken,
86
+ fmi3String fmuResourceLocation,
87
+ fmi3Boolean visible,
88
+ fmi3Boolean loggingOn,
89
+ fmi3Boolean eventModeUsed,
90
+ fmi3Boolean earlyReturnAllowed,
91
+ fmi3ValueReference const[],
92
+ size_t nRequiredIntermediateVariables,
93
+ fmi3InstanceEnvironment environment,
94
+ fmi3LogMessageCallback logMessage,
95
+ fmi3IntermediateUpdateCallback intermediateUpdate )
96
+ {
97
+ try {
98
+ auto component = new Component(
99
+ environment,
100
+ logMessage,
101
+ loggingOn);
102
+ component->slave = CppfmuInstantiateSlave(
103
+ instanceName,
104
+ instantiationToken,
105
+ fmuResourceLocation,
106
+ "application/x-fmu-sharedlibrary",
107
+ 0.0,
108
+ visible,
109
+ cppfmu::FMIFalse,
110
+ component->logger);
111
+ return component;
112
+ } catch (const cppfmu::FatalError& e) {
113
+ // functions->logger(nullptr, instanceName, fmi3Fatal, "", e.what());
114
+ return nullptr;
115
+ } catch (const std::exception& e) {
116
+ // functions->logger(nullptr, instanceName, fmi3Error, "", e.what());
117
+ return nullptr;
118
+ }
119
+ }
120
+
121
+ fmi3Instance fmi3InstantiateModelExchange(
122
+ fmi3String instanceName,
123
+ fmi3String instantiationToken,
124
+ fmi3String resourcePath,
125
+ fmi3Boolean visible,
126
+ fmi3Boolean loggingOn,
127
+ fmi3InstanceEnvironment instanceEnvironment,
128
+ fmi3LogMessageCallback logMessage)
129
+ {
130
+ throw std::logic_error("Unsupported FMU instance type requested (only co-simulation is supported)");
131
+ }
132
+
133
+ fmi3Instance fmi3InstantiateScheduledExecution(
134
+ fmi3String instanceName,
135
+ fmi3String instantiationToken,
136
+ fmi3String resourcePath,
137
+ fmi3Boolean visible,
138
+ fmi3Boolean loggingOn,
139
+ fmi3InstanceEnvironment instanceEnvironment,
140
+ fmi3LogMessageCallback logMessage,
141
+ fmi3ClockUpdateCallback clockUpdate,
142
+ fmi3LockPreemptionCallback lockPreemption,
143
+ fmi3UnlockPreemptionCallback unlockPreemption)
144
+ {
145
+ throw std::logic_error("Unsupported FMU instance type requested (only co-simulation is supported)");
146
+ }
147
+
148
+
149
+ void fmi3FreeInstance(fmi3Instance c)
150
+ {
151
+ const auto component = reinterpret_cast<Component*>(c);
152
+ delete component;
153
+ }
154
+
155
+
156
+ fmi3Status fmi3SetDebugLogging(
157
+ fmi3Instance c,
158
+ fmi3Boolean loggingOn,
159
+ size_t nCategories,
160
+ const fmi3String categories[])
161
+ {
162
+ const auto component = reinterpret_cast<Component*>(c);
163
+
164
+ std::vector<cppfmu::String> newCategories;
165
+ for (size_t i = 0; i < nCategories; ++i) {
166
+ newCategories.push_back(categories[i]);
167
+ }
168
+
169
+ component->loggerSettings->debugLoggingEnabled = (loggingOn == fmi3True);
170
+ component->loggerSettings->loggedCategories.swap(newCategories);
171
+ return fmi3OK;
172
+ }
173
+
174
+ fmi3Status fmi3EnterInitializationMode(fmi3Instance c, fmi3Boolean, fmi3Float64, fmi3Float64, fmi3Boolean, fmi3Float64)
175
+ {
176
+ const auto component = reinterpret_cast<Component*>(c);
177
+ try {
178
+ component->slave->EnterInitializationMode();
179
+ return fmi3OK;
180
+ } catch (const cppfmu::FatalError& e) {
181
+ component->logger.Log(fmi3Fatal, "", e.what());
182
+ return fmi3Fatal;
183
+ } catch (const std::exception& e) {
184
+ component->logger.Log(fmi3Error, "", e.what());
185
+ return fmi3Error;
186
+ }
187
+ }
188
+
189
+
190
+ fmi3Status fmi3ExitInitializationMode(fmi3Instance c)
191
+ {
192
+ const auto component = reinterpret_cast<Component*>(c);
193
+ try {
194
+ component->slave->ExitInitializationMode();
195
+ return fmi3OK;
196
+ } catch (const cppfmu::FatalError& e) {
197
+ component->logger.Log(fmi3Fatal, "", e.what());
198
+ return fmi3Fatal;
199
+ } catch (const std::exception& e) {
200
+ component->logger.Log(fmi3Error, "", e.what());
201
+ return fmi3Error;
202
+ }
203
+ }
204
+
205
+ fmi3Status fmi3EnterConfigurationMode(fmi3Instance c)
206
+ {
207
+
208
+ const auto component = reinterpret_cast<Component*>(c);
209
+ component->state = Component::State::ConfigurationMode;
210
+ return fmi3OK;
211
+
212
+ }
213
+
214
+ fmi3Status fmi3ExitConfigurationMode(fmi3Instance c)
215
+ {
216
+ const auto component = reinterpret_cast<Component*>(c);
217
+ if (component->state == Component::State::ConfigurationMode)
218
+ {
219
+ component->state = Component::State::Instantiated;
220
+
221
+ } else{
222
+ component->state = Component::State::StepMode;
223
+ }
224
+ return fmi3OK;
225
+ }
226
+
227
+ fmi3Status fmi3EnterEventMode(fmi3Instance c)
228
+ {
229
+ const auto component = reinterpret_cast<Component*>(c);
230
+ component->state = Component::State::EventMode;
231
+ return fmi3OK;
232
+ }
233
+
234
+ fmi3Status fmi3EnterStepMode(fmi3Instance c)
235
+ {
236
+ const auto component = reinterpret_cast<Component*>(c);
237
+ component->state = Component::State::StepMode;
238
+ return fmi3OK;
239
+ }
240
+
241
+
242
+ fmi3Status fmi3Terminate(fmi3Instance c)
243
+ {
244
+ const auto component = reinterpret_cast<Component*>(c);
245
+ try {
246
+ component->slave->Terminate();
247
+ return fmi3OK;
248
+ } catch (const cppfmu::FatalError& e) {
249
+ component->logger.Log(fmi3Fatal, "", e.what());
250
+ return fmi3Fatal;
251
+ } catch (const std::exception& e) {
252
+ component->logger.Log(fmi3Error, "", e.what());
253
+ return fmi3Error;
254
+ }
255
+ }
256
+
257
+
258
+ fmi3Status fmi3Reset(fmi3Instance c)
259
+ {
260
+ const auto component = reinterpret_cast<Component*>(c);
261
+ try {
262
+ component->slave->Reset();
263
+ return fmi3OK;
264
+ } catch (const cppfmu::FatalError& e) {
265
+ component->logger.Log(fmi3Fatal, "", e.what());
266
+ return fmi3Fatal;
267
+ } catch (const std::exception& e) {
268
+ component->logger.Log(fmi3Error, "", e.what());
269
+ return fmi3Error;
270
+ }
271
+ }
272
+
273
+
274
+ fmi3Status fmi3GetFloat64(
275
+ fmi3Instance c,
276
+ const fmi3ValueReference vr[],
277
+ size_t nvr,
278
+ fmi3Float64 values[],
279
+ size_t nValues)
280
+ {
281
+ const auto component = reinterpret_cast<Component*>(c);
282
+ try {
283
+ component->slave->GetFloat64(vr, nvr, values, nValues);
284
+ return fmi3OK;
285
+ } catch (const cppfmu::FatalError& e) {
286
+ component->logger.Log(fmi3Fatal, "", e.what());
287
+ return fmi3Fatal;
288
+ } catch (const std::exception& e) {
289
+ component->logger.Log(fmi3Error, "", e.what());
290
+ return fmi3Error;
291
+ }
292
+ }
293
+
294
+ fmi3Status fmi3GetInt32(
295
+ fmi3Instance c,
296
+ const fmi3ValueReference vr[],
297
+ size_t nvr,
298
+ fmi3Int32 values[],
299
+ size_t nValues)
300
+ {
301
+ const auto component = reinterpret_cast<Component*>(c);
302
+ try {
303
+ component->slave->GetInt32(vr, nvr, values);
304
+ return fmi3OK;
305
+ } catch (const cppfmu::FatalError& e) {
306
+ component->logger.Log(fmi3Fatal, "", e.what());
307
+ return fmi3Fatal;
308
+ } catch (const std::exception& e) {
309
+ component->logger.Log(fmi3Error, "", e.what());
310
+ return fmi3Error;
311
+ }
312
+ }
313
+
314
+ fmi3Status fmi3GetInt64(
315
+ fmi3Instance c,
316
+ const fmi3ValueReference vr[],
317
+ size_t nvr,
318
+ fmi3Int64 values[],
319
+ size_t nValues)
320
+ {
321
+ const auto component = reinterpret_cast<Component*>(c);
322
+ try {
323
+ component->slave->GetInt64(vr, nvr, values);
324
+ return fmi3OK;
325
+ } catch (const cppfmu::FatalError& e) {
326
+ component->logger.Log(fmi3Fatal, "", e.what());
327
+ return fmi3Fatal;
328
+ } catch (const std::exception& e) {
329
+ component->logger.Log(fmi3Error, "", e.what());
330
+ return fmi3Error;
331
+ }
332
+ }
333
+
334
+ fmi3Status fmi3GetUInt64(
335
+ fmi3Instance c,
336
+ const fmi3ValueReference vr[],
337
+ size_t nvr,
338
+ fmi3UInt64 values[],
339
+ size_t nValues)
340
+ {
341
+ const auto component = reinterpret_cast<Component*>(c);
342
+ try {
343
+ component->slave->GetUInt64(vr, nvr, values);
344
+ return fmi3OK;
345
+ } catch (const cppfmu::FatalError& e) {
346
+ component->logger.Log(fmi3Fatal, "", e.what());
347
+ return fmi3Fatal;
348
+ } catch (const std::exception& e) {
349
+ component->logger.Log(fmi3Error, "", e.what());
350
+ return fmi3Error;
351
+ }
352
+ }
353
+
354
+ fmi3Status fmi3GetBoolean(
355
+ fmi3Instance c,
356
+ const fmi3ValueReference vr[],
357
+ size_t nvr,
358
+ fmi3Boolean values[],
359
+ size_t nValues)
360
+ {
361
+ const auto component = reinterpret_cast<Component*>(c);
362
+ try {
363
+ component->slave->GetBoolean(vr, nvr, values);
364
+ return fmi3OK;
365
+ } catch (const cppfmu::FatalError& e) {
366
+ component->logger.Log(fmi3Fatal, "", e.what());
367
+ return fmi3Fatal;
368
+ } catch (const std::exception& e) {
369
+ component->logger.Log(fmi3Error, "", e.what());
370
+ return fmi3Error;
371
+ }
372
+ }
373
+
374
+ fmi3Status fmi3GetString(
375
+ fmi3Instance c,
376
+ const fmi3ValueReference vr[],
377
+ size_t nvr,
378
+ fmi3String values[],
379
+ size_t nValues)
380
+ {
381
+ const auto component = reinterpret_cast<Component*>(c);
382
+ try {
383
+ component->slave->GetString(vr, nvr, values);
384
+ return fmi3OK;
385
+ } catch (const cppfmu::FatalError& e) {
386
+ component->logger.Log(fmi3Fatal, "", e.what());
387
+ return fmi3Fatal;
388
+ } catch (const std::exception& e) {
389
+ component->logger.Log(fmi3Error, "", e.what());
390
+ return fmi3Error;
391
+ }
392
+ }
393
+
394
+
395
+ fmi3Status fmi3SetFloat64(
396
+ fmi3Instance c,
397
+ const fmi3ValueReference vr[],
398
+ size_t nvr,
399
+ const fmi3Float64 value[],
400
+ size_t nValues)
401
+ {
402
+ const auto component = reinterpret_cast<Component*>(c);
403
+ try {
404
+ component->slave->SetFloat64(vr, nvr, value, nValues);
405
+ return fmi3OK;
406
+ } catch (const cppfmu::FatalError& e) {
407
+ component->logger.Log(fmi3Fatal, "", e.what());
408
+ return fmi3Fatal;
409
+ } catch (const std::exception& e) {
410
+ component->logger.Log(fmi3Error, "", e.what());
411
+ return fmi3Error;
412
+ }
413
+ }
414
+
415
+ fmi3Status fmi3SetInt32(
416
+ fmi3Instance c,
417
+ const fmi3ValueReference vr[],
418
+ size_t nvr,
419
+ const fmi3Int32 values[],
420
+ size_t nValues)
421
+ {
422
+ const auto component = reinterpret_cast<Component*>(c);
423
+ try {
424
+ component->slave->SetInt32(vr, nvr, values);
425
+ return fmi3OK;
426
+ } catch (const cppfmu::FatalError& e) {
427
+ component->logger.Log(fmi3Fatal, "", e.what());
428
+ return fmi3Fatal;
429
+ } catch (const std::exception& e) {
430
+ component->logger.Log(fmi3Error, "", e.what());
431
+ return fmi3Error;
432
+ }
433
+ }
434
+
435
+ fmi3Status fmi3SetInt64(
436
+ fmi3Instance c,
437
+ const fmi3ValueReference vr[],
438
+ size_t nvr,
439
+ const fmi3Int64 values[],
440
+ size_t nValues)
441
+ {
442
+ const auto component = reinterpret_cast<Component*>(c);
443
+ try {
444
+ component->slave->SetInt64(vr, nvr, values);
445
+ return fmi3OK;
446
+ } catch (const cppfmu::FatalError& e) {
447
+ component->logger.Log(fmi3Fatal, "", e.what());
448
+ return fmi3Fatal;
449
+ } catch (const std::exception& e) {
450
+ component->logger.Log(fmi3Error, "", e.what());
451
+ return fmi3Error;
452
+ }
453
+ }
454
+
455
+ fmi3Status fmi3SetUInt64(
456
+ fmi3Instance c,
457
+ const fmi3ValueReference vr[],
458
+ size_t nvr,
459
+ const fmi3UInt64 values[],
460
+ size_t nValues)
461
+ {
462
+ const auto component = reinterpret_cast<Component*>(c);
463
+ try {
464
+ component->slave->SetUInt64(vr, nvr, values);
465
+ return fmi3OK;
466
+ } catch (const cppfmu::FatalError& e) {
467
+ component->logger.Log(fmi3Fatal, "", e.what());
468
+ return fmi3Fatal;
469
+ } catch (const std::exception& e) {
470
+ component->logger.Log(fmi3Error, "", e.what());
471
+ return fmi3Error;
472
+ }
473
+ }
474
+
475
+ fmi3Status fmi3SetBoolean(
476
+ fmi3Instance c,
477
+ const fmi3ValueReference vr[],
478
+ size_t nvr,
479
+ const fmi3Boolean values[],
480
+ size_t nValues)
481
+ {
482
+ const auto component = reinterpret_cast<Component*>(c);
483
+ try {
484
+ component->slave->SetBoolean(vr, nvr, values);
485
+ return fmi3OK;
486
+ } catch (const cppfmu::FatalError& e) {
487
+ component->logger.Log(fmi3Fatal, "", e.what());
488
+ return fmi3Fatal;
489
+ } catch (const std::exception& e) {
490
+ component->logger.Log(fmi3Error, "", e.what());
491
+ return fmi3Error;
492
+ }
493
+ }
494
+
495
+ fmi3Status fmi3SetString(
496
+ fmi3Instance c,
497
+ const fmi3ValueReference vr[],
498
+ size_t nvr,
499
+ const fmi3String values[],
500
+ size_t nValues)
501
+ {
502
+ const auto component = reinterpret_cast<Component*>(c);
503
+ try {
504
+ component->slave->SetString(vr, nvr, values);
505
+ return fmi3OK;
506
+ } catch (const cppfmu::FatalError& e) {
507
+ component->logger.Log(fmi3Fatal, "", e.what());
508
+ return fmi3Fatal;
509
+ } catch (const std::exception& e) {
510
+ component->logger.Log(fmi3Error, "", e.what());
511
+ return fmi3Error;
512
+ }
513
+ }
514
+
515
+
516
+ fmi3Status fmi3GetFMUState(
517
+ fmi3Instance c,
518
+ fmi3FMUState* state)
519
+ {
520
+ const auto component = reinterpret_cast<Component*>(c);
521
+ try {
522
+ component->slave->GetFMUstate(*state);
523
+ return fmi3OK;
524
+ } catch (const cppfmu::FatalError& e) {
525
+ component->logger.Log(fmi3Fatal, "", e.what());
526
+ return fmi3Fatal;
527
+ } catch (const std::exception& e) {
528
+ component->logger.Log(fmi3Error, "", e.what());
529
+ return fmi3Error;
530
+ }
531
+ }
532
+
533
+ fmi3Status fmi3SetFMUState(
534
+ fmi3Instance c,
535
+ fmi3FMUState state)
536
+ {
537
+ const auto component = reinterpret_cast<Component*>(c);
538
+ try {
539
+ component->slave->SetFMUstate(state);
540
+ return fmi3OK;
541
+ } catch (const cppfmu::FatalError& e) {
542
+ component->logger.Log(fmi3Fatal, "", e.what());
543
+ return fmi3Fatal;
544
+ } catch (const std::exception& e) {
545
+ component->logger.Log(fmi3Error, "", e.what());
546
+ return fmi3Error;
547
+ }
548
+ }
549
+
550
+ fmi3Status fmi3FreeFMUState(
551
+ fmi3Instance c,
552
+ fmi3FMUState* state)
553
+ {
554
+ const auto component = reinterpret_cast<Component*>(c);
555
+ try {
556
+ component->slave->FreeFMUstate(*state);
557
+ return fmi3OK;
558
+ } catch (const cppfmu::FatalError& e) {
559
+ component->logger.Log(fmi3Fatal, "", e.what());
560
+ return fmi3Fatal;
561
+ } catch (const std::exception& e) {
562
+ component->logger.Log(fmi3Error, "", e.what());
563
+ return fmi3Error;
564
+ }
565
+ }
566
+
567
+ fmi3Status fmi3SerializedFMUStateSize(
568
+ fmi3Instance c,
569
+ fmi3FMUState state,
570
+ size_t* size)
571
+ {
572
+ const auto component = reinterpret_cast<Component*>(c);
573
+ try {
574
+ *size = component->slave->SerializedFMUstateSize(state);
575
+ return fmi3OK;
576
+ } catch (const cppfmu::FatalError& e) {
577
+ component->logger.Log(fmi3Fatal, "", e.what());
578
+ return fmi3Fatal;
579
+ } catch (const std::exception& e) {
580
+ component->logger.Log(fmi3Error, "", e.what());
581
+ return fmi3Error;
582
+ }
583
+ }
584
+
585
+ fmi3Status fmi3SerializeFMUState(
586
+ fmi3Instance c,
587
+ fmi3FMUState state,
588
+ fmi3Byte bytes[],
589
+ size_t size)
590
+ {
591
+ const auto component = reinterpret_cast<Component*>(c);
592
+ try {
593
+ component->slave->SerializeFMUstate(state, bytes, size);
594
+ return fmi3OK;
595
+ } catch (const cppfmu::FatalError& e) {
596
+ component->logger.Log(fmi3Fatal, "", e.what());
597
+ return fmi3Fatal;
598
+ } catch (const std::exception& e) {
599
+ component->logger.Log(fmi3Error, "", e.what());
600
+ return fmi3Error;
601
+ }
602
+ }
603
+
604
+ fmi3Status fmi3DeserializeFMUState(
605
+ fmi3Instance c,
606
+ const fmi3Byte bytes[],
607
+ size_t size,
608
+ fmi3FMUState* state)
609
+ {
610
+ const auto component = reinterpret_cast<Component*>(c);
611
+ try {
612
+ component->slave->DeSerializeFMUstate(bytes, size, *state);
613
+ return fmi3OK;
614
+ } catch (const cppfmu::FatalError& e) {
615
+ component->logger.Log(fmi3Fatal, "", e.what());
616
+ return fmi3Fatal;
617
+ } catch (const std::exception& e) {
618
+ component->logger.Log(fmi3Error, "", e.what());
619
+ return fmi3Error;
620
+ }
621
+ }
622
+
623
+
624
+ fmi3Status fmi3GetDirectionalDerivative(
625
+ fmi3Instance c,
626
+ const fmi3ValueReference[],
627
+ size_t,
628
+ const fmi3ValueReference[],
629
+ size_t,
630
+ const fmi3Float64[],
631
+ size_t,
632
+ fmi3Float64[],
633
+ size_t)
634
+ {
635
+ reinterpret_cast<Component*>(c)->logger.Log(
636
+ fmi3Error,
637
+ "cppfmu",
638
+ "FMI function not supported: fmi3GetDirectionalDerivative");
639
+ return fmi3Error;
640
+ }
641
+
642
+ fmi3Status fmi3GetOutputDerivatives(
643
+ fmi3Instance c,
644
+ const fmi3ValueReference[],
645
+ size_t,
646
+ const fmi3Int32[],
647
+ fmi3Float64[],
648
+ size_t)
649
+ {
650
+ reinterpret_cast<Component*>(c)->logger.Log(
651
+ fmi3Error,
652
+ "cppfmu",
653
+ "FMI function not supported: fmiGetOutputDerivatives");
654
+ return fmi3Error;
655
+ }
656
+
657
+ fmi3Status fmi3DoStep(
658
+ fmi3Instance c,
659
+ fmi3Float64 currentCommunicationPoint,
660
+ fmi3Float64 communicationStepSize,
661
+ fmi3Boolean noSetFmuStatePriorToCurrentPoint,
662
+ fmi3Boolean* eventHandlingNeeded ,
663
+ fmi3Boolean* terminateSimulation,
664
+ fmi3Boolean* earlyReturn,
665
+ fmi3Float64* lastSuccessfulTime)
666
+ {
667
+ const auto component = reinterpret_cast<Component*>(c);
668
+ try {
669
+ double endTime = currentCommunicationPoint;
670
+ const auto status = component->slave->DoStep(
671
+ currentCommunicationPoint,
672
+ communicationStepSize,
673
+ noSetFmuStatePriorToCurrentPoint,
674
+ eventHandlingNeeded,
675
+ terminateSimulation,
676
+ earlyReturn,
677
+ endTime);
678
+ if (status == fmi3Status::fmi3OK) {
679
+ *lastSuccessfulTime =
680
+ currentCommunicationPoint + communicationStepSize;
681
+ return fmi3OK;
682
+ } else {
683
+ *lastSuccessfulTime = endTime;
684
+ return status;
685
+ }
686
+ } catch (const cppfmu::FatalError& e) {
687
+ component->logger.Log(fmi3Fatal, "", e.what());
688
+ return fmi3Fatal;
689
+ } catch (const std::exception& e) {
690
+ component->logger.Log(fmi3Error, "", e.what());
691
+ return fmi3Error;
692
+ }
693
+ }
694
+ }
695
+
696
+ // NOT IMPLEMENTED
697
+
698
+ NOT_IMPLEMENTED_GETTER(Float32, fmi3Float32);
699
+ NOT_IMPLEMENTED_SETTER(Float32, fmi3Float32);
700
+
701
+ NOT_IMPLEMENTED_GETTER(Int8, fmi3Int8);
702
+ NOT_IMPLEMENTED_SETTER(Int8, fmi3Int8);
703
+ NOT_IMPLEMENTED_GETTER(Int16, fmi3Int16);
704
+ NOT_IMPLEMENTED_SETTER(Int16, fmi3Int16);
705
+
706
+ NOT_IMPLEMENTED_GETTER(UInt8, fmi3UInt8);
707
+ NOT_IMPLEMENTED_SETTER(UInt8, fmi3UInt8);
708
+ NOT_IMPLEMENTED_GETTER(UInt16, fmi3UInt16);
709
+ NOT_IMPLEMENTED_SETTER(UInt16, fmi3UInt16);
710
+ NOT_IMPLEMENTED_GETTER(UInt32, fmi3UInt32);
711
+ NOT_IMPLEMENTED_SETTER(UInt32, fmi3UInt32);
712
+
713
+
714
+ fmi3Status fmi3GetClock(fmi3Instance instance,
715
+ const fmi3ValueReference valueReferences[],
716
+ size_t nValueReferences,
717
+ fmi3Clock values[])
718
+ {
719
+ NOT_IMPLEMENTED;
720
+ }
721
+
722
+ fmi3Status fmi3SetClock(fmi3Instance instance,
723
+ const fmi3ValueReference valueReferences[],
724
+ size_t nValueReferences,
725
+ const fmi3Clock values[])
726
+ {
727
+ NOT_IMPLEMENTED;
728
+ }
729
+
730
+ fmi3Status fmi3GetBinary(fmi3Instance instance,
731
+ const fmi3ValueReference valueReferences[],
732
+ size_t nValueReferences,
733
+ size_t valueSizes[],
734
+ fmi3Binary values[],
735
+ size_t nValues)
736
+ {
737
+
738
+ NOT_IMPLEMENTED;
739
+ }
740
+
741
+ fmi3Status fmi3SetBinary(fmi3Instance instance,
742
+ const fmi3ValueReference valueReferences[],
743
+ size_t nValueReferences,
744
+ const size_t valueSizes[],
745
+ const fmi3Binary values[],
746
+ size_t nValues)
747
+ {
748
+ NOT_IMPLEMENTED;
749
+ }
750
+
751
+ fmi3Status fmi3GetNumberOfVariableDependencies(fmi3Instance instance,
752
+ fmi3ValueReference valueReference,
753
+ size_t* nDependencies)
754
+ {
755
+ NOT_IMPLEMENTED;
756
+ }
757
+
758
+ fmi3Status fmi3GetVariableDependencies(fmi3Instance instance,
759
+ fmi3ValueReference dependent,
760
+ size_t elementIndicesOfDependent[],
761
+ fmi3ValueReference independents[],
762
+ size_t elementIndicesOfIndependents[],
763
+ fmi3DependencyKind dependencyKinds[],
764
+ size_t nDependencies)
765
+ {
766
+ NOT_IMPLEMENTED;
767
+ }
768
+
769
+ fmi3Status fmi3GetAdjointDerivative(fmi3Instance instance,
770
+ const fmi3ValueReference unknowns[],
771
+ size_t nUnknowns,
772
+ const fmi3ValueReference knowns[],
773
+ size_t nKnowns,
774
+ const fmi3Float64 seed[],
775
+ size_t nSeed,
776
+ fmi3Float64 sensitivity[],
777
+ size_t nSensitivity)
778
+ {
779
+ NOT_IMPLEMENTED;
780
+ }
781
+
782
+ fmi3Status fmi3GetIntervalDecimal(
783
+ fmi3Instance instance,
784
+ const fmi3ValueReference valueReferences[],
785
+ size_t nValueReferences,
786
+ fmi3Float64 intervals[],
787
+ fmi3IntervalQualifier qualifiers[])
788
+ {
789
+ NOT_IMPLEMENTED;
790
+ }
791
+
792
+ fmi3Status fmi3GetIntervalFraction(
793
+ fmi3Instance instance,
794
+ const fmi3ValueReference valueReferences[],
795
+ size_t nValueReferences,
796
+ fmi3UInt64 intervalCounters[],
797
+ fmi3UInt64 resolutions[],
798
+ fmi3IntervalQualifier qualifiers[])
799
+ {
800
+ NOT_IMPLEMENTED;
801
+ }
802
+
803
+ fmi3Status
804
+ fmi3GetShiftDecimal(fmi3Instance instance, const fmi3ValueReference valueReferences[],
805
+ size_t nValueReferences, fmi3Float64 shifts[])
806
+ {
807
+ NOT_IMPLEMENTED;
808
+ }
809
+
810
+ fmi3Status
811
+ fmi3GetShiftFraction(fmi3Instance instance, const fmi3ValueReference valueReferences[],
812
+ size_t nValueReferences, fmi3UInt64 shiftCounters[], fmi3UInt64 resolutions[])
813
+ {
814
+ NOT_IMPLEMENTED;
815
+ }
816
+
817
+ fmi3Status
818
+ fmi3SetIntervalDecimal(fmi3Instance instance, const fmi3ValueReference valueReferences[],
819
+ size_t nValueReferences, const fmi3Float64 intervals[])
820
+ {
821
+ NOT_IMPLEMENTED;
822
+ }
823
+
824
+ fmi3Status
825
+ fmi3SetIntervalFraction(fmi3Instance instance, const fmi3ValueReference valueReferences[],
826
+ size_t nValueReferences, const fmi3UInt64 intervalCounters[],
827
+ const fmi3UInt64 resolutions[])
828
+ {
829
+ NOT_IMPLEMENTED;
830
+ }
831
+
832
+ fmi3Status
833
+ fmi3SetShiftDecimal(fmi3Instance instance, const fmi3ValueReference valueReferences[],
834
+ size_t nValueReferences, const fmi3Float64 shifts[])
835
+ {
836
+ NOT_IMPLEMENTED;
837
+ }
838
+
839
+ fmi3Status
840
+ fmi3SetShiftFraction(fmi3Instance instance, const fmi3ValueReference valueReferences[],
841
+ size_t nValueReferences, const fmi3UInt64 shiftCounters[],
842
+ const fmi3UInt64 resolutions[])
843
+ {
844
+ NOT_IMPLEMENTED;
845
+ }
846
+
847
+ fmi3Status
848
+ fmi3EvaluateDiscreteStates(fmi3Instance instance)
849
+ {
850
+ NOT_IMPLEMENTED;
851
+ }
852
+
853
+ fmi3Status
854
+ fmi3UpdateDiscreteStates(fmi3Instance instance, fmi3Boolean* discreteStatesNeedUpdate,
855
+ fmi3Boolean* terminateSimulation,
856
+ fmi3Boolean* nominalsOfContinuousStatesChanged,
857
+ fmi3Boolean* valuesOfContinuousStatesChanged,
858
+ fmi3Boolean* nextEventTimeDefined, fmi3Float64* nextEventTime)
859
+ {
860
+ NOT_IMPLEMENTED;
861
+ }
862
+
863
+ fmi3Status fmi3ActivateModelPartition(fmi3Instance instance, fmi3ValueReference clockReference,
864
+ fmi3Float64 activationTime)
865
+ {
866
+ NOT_IMPLEMENTED;
867
+ }
868
+
869
+
870
+ // model exchange functions
871
+ fmi3Status
872
+ fmi3EnterContinuousTimeMode(fmi3Instance instance)
873
+ {
874
+ NOT_IMPLEMENTED;
875
+ }
876
+
877
+ fmi3Status
878
+ fmi3CompletedIntegratorStep(fmi3Instance instance, fmi3Boolean noSetFMUStatePriorToCurrentPoint,
879
+ fmi3Boolean* enterEventMode, fmi3Boolean* terminateSimulation)
880
+ {
881
+ NOT_IMPLEMENTED;
882
+ }
883
+
884
+ /* Providing independent variables and re-initialization of caching */
885
+ fmi3Status
886
+ fmi3SetTime(fmi3Instance instance, fmi3Float64 time)
887
+ {
888
+ NOT_IMPLEMENTED;
889
+ }
890
+
891
+ fmi3Status
892
+ fmi3SetContinuousStates(fmi3Instance instance, const fmi3Float64 continuousStates[],
893
+ size_t nContinuousStates)
894
+ {
895
+ NOT_IMPLEMENTED;
896
+ }
897
+
898
+ /* Evaluation of the model equations */
899
+ fmi3Status
900
+ fmi3GetContinuousStateDerivatives(fmi3Instance instance, fmi3Float64 derivatives[],
901
+ size_t nContinuousStates)
902
+ {
903
+ NOT_IMPLEMENTED;
904
+ }
905
+
906
+ fmi3Status
907
+ fmi3GetEventIndicators(fmi3Instance instance, fmi3Float64 eventIndicators[],
908
+ size_t nEventIndicators)
909
+ {
910
+ NOT_IMPLEMENTED;
911
+ }
912
+
913
+ fmi3Status
914
+ fmi3GetContinuousStates(fmi3Instance instance, fmi3Float64 continuousStates[],
915
+ size_t nContinuousStates)
916
+ {
917
+ NOT_IMPLEMENTED;
918
+ }
919
+
920
+ fmi3Status
921
+ fmi3GetNominalsOfContinuousStates(fmi3Instance instance, fmi3Float64 nominals[],
922
+ size_t nContinuousStates)
923
+ {
924
+ NOT_IMPLEMENTED;
925
+ }
926
+
927
+ fmi3Status
928
+ fmi3GetNumberOfEventIndicators(fmi3Instance instance, size_t* nEventIndicators)
929
+ {
930
+ NOT_IMPLEMENTED;
931
+ }
932
+
933
+ fmi3Status
934
+ fmi3GetNumberOfContinuousStates(fmi3Instance instance, size_t* nContinuousStates)
935
+ {
936
+ NOT_IMPLEMENTED;
937
+ }