gpt4 book ai didi

modelica - 仅保存 JModelica 输出文件中的相关变量

转载 作者:行者123 更新时间:2023-12-03 22:20:47 25 4
gpt4 key购买 nike

我注意到 JModelica 的输出文件保存了所有内容,这意味着复杂的模型会创建巨大的文件,特别是对于长时间的模拟。

是否可以只在输出文件中保存相关变量?我已经通读了用户手册,但我看不到在哪里可以指定这样的参数。

例如我的模型创建变量 [a,b,c,d,e,f,g,时间] 但我只想保存 [a,b,时间] .

最佳答案

确实如此,in the user guide, section 5.3.2.2 "Options for Model Exchange FMUs" , 模拟选项对象有一个参数来控制它,它被称为 filter并有描述:

A filter for choosing which variables to actually store result for. The syntax can be found here. An example is filter = "*der" , store all variables ending with 'der' and filter = ["der", "summary*"], store all variables with "der" in the name and all variables starting with "summary".



这是我模拟的完整答案 PIDController并且只返回以 phi 结尾的变量.
from pymodelica import compile_fmu
from pyfmi import load_fmu
n = compile_fmu("Modelica.Blocks.Examples.PID_Controller")
m = load_fmu(n)
opts = m.simulate_options()
opts['filter'] = '*.phi'
m.simulate(options=opts)

关于modelica - 仅保存 JModelica 输出文件中的相关变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48910090/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com