0

Running 64-bit Windows 10. Anaconda installation of PyFMI and pip OMPython.

I want to automate the running of a Rankine Cycle model (using ThermoSysPro Components) in Python using OMPython to create the FMU and then PyFMI to simulate it.

I have managed to use this method to simulate a Brayton Cycle in the ThermoPower library, and it is also simulating part of the cycle.

However as soon as I add the Exchanger component (dynamicExchangerWaterSteamFlueGases), it stops working.

"""
Setting Condenser to Pump to Bolier (TSP) model values using PyFMI
Sophie Gribben
29/07/19
"""
def createfmu():
# Flattening, compiling and exporting model as fmu
    from OMPython import OMCSessionZMQ
    omc = OMCSessionZMQ()

    omc.sendExpression('loadFile("H:/OMModels/CondensertoPumptoBolier.mo")')
    model_fmu = omc.sendExpression("translateModelFMU(CondensertoPumptoBolier)")

    return model_fmu

# Load model
from pyfmi import load_fmu
model = load_fmu(createfmu())

#simulating model, which is returning the error
res = model.simulate()

Without setting a log_level, the error message is:

FMUException: Exit Initialize returned with an error. Enable logging for more information, (load_fmu(..., log_level=4)).

Update

RankineCycle_log.txt is giving me an FMU status Error but I am unsure how to fix this.

FMIL: module = b'Model', log level = 2: b'[logStatusError][FMU status:Error] C:/OpenModelica1.13.264bit/lib/omlibrary/ThermoSysPro 3.1/Properties/WaterSteam/IF97_packages.mo:123: Water_Ph: Incorrect region number (-1)'
FMIL: module = b'Model', log level = 2: b'[logFmi2Call][FMU status:Error] fmi2EnterInitializationMode: terminated by an assertion.'
sgribben
  • 1
  • 1
  • Is the return value of `model_fmu` correct? Does it create the FMU? Does it return a MINGW path or a Windows path? – sjoelund.se Jul 31 '19 at 14:02
  • The return of `model_fmu` is correct, creates .fmu, .libs, .makefile all in same directory as python script, however, I am getting 2 log files as well. – sgribben Jul 31 '19 at 14:47
  • The same issue also arises for this particular model if I use a CS FMU. I have not had any issues with other ThermoSysPro FMU's which leads me to now think its an issue with my model. – sgribben Aug 08 '19 at 07:53
  • As far as I remember, ThermoSysPro is sensitive to start-values and you are recommended to provide start-values in order to make it simulate correctly. – sjoelund.se Aug 08 '19 at 08:03

0 Answers0