【问题标题】:pyFMI Python simulation different number of output pointspyFMI Python模拟不同数量的输出点
【发布时间】:2018-11-16 14:07:18
【问题描述】:

如何精确控制模型输出的数量

我根据不同的输入参数得到不同数量的输出点:

model = load_fmu("Trial.fmu") # 64 Bit generated FMU with Dymola+Buildsyspro 
tstart = model.get_default_experiment_start_time() #### START TIME 
tstop  =  model.get_default_experiment_stop_time() #### STOP TIME
opts = model.simulate_options () # Setting the output number of outputs
opts['ncp']=194 ## Want to have exactly 194 data points

foo 是将参数转换为正确格式的函数 thetaInit 是参数的初始值

results=model.simulate(input=foo(thetaInit),options=opts, start_time=tstart, final_time=tstop)

len(results['DC_Power')
267

通过乘以 0.9 来更改初始参数值

results2=model.simulate(input=foo(thetaInit*0.9),options=opts, start_time=tstart, final_time=tstop)
len(results['DC_Power')
263

对于校准问题,我需要具有相同数量的输出点。如果有人知道如何控制它。

【问题讨论】:

  • 我认为加分的原因是事件。我假设有一种方法可以关闭在 pyFMI 中的事件存储值;但还没有调查。

标签: python optimization modelica dymola fmi


【解决方案1】:

正如 Hans 指出的那样,加分可能是由于默认存储的事件(在 ncp 之上)。可以使用以下方法禁用事件点的存储:

model = load_fmu(...)
opts = model.simulate_options()
opts["CVode_options"]["store_event_points"] = False

res = model.simulate(options=opts)

【讨论】:

  • 正是我想要的!
猜你喜欢
  • 1970-01-01
  • 2019-08-06
  • 1970-01-01
  • 2021-09-08
  • 2019-05-29
  • 1970-01-01
  • 1970-01-01
  • 2011-05-01
  • 1970-01-01
相关资源
最近更新 更多