FMU 2.0 交互 - 需要参数值等的并行“容器”?

问题描述

我在 Jupyter notebooks 中使用 pyfmi 来运行模拟,我喜欢交互工作并评估参数的增量变化等。很久以前我发现有必要引入一个字典,作为参数和初始值的“容器” .现在我想知道这里是否有办法摆脱这个“容器”,毕竟它在一定程度上是“模型”的平行结构?

典型的工作流程如下所示:

    create a diagram where results from different simulations below should be shown

    model = load_fmu(fmu_model) 
    parDict['model.x_0'] = 1
    parDict['model.a'] = 2
    for key in parDict.keys(): model.set(key,parDict[key])
    sim_res = model.simulate(10)
    plot results...

    model = load_fmu(fmu_model) 
    parDict['model.x_0'] = 3
    for key in parDict.keys(): model.set(key,parDict[key])
    sim_res = model.simulate(10)
    plot results...

一个函数model.reset()可以在编译时将状态恢复到认值而无需再次加载,但您需要做的不仅仅是以下

    model.reset()
    parDict['model.x_0'] = 3
    for key in parDict.keys(): model.set(key,parDict[key])
    sim_res = model.simulate(10)
    plot results...

所以,这不起作用... 并且毕竟参数和初始值需要带回来,我们仍然需要parDict,但我们可以避免使用load-command。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)