无法在PyFMI中模拟OpenModelica ThermoSysPro FMU

时间:2019-07-31 09:03:10

标签: openmodelica jmodelica

运行64位Windows10。PyFMI和pip OMPython的Anaconda安装。

我想使用OMPython创建FMU,然后由PyFMI对其进行仿真,从而在Python中自动化运行兰金循环模型(使用ThermoSysPro组件)。

我已经设法使用此方法来模拟ThermoPower库中的布雷顿循环,并且它还模拟了循环的一部分。

但是,一旦我添加了Exchanger组件(dynamicExchangerWaterSteamFlueGases),它就会停止工作。

"""
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()

不设置log_level,错误消息为:

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

更新

RankineCycle_log.txt给我一个FMU状态错误,但是我不确定如何解决。

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

0 个答案:

没有答案