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.'