如果我使用Jmodelica
编译模型,然后加载FMU并更改参数,就可以了。
但是相同的型号,我使用Dymola出口的FMU,
然后我将这个FMU文件加载到Jmodelica
中,更改参数失败。
from pymodelica import compile_fmu
from pyfmi import load_fmu
from pyjmi.common.plotting import plot_gui
my_fmu=
'D:\MoPath\Buildings_Fluid_Boilers_
Examples_BoilerPolynomialClosedLoop.fmu'
vdp = load_fmu(my_fmu)
vars = ['Q_flow_nominal']
values = vdp.get(vars)
values = 40000.0
vdp.set(vars, values)
res = vdp.simulate(final_time=240*60)
plot_gui.startGUI(res)
FMUException Traceback (most recent call last)
<ipython-input-1-71080d03720c> in <module>()
5 vdp = load_fmu(my_fmu)
6 vars = ['Q_flow_nominal']
----> 7 values = vdp.get(vars)
8 values = 40000.0
9 vdp.set(vars, values)
src\pyfmi\fmi.pyx in pyfmi.fmi.ModelBase.get (src\pyfmi\fmi.c:5270)()
src\pyfmi\fmi.pyx in pyfmi.fmi.FMUModelBase2._get (src\pyfmi\fmi.c:48680)()
src\pyfmi\fmi.pyx in pyfmi.fmi.FMUModelBase2.get_real (src\pyfmi\fmi.c:44830)()
FMUException: Failed to get the Real values.enter code here