我在用PyFMI模拟EnergyPlus-FMU时遇到了麻烦。我使用参考建筑模型创建了一个EnergyPlus FMU。我使用的是PyFMI2.5。如何运行do_step()函数?
from pyfmi import load_fmu
model = load_fmu("MyEnergyplus.fmu")
start_time = 0
final_time = 60.0 * 60 * 24 * 3 #seconds
step_size = 60 # seconds
opts = model.simulate_options()
idf_steps_per_hour = 60
ncp = (final_time - start_time)/(3600./idf_steps_per_hour)
opts['ncp'] = ncp
t = 0
status = model.do_step(current_t = t, step_size= step_size, new_step=True)我得到的错误是:
File "test_fmi2.py", line 15, in <module> status = model.do_step(current_t = t, step_size= step_size, new_step=True)
AttributeError: 'pyfmi.fmi.FMUModelME2' object has no attribute 'do_step'我仔细检查了PyFMI的API,没有发现任何问题。如何启用模拟?谢谢。
发布于 2019-08-16 14:05:38
从输出中我们可以看到,您加载的FMU是没有do step功能的Model Exchange FMU (只有Co-Simulation FMU有)。有关不同FMU类型的更多信息,请参阅FMI规范。
要模拟Model Exchange FMU,请使用“模拟”方法。对于联合模拟FMU,也可以使用“模拟”方法,这是执行模拟的首选方法
发布于 2020-02-03 16:28:48
不知道你是如何设置fmu的,我至少可以说你忘记了model.initialize(start_time,final_time)。
https://stackoverflow.com/questions/57501494
复制相似问题