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,180 +1,180 @@
1
- import sys
2
- import itertools
3
- import pytest
4
- from unittest.mock import call, MagicMock
5
-
6
- from pythonfmu3.builder import FmuBuilder
7
- from pythonfmu3.enums import Fmi3Status
8
- from pythonfmu3.fmi3slave import Fmi3Slave
9
-
10
- fmpy = pytest.importorskip(
11
- "fmpy", reason="fmpy is not available for testing the produced FMU"
12
- )
13
- pytestmark = pytest.mark.skipif(
14
- not FmuBuilder.has_binary(), reason="No binary available for the current platform."
15
- )
16
-
17
- if True:
18
- pytest.skip("This test needs to be manually enabled", allow_module_level=True)
19
-
20
-
21
- @pytest.mark.integration
22
- @pytest.mark.parametrize("debug_logging", [True, False])
23
- def test_logger(tmp_path, debug_logging):
24
- name = "PythonSlaveWithDebugLogger" if debug_logging else "PythonSlaveWithLogger"
25
- category = "category"
26
- message = "log message"
27
-
28
- log_calls = [
29
- (
30
- f"{status.name.upper()} - {debug} - {message}",
31
- status,
32
- category,
33
- debug
34
- ) for debug, status in itertools.product([True, False], Fmi3Status)
35
- ]
36
-
37
- fmu_calls = "\n".join([
38
- ' self.log("{}", Fmi3Status.{}, "{}", {})'.format(c[0], c[1].name, c[2], c[3]) for c in log_calls
39
- ])
40
-
41
- slave_code = f"""from pythonfmu3.Fmi3Slave import Fmi3Slave, Fmi3Status, Fmi3Causality, Int32, Float64, Boolean, String
42
-
43
-
44
- class {name}(Fmi3Slave):
45
-
46
- def __init__(self, **kwargs):
47
- super().__init__(**kwargs)
48
-
49
- self.realIn = 22.0
50
- self.realOut = 0.0
51
- self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
52
- self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
53
-
54
-
55
- def do_step(self, current_time, step_size):
56
- {fmu_calls}
57
- return True
58
- """
59
-
60
- script_file = tmp_path / "orig" / f"{name.lower()}.py"
61
- script_file.parent.mkdir(parents=True, exist_ok=True)
62
- script_file.write_text(slave_code)
63
-
64
- fmu = FmuBuilder.build_FMU(script_file, dest=tmp_path)
65
- assert fmu.exists()
66
-
67
- logger = MagicMock()
68
-
69
- fmpy.simulate_fmu(
70
- str(fmu),
71
- stop_time=1e-3,
72
- output_interval=1e-3,
73
- logger=logger,
74
- debug_logging=debug_logging
75
- )
76
-
77
- expected_calls = [
78
- call(
79
- logger.call_args[0][0], # Don't test the first argument
80
- bytes(name, encoding="utf-8"),
81
- int(c[1]),
82
- bytes(c[2], encoding="utf-8"),
83
- bytes(c[0], encoding="utf-8")
84
- ) for c in filter(lambda c: debug_logging or not c[3], log_calls)
85
- ]
86
-
87
- assert logger.call_count == len(Fmi3Status) * (1 + int(debug_logging))
88
- logger.assert_has_calls(expected_calls)
89
-
90
-
91
- @pytest.mark.integration
92
- @pytest.mark.parametrize("debug_logging", [True, False])
93
- @pytest.mark.parametrize("categories", [(), ("logStatusError", "logStatusFatal")])
94
- def test_log_categories(tmp_path, debug_logging, categories):
95
- name = "PythonSlaveDebugCategories" if debug_logging else "PythonSlaveCategories"
96
- message = "log message"
97
-
98
- log_calls = [
99
- (
100
- f"{status.name.upper()} - {debug} - {message}",
101
- status,
102
- debug
103
- ) for debug, status in itertools.product([True, False], Fmi3Status)
104
- ]
105
-
106
- fmu_calls = "\n".join([
107
- ' self.log("{}", Fmi3Status.{}, None, {})'.format(c[0], c[1].name, c[2]) for c in log_calls
108
- ])
109
-
110
- slave_code = f"""from pythonfmu3.Fmi3Slave import Fmi3Slave, Fmi3Status, Fmi3Causality, Int32, Float64, Boolean, String
111
-
112
-
113
- class {name}(Fmi3Slave):
114
-
115
- def __init__(self, **kwargs):
116
- super().__init__(**kwargs)
117
-
118
- self.realIn = 22.0
119
- self.realOut = 0.0
120
- self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
121
- self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
122
-
123
-
124
- def do_step(self, current_time, step_size):
125
- {fmu_calls}
126
- return True
127
- """
128
-
129
- script_file = tmp_path / "orig" / f"{name.lower()}.py"
130
- script_file.parent.mkdir(parents=True, exist_ok=True)
131
- script_file.write_text(slave_code)
132
-
133
- fmu = FmuBuilder.build_FMU(script_file, dest=tmp_path)
134
- assert fmu.exists()
135
-
136
- logger = MagicMock()
137
-
138
- # Load the model
139
- callbacks = fmpy.fmi3.fmi3CallbackFunctions()
140
- callbacks.logger = fmpy.fmi3.fmi3CallbackLoggerTYPE(logger)
141
- callbacks.allocateMemory = fmpy.fmi3.fmi3CallbackAllocateMemoryTYPE(fmpy.calloc)
142
- callbacks.freeMemory = fmpy.fmi3.fmi3CallbackFreeMemoryTYPE(fmpy.free)
143
-
144
- model_description = fmpy.read_model_description(fmu)
145
- unzip_dir = fmpy.extract(fmu)
146
-
147
- model = fmpy.fmi3.FMI3Slave(
148
- guid=model_description.guid,
149
- unzipDirectory=unzip_dir,
150
- modelIdentifier=model_description.coSimulation.modelIdentifier,
151
- instanceName='instance1')
152
- # Instantiate the model
153
- model.instantiate(callbacks=callbacks)
154
- model.setDebugLogging(debug_logging, categories)
155
- model.setupExperiment()
156
- model.enterInitializationMode()
157
- model.exitInitializationMode()
158
- # Execute the model
159
- model.doStep(0., 0.1)
160
- # Clean the model
161
- model.terminate()
162
-
163
- expected_calls = []
164
- for c in filter(lambda c: debug_logging or not c[2], log_calls):
165
- category = f"logStatus{c[1].name.capitalize()}"
166
- if category not in Fmi3Slave.log_categories:
167
- category = "logAll"
168
- if len(categories) == 0 or category in categories:
169
- expected_calls.append(call(
170
- logger.call_args[0][0], # Don't test the first argument
171
- b'instance1',
172
- int(c[1]),
173
- bytes(category, encoding="utf-8"),
174
- bytes(c[0], encoding="utf-8")
175
- ))
176
-
177
- n_calls = len(Fmi3Status) if len(categories) == 0 else len(categories)
178
-
179
- assert logger.call_count == n_calls * (1 + int(debug_logging))
180
- logger.assert_has_calls(expected_calls)
1
+ import sys
2
+ import itertools
3
+ import pytest
4
+ from unittest.mock import call, MagicMock
5
+
6
+ from pythonfmu3.builder import FmuBuilder
7
+ from pythonfmu3.enums import Fmi3Status
8
+ from pythonfmu3.fmi3slave import Fmi3Slave
9
+
10
+ fmpy = pytest.importorskip(
11
+ "fmpy", reason="fmpy is not available for testing the produced FMU"
12
+ )
13
+ pytestmark = pytest.mark.skipif(
14
+ not FmuBuilder.has_binary(), reason="No binary available for the current platform."
15
+ )
16
+
17
+ if True:
18
+ pytest.skip("This test needs to be manually enabled", allow_module_level=True)
19
+
20
+
21
+ @pytest.mark.integration
22
+ @pytest.mark.parametrize("debug_logging", [True, False])
23
+ def test_logger(tmp_path, debug_logging):
24
+ name = "PythonSlaveWithDebugLogger" if debug_logging else "PythonSlaveWithLogger"
25
+ category = "category"
26
+ message = "log message"
27
+
28
+ log_calls = [
29
+ (
30
+ f"{status.name.upper()} - {debug} - {message}",
31
+ status,
32
+ category,
33
+ debug
34
+ ) for debug, status in itertools.product([True, False], Fmi3Status)
35
+ ]
36
+
37
+ fmu_calls = "\n".join([
38
+ ' self.log("{}", Fmi3Status.{}, "{}", {})'.format(c[0], c[1].name, c[2], c[3]) for c in log_calls
39
+ ])
40
+
41
+ slave_code = f"""from pythonfmu3.Fmi3Slave import Fmi3Slave, Fmi3Status, Fmi3Causality, Int32, Float64, Boolean, String
42
+
43
+
44
+ class {name}(Fmi3Slave):
45
+
46
+ def __init__(self, **kwargs):
47
+ super().__init__(**kwargs)
48
+
49
+ self.realIn = 22.0
50
+ self.realOut = 0.0
51
+ self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
52
+ self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
53
+
54
+
55
+ def do_step(self, current_time, step_size):
56
+ {fmu_calls}
57
+ return True
58
+ """
59
+
60
+ script_file = tmp_path / "orig" / f"{name.lower()}.py"
61
+ script_file.parent.mkdir(parents=True, exist_ok=True)
62
+ script_file.write_text(slave_code)
63
+
64
+ fmu = FmuBuilder.build_FMU(script_file, dest=tmp_path)
65
+ assert fmu.exists()
66
+
67
+ logger = MagicMock()
68
+
69
+ fmpy.simulate_fmu(
70
+ str(fmu),
71
+ stop_time=1e-3,
72
+ output_interval=1e-3,
73
+ logger=logger,
74
+ debug_logging=debug_logging
75
+ )
76
+
77
+ expected_calls = [
78
+ call(
79
+ logger.call_args[0][0], # Don't test the first argument
80
+ bytes(name, encoding="utf-8"),
81
+ int(c[1]),
82
+ bytes(c[2], encoding="utf-8"),
83
+ bytes(c[0], encoding="utf-8")
84
+ ) for c in filter(lambda c: debug_logging or not c[3], log_calls)
85
+ ]
86
+
87
+ assert logger.call_count == len(Fmi3Status) * (1 + int(debug_logging))
88
+ logger.assert_has_calls(expected_calls)
89
+
90
+
91
+ @pytest.mark.integration
92
+ @pytest.mark.parametrize("debug_logging", [True, False])
93
+ @pytest.mark.parametrize("categories", [(), ("logStatusError", "logStatusFatal")])
94
+ def test_log_categories(tmp_path, debug_logging, categories):
95
+ name = "PythonSlaveDebugCategories" if debug_logging else "PythonSlaveCategories"
96
+ message = "log message"
97
+
98
+ log_calls = [
99
+ (
100
+ f"{status.name.upper()} - {debug} - {message}",
101
+ status,
102
+ debug
103
+ ) for debug, status in itertools.product([True, False], Fmi3Status)
104
+ ]
105
+
106
+ fmu_calls = "\n".join([
107
+ ' self.log("{}", Fmi3Status.{}, None, {})'.format(c[0], c[1].name, c[2]) for c in log_calls
108
+ ])
109
+
110
+ slave_code = f"""from pythonfmu3.Fmi3Slave import Fmi3Slave, Fmi3Status, Fmi3Causality, Int32, Float64, Boolean, String
111
+
112
+
113
+ class {name}(Fmi3Slave):
114
+
115
+ def __init__(self, **kwargs):
116
+ super().__init__(**kwargs)
117
+
118
+ self.realIn = 22.0
119
+ self.realOut = 0.0
120
+ self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
121
+ self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
122
+
123
+
124
+ def do_step(self, current_time, step_size):
125
+ {fmu_calls}
126
+ return True
127
+ """
128
+
129
+ script_file = tmp_path / "orig" / f"{name.lower()}.py"
130
+ script_file.parent.mkdir(parents=True, exist_ok=True)
131
+ script_file.write_text(slave_code)
132
+
133
+ fmu = FmuBuilder.build_FMU(script_file, dest=tmp_path)
134
+ assert fmu.exists()
135
+
136
+ logger = MagicMock()
137
+
138
+ # Load the model
139
+ callbacks = fmpy.fmi3.fmi3CallbackFunctions()
140
+ callbacks.logger = fmpy.fmi3.fmi3CallbackLoggerTYPE(logger)
141
+ callbacks.allocateMemory = fmpy.fmi3.fmi3CallbackAllocateMemoryTYPE(fmpy.calloc)
142
+ callbacks.freeMemory = fmpy.fmi3.fmi3CallbackFreeMemoryTYPE(fmpy.free)
143
+
144
+ model_description = fmpy.read_model_description(fmu)
145
+ unzip_dir = fmpy.extract(fmu)
146
+
147
+ model = fmpy.fmi3.FMI3Slave(
148
+ guid=model_description.guid,
149
+ unzipDirectory=unzip_dir,
150
+ modelIdentifier=model_description.coSimulation.modelIdentifier,
151
+ instanceName='instance1')
152
+ # Instantiate the model
153
+ model.instantiate(callbacks=callbacks)
154
+ model.setDebugLogging(debug_logging, categories)
155
+ model.setupExperiment()
156
+ model.enterInitializationMode()
157
+ model.exitInitializationMode()
158
+ # Execute the model
159
+ model.doStep(0., 0.1)
160
+ # Clean the model
161
+ model.terminate()
162
+
163
+ expected_calls = []
164
+ for c in filter(lambda c: debug_logging or not c[2], log_calls):
165
+ category = f"logStatus{c[1].name.capitalize()}"
166
+ if category not in Fmi3Slave.log_categories:
167
+ category = "logAll"
168
+ if len(categories) == 0 or category in categories:
169
+ expected_calls.append(call(
170
+ logger.call_args[0][0], # Don't test the first argument
171
+ b'instance1',
172
+ int(c[1]),
173
+ bytes(category, encoding="utf-8"),
174
+ bytes(c[0], encoding="utf-8")
175
+ ))
176
+
177
+ n_calls = len(Fmi3Status) if len(categories) == 0 else len(categories)
178
+
179
+ assert logger.call_count == n_calls * (1 + int(debug_logging))
180
+ logger.assert_has_calls(expected_calls)
@@ -1,141 +1,141 @@
1
- import math
2
- import pytest
3
-
4
- from pythonfmu3.builder import FmuBuilder
5
-
6
- pytestmark = pytest.mark.skipif(
7
- not FmuBuilder.has_binary(), reason="No binary available for the current platform."
8
- )
9
-
10
- fmpy = pytest.importorskip(
11
- "fmpy", reason="fmpy is not available for testing the produced FMU"
12
- )
13
-
14
-
15
- def mapped(md):
16
- m = {}
17
- for v in md.modelVariables:
18
- m[v.name] = v
19
- return m
20
-
21
-
22
- @pytest.mark.integration
23
- def test_integration_multiple_fmus(tmp_path):
24
- slave1_code = """import math
25
- from pythonfmu3 import Fmi3Slave, Fmi3Causality, Fmi3Variability, Int32, Float64, Boolean, String
26
-
27
-
28
- class Slave1(Fmi3Slave):
29
-
30
- def __init__(self, **kwargs):
31
- super().__init__(**kwargs)
32
-
33
- self.realIn = 22.0
34
- self.realOut = 0.0
35
- self.time = 0
36
- self.register_variable(Float64("time", causality=Fmi3Causality.independent, variability=Fmi3Variability.continuous))
37
- self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
38
- self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
39
-
40
- def do_step(self, current_time, step_size):
41
- self.log("Do step on Slave1.")
42
- self.realOut = self.realIn * 5.0 * (1.0 - math.exp(-1.0 * (current_time + step_size) / 0.1))
43
- return True
44
- """
45
-
46
- slave2_code = """from pythonfmu3 import Fmi3Slave, Fmi3Causality, Fmi3Variability, Int32, Float64, Boolean, String
47
-
48
-
49
- class Slave2(Fmi3Slave):
50
-
51
- def __init__(self, **kwargs):
52
- super().__init__(**kwargs)
53
-
54
- self.realIn = 22.0
55
- self.realOut = 0.0
56
- self.time = 0
57
- self.register_variable(Float64("time", causality=Fmi3Causality.independent, variability=Fmi3Variability.continuous))
58
- self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
59
- self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
60
-
61
- def do_step(self, current_time, step_size):
62
- self.log("Do step on Slave2.")
63
- self.realOut = -2.0 * self.realIn
64
- return True
65
- """
66
-
67
- script1_file = tmp_path / "orig" / "slave1.py"
68
- script1_file.parent.mkdir(parents=True, exist_ok=True)
69
- script1_file.write_text(slave1_code)
70
-
71
- fmu1 = FmuBuilder.build_FMU(
72
- script1_file,
73
- dest=tmp_path,
74
- needsExecutionTool="false"
75
- )
76
- assert fmu1.exists()
77
-
78
- script2_file = tmp_path / "orig" / "slave2.py"
79
- script2_file.write_text(slave2_code)
80
-
81
- fmu2 = FmuBuilder.build_FMU(
82
- script2_file,
83
- dest=tmp_path,
84
- needsExecutionTool="false"
85
- )
86
- assert fmu2.exists()
87
-
88
- md1 = fmpy.read_model_description(fmu1)
89
- unzip_dir = fmpy.extract(fmu1)
90
-
91
- model1 = fmpy.fmi3.FMU3Slave(
92
- guid=md1.guid,
93
- unzipDirectory=unzip_dir,
94
- modelIdentifier=md1.coSimulation.modelIdentifier,
95
- instanceName='instance1')
96
-
97
- model1.instantiate()
98
- model1.enterInitializationMode()
99
- model1.exitInitializationMode()
100
-
101
- md2 = fmpy.read_model_description(fmu2)
102
- unzip_dir = fmpy.extract(fmu2)
103
-
104
- model2 = fmpy.fmi3.FMU3Slave(
105
- guid=md2.guid,
106
- unzipDirectory=unzip_dir,
107
- modelIdentifier=md2.coSimulation.modelIdentifier,
108
- instanceName='instance2')
109
-
110
- variables1 = mapped(md1)
111
- variables2 = mapped(md2)
112
-
113
- realOut = variables1["realOut"]
114
- realIn = variables2["realIn"]
115
-
116
- model2.instantiate()
117
- model2.enterInitializationMode()
118
-
119
- value = model1.getFloat64([realOut.valueReference])[0]
120
- model2.setFloat64([realIn.valueReference], [value])
121
-
122
- model2.exitInitializationMode()
123
-
124
- time = 0
125
- stop_time = 0.1
126
- step_size = 0.025
127
-
128
- while time < stop_time:
129
-
130
- model2.setFloat64([realIn.valueReference], [value])
131
-
132
- model1.doStep(time, step_size)
133
- model2.doStep(time, step_size)
134
-
135
- value = model1.getFloat64([realOut.valueReference])[0]
136
-
137
- time += step_size
138
-
139
- assert value == pytest.approx(
140
- 22.0 * 5.0 * (1.0 - math.exp(-1.0 * time / 0.1)), rel=1e-7
141
- )
1
+ import math
2
+ import pytest
3
+
4
+ from pythonfmu3.builder import FmuBuilder
5
+
6
+ pytestmark = pytest.mark.skipif(
7
+ not FmuBuilder.has_binary(), reason="No binary available for the current platform."
8
+ )
9
+
10
+ fmpy = pytest.importorskip(
11
+ "fmpy", reason="fmpy is not available for testing the produced FMU"
12
+ )
13
+
14
+
15
+ def mapped(md):
16
+ m = {}
17
+ for v in md.modelVariables:
18
+ m[v.name] = v
19
+ return m
20
+
21
+
22
+ @pytest.mark.integration
23
+ def test_integration_multiple_fmus(tmp_path):
24
+ slave1_code = """import math
25
+ from pythonfmu3 import Fmi3Slave, Fmi3Causality, Fmi3Variability, Int32, Float64, Boolean, String
26
+
27
+
28
+ class Slave1(Fmi3Slave):
29
+
30
+ def __init__(self, **kwargs):
31
+ super().__init__(**kwargs)
32
+
33
+ self.realIn = 22.0
34
+ self.realOut = 0.0
35
+ self.time = 0
36
+ self.register_variable(Float64("time", causality=Fmi3Causality.independent, variability=Fmi3Variability.continuous))
37
+ self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
38
+ self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
39
+
40
+ def do_step(self, current_time, step_size):
41
+ self.log("Do step on Slave1.")
42
+ self.realOut = self.realIn * 5.0 * (1.0 - math.exp(-1.0 * (current_time + step_size) / 0.1))
43
+ return True
44
+ """
45
+
46
+ slave2_code = """from pythonfmu3 import Fmi3Slave, Fmi3Causality, Fmi3Variability, Int32, Float64, Boolean, String
47
+
48
+
49
+ class Slave2(Fmi3Slave):
50
+
51
+ def __init__(self, **kwargs):
52
+ super().__init__(**kwargs)
53
+
54
+ self.realIn = 22.0
55
+ self.realOut = 0.0
56
+ self.time = 0
57
+ self.register_variable(Float64("time", causality=Fmi3Causality.independent, variability=Fmi3Variability.continuous))
58
+ self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
59
+ self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
60
+
61
+ def do_step(self, current_time, step_size):
62
+ self.log("Do step on Slave2.")
63
+ self.realOut = -2.0 * self.realIn
64
+ return True
65
+ """
66
+
67
+ script1_file = tmp_path / "orig" / "slave1.py"
68
+ script1_file.parent.mkdir(parents=True, exist_ok=True)
69
+ script1_file.write_text(slave1_code)
70
+
71
+ fmu1 = FmuBuilder.build_FMU(
72
+ script1_file,
73
+ dest=tmp_path,
74
+ needsExecutionTool="false"
75
+ )
76
+ assert fmu1.exists()
77
+
78
+ script2_file = tmp_path / "orig" / "slave2.py"
79
+ script2_file.write_text(slave2_code)
80
+
81
+ fmu2 = FmuBuilder.build_FMU(
82
+ script2_file,
83
+ dest=tmp_path,
84
+ needsExecutionTool="false"
85
+ )
86
+ assert fmu2.exists()
87
+
88
+ md1 = fmpy.read_model_description(fmu1)
89
+ unzip_dir = fmpy.extract(fmu1)
90
+
91
+ model1 = fmpy.fmi3.FMU3Slave(
92
+ guid=md1.guid,
93
+ unzipDirectory=unzip_dir,
94
+ modelIdentifier=md1.coSimulation.modelIdentifier,
95
+ instanceName='instance1')
96
+
97
+ model1.instantiate()
98
+ model1.enterInitializationMode()
99
+ model1.exitInitializationMode()
100
+
101
+ md2 = fmpy.read_model_description(fmu2)
102
+ unzip_dir = fmpy.extract(fmu2)
103
+
104
+ model2 = fmpy.fmi3.FMU3Slave(
105
+ guid=md2.guid,
106
+ unzipDirectory=unzip_dir,
107
+ modelIdentifier=md2.coSimulation.modelIdentifier,
108
+ instanceName='instance2')
109
+
110
+ variables1 = mapped(md1)
111
+ variables2 = mapped(md2)
112
+
113
+ realOut = variables1["realOut"]
114
+ realIn = variables2["realIn"]
115
+
116
+ model2.instantiate()
117
+ model2.enterInitializationMode()
118
+
119
+ value = model1.getFloat64([realOut.valueReference])[0]
120
+ model2.setFloat64([realIn.valueReference], [value])
121
+
122
+ model2.exitInitializationMode()
123
+
124
+ time = 0
125
+ stop_time = 0.1
126
+ step_size = 0.025
127
+
128
+ while time < stop_time:
129
+
130
+ model2.setFloat64([realIn.valueReference], [value])
131
+
132
+ model1.doStep(time, step_size)
133
+ model2.doStep(time, step_size)
134
+
135
+ value = model1.getFloat64([realOut.valueReference])[0]
136
+
137
+ time += step_size
138
+
139
+ assert value == pytest.approx(
140
+ 22.0 * 5.0 * (1.0 - math.exp(-1.0 * time / 0.1)), rel=1e-7
141
+ )