Unity-FMI-Addon icon indicating copy to clipboard operation
Unity-FMI-Addon copied to clipboard

Unity crash

Open saulcasti opened this issue 4 years ago • 5 comments

When I use a .fmu file of 184 model variables, FMI2's variable "component" always set to 0x0. Then, when I play app, Unity crash.

saulcasti avatar Jan 13 '21 15:01 saulcasti

I have the same problem with FMU's made in OpenModelica. From simulink it works with a hack (setting time to 0 every step).

sangvikh avatar Mar 03 '21 13:03 sangvikh

Same problem here.

Simulink FMUs are working

FMUs from https://github.com/fmi-tools/cpp-fmus are crashing during FMI initialisation. FMPy can simulate these FMUs. So I guess the problem is in the Unity FMI Importer. Anyone has any clue why that is?

edit: Using Debug Logs in the FMI unity crashes during processing https://github.com/viproma/cppfmu/blob/100cdd288dd9deedd5eb0d20abddcc7cbc96fd53/fmi_functions.cpp#L495 in the FMU. My guess is, there is a problem with this cpp library and the C# FMI Importer. But I don't know for sure on which side the error is. (as the FMI can be simulated with FMPy, I guess the error is on the C# side, but I'm not an expert in this)

CNowak-itk avatar Mar 10 '21 10:03 CNowak-itk

I have the same issue, Unity crashes when instantiating the fmu, at FMI2.cs -> Line 223:

component = fmi2Instantiate(instanceName, (int)fmi2Type.fmi2CoSimulation, guid, resourceLocation, callbacks, fmi2False, loggingOn ? fmi2True : fmi2False);

The FMU im using is made with OpenModelica:

SimpleModel.zip

sakspapir avatar Sep 29 '21 12:09 sakspapir

I'm seeing a crash as well when initializing my own FMU, I think it's the same as described in this thread. The crash dump says

0xC0000090 The exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type

The demo scene with the bouncing ball works fine.

OivinF avatar Feb 02 '22 15:02 OivinF

I have the same issue, Unity crashes when instantiating the fmu, at FMI2.cs -> Line 223:

component = fmi2Instantiate(instanceName, (int)fmi2Type.fmi2CoSimulation, guid, resourceLocation, callbacks, fmi2False, loggingOn ? fmi2True : fmi2False);

The FMU im using is made with OpenModelica:

SimpleModel.zip

Exact same for me. Have you found a solution?

ashtorak avatar Aug 08 '22 22:08 ashtorak