0

运行 64 位 Windows 10。Anaconda 安装 PyFMI 和 pip OMPython。

我想使用 OMPython 自动在 Python 中运行 Rankine Cycle 模型(使用 ThermoSysPro 组件)来创建 FMU,然后使用 PyFMI 来模拟它。

我已经设法使用这种方法在 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.'
4

0 回答 0