PhotoVoltaics icon indicating copy to clipboard operation
PhotoVoltaics copied to clipboard

Problem simulating via FMPy

Open kosmylo opened this issue 3 years ago • 5 comments

I have exported the model PhotoVoltaics_TGM.TGM_Comax_Measurement_20160808 as fmu and when I am trying to simulate it in python through FMPy I am getting the following error:

assert | debug | Model error: Argument of sqrt(converter.iAC.re ^ 2.0 + converter.iAC.im ^ 2.0) was nan should be >= 0

Any idea of what is going on?

kosmylo avatar Jun 02 '21 12:06 kosmylo

Could you possibly add your fmu file (for Linux) so that I can double check it.

christiankral avatar Jun 26 '21 21:06 christiankral

Here it is: FMU.zip

Just to mention that if I export it as FMU for ME it simulates fine. The problem appears when I export it as FMU for CS.

kosmylo avatar Jul 13 '21 14:07 kosmylo

I investigate this issue with the nightly build version OpenModelica 1.19.0~dev-47-gd4b39c9

Case 1

Investigated model: PhotoVoltaics_TGM.TGM_Trina_Measurement_20160808

  • The simulations model simulates directly in OpenModelca
  • Export of PhotoVoltaics_TGM.TGM_Trina_Measurement_20160808 as FMU for ME (model exchange)
    • Simulation of FMU works with OpenModelica (old frontend only)
    • Simulation starts but does not finish (hangs at 1%) with FMPy v0.3.0
    • Simulation does not work with Dymola 2022 for an unknown reason
  • Export of PhotoVoltaics_TGM.TGM_Trina_Measurement_20160808 as FMU for CS (co-simulation)
    • When I import the FMU in OpenModelica I get the following error message: `The FMU version is 2.0 and FMU type is ###
    • CoSimulation. Unsupported FMU type. Only FMI 2.0 ModelExchange is supported.`; so CS is obviously not yet supported in OpenModelica
    • Simulation starts but does not finish (hangs at 1%) with FMPy v0.3.0
    • Simulation causes an error in Dymola 2022
Error: The following error was detected at time: 0
/home/data/work/Resources/Library/FMU/PhotoVoltaics_TGM.TGM_Trina_Measurement_20160808/binaries/linux64/PhotoVoltaics_TGM_TGM_Trina_Measurement_20160808_FMU.libs: invalid ELF header
The stack of functions is:
PhotoVoltaics_TGM_TGM_Trina_Measurement_20160808_fmu.fmi_Functions.fmiModel
PhotoVoltaics_TGM_TGM_Trina_Measurement_20160808_fmu.fmi_Functions.fmiModel("PhotoVoltaics_TGM_TGM_Trina_Measurement_20160808_fmu", photoVoltaics_TGM_TGM_Trina_Measurement_20160808_fmu.fmi_loggingOn, "file:////home/data/work/Resources/Library/FMU/PhotoVoltaics_TGM.TGM_Trina_Measurement_20160808/resources", 0, 1)

Case 1 FMU_linux64.zip

Case 2

Investigated model: PhotoVoltaics_TGM.TGM_Comax_Measurement_20160808

  • The simulations model simulates directly in OpenModelca
  • Export of PhotoVoltaics_TGM.TGM_Comax_Measurement_20160808 as FMU for ME (model exchange)
    • Simulation of FMU works with OpenModelica (old frontend only)
    • Simulation starts but does not finish (hangs at 4%) with FMPy v0.3.0
    • Simulation does not work with Dymola 2022 for an unknown reason
  • Export of PhotoVoltaics_TGM.TGM_Comax_Measurement_20160808 as FMU for CS (co-simulation)
    • Simulation starts but does not finish (hangs at 4%) with FMPy v0.3.0; no error message is issued
    • Simulation in Dymola 2022 causes a similar error message as for Case 1

Case 2 FMU_linux64.zip

christiankral avatar Jul 18 '21 20:07 christiankral

So I cannot reproduce the FMPy error message for Case 2 processing the co-simulation FMU. Possible causes are:

  • There may be a difference between the Linux and the Windows FMU
  • You used OpenModelica 1.16.5 for Windows, so the FMU generated by this version may be different than the FMU generated by the actual nightly version of OpenModelica
  • You might use a different version of FMPy @kosmylo could you please comment on the version of FMPy you are using

christiankral avatar Jul 18 '21 21:07 christiankral

I am getting the same error when I am trying to simulate the CS model at both fmpy 0.2.14 and fmpy 0.3.0.

kosmylo avatar Jul 19 '21 07:07 kosmylo