ORNL-Modelica / UnrealEngine-FMIPlugin

27 stars 5 forks source link

Issue exporting FMU from Open Modelica OMEdit to Unreal 5.3.2 #28

Open sebzuddas opened 8 months ago

sebzuddas commented 8 months ago

I managed to install and use the plugin in UE 5.3.2, but currently the FMU's I'm exporting from OMEdit are throwing errors. I came to understand that there were two types of FMU's, co-simulation and model exchange. Co-simulation exports the solver alongside the model, whereas model exchange relies on the destination software to have its own solver. I'm suspecting this is the issue, however I cannot say for sure.

difference between co-simulation and model exchange

KERNELBASE
VCRUNTIME140
UnrealEditor_UEFMI!fmikit::FMU::error() [C:\dev\digital_twins\latest_engine_test\Plugins\UEFMI\Source\UEFMI\ThirdParty\fmikit\src\FMU.cpp:203]
UnrealEditor_UEFMI!fmikit::FMU::FMU() [C:\dev\digital_twins\latest_engine_test\Plugins\UEFMI\Source\UEFMI\ThirdParty\fmikit\src\FMU.cpp:168]
UnrealEditor_UEFMI!fmikit::FMU2::FMU2() [C:\dev\digital_twins\latest_engine_test\Plugins\UEFMI\Source\UEFMI\ThirdParty\fmikit\src\FMU2.cpp:25]
UnrealEditor_UEFMI!fmikit::FMU2Slave::FMU2Slave() [C:\dev\digital_twins\latest_engine_test\Plugins\UEFMI\Source\UEFMI\ThirdParty\fmikit\src\FMU2.cpp:197]
UnrealEditor_UEFMI!std::make_unique<fmikit::FMU2Slave,char *,char *,char *,char *,0>() [C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\INCLUDE\memory:3434]
UnrealEditor_UEFMI!AA_FMU::Initialize() [C:\dev\digital_twins\latest_engine_test\Plugins\UEFMI\Source\UEFMI\Private\A_FMU.cpp:113]
UnrealEditor_UEFMI!AA_FMU::BeginPlay() [C:\dev\digital_twins\latest_engine_test\Plugins\UEFMI\Source\UEFMI\Private\A_FMU.cpp:100]
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll
greenwoodms06 commented 8 months ago

I can't speak to OMEdits FMUs. The UE plugin is for co-simulation only. If the FMU doesn't work then openmodelica may not be creating a completely FMI compliant FMU ( I have seen that from various FMI tools before). To check, if it works in FMpy (e.g., the gui reference on their github) then it should work using the UE plugin.

sebzuddas commented 8 months ago

Yes seems like an OMEdit problem. When I run using FMpy I get the following error:

Failed to load shared library C:\Users\szuddas\AppData\Local\Temp\tmpwcbim2gy\binaries\win64\unreal_test.dll. Could not find module 'C:\Users\szuddas\AppData\Local\Temp\tmpwcbim2gy\binaries\win64\unreal_test.dll' (or one of its dependencies). Try using the full path with constructor syntax.

Then if I import the FMU that OMEdit exported, I get this problem:

[unreal_fmu: 62:7-62:37]: [Operator reinit may not be used in an algorithm section (use translation flag --allowNonStandardModelica=reinitInAlgorithms to ignore).](omeditmessagesbrowser:///unreal_fmu?lineNumber=62)

Will keep the thread updated if I find a solution.