搜索像“冗长”这样的概念;在莫代利卡

发布于 2024-12-07 03:34:21 字数 503 浏览 3 评论 0原文

我正在努力解决大型 Modelica 模型的输出文件的大小。当然,我可以保护某些对象,以便将它们从结果文件中完全删除。然而,这会产生两个问题:

  1. 受保护的对象
  2. 如果我想详细测试我的模型(例如在短时间内),则不可能重新声明

,我需要再次公开声明这些对象才能看到它们的变量我想知道是否有设置 Modelica 模型“详细程度”的技巧。也许我想要的是 publicprotected 旁边的第三个关键字,例如。 透明。然后,在设置模拟时,我希望能够将详细级别设置为 1 或 2,具有以下效果:

1-->将所有透明元素视为受保护

2-->将所有透明元素视为公共

此效果将传播到所有模型和子模型。
我认为这还不存在。但有一个简单的解决方法吗?

谢谢, 罗尔

I'm struggling with the size of output files for large Modelica models. Off course, I can protect some objects in order to remove them completely from the result file. However, that gives rise to two problems:

  1. it's not possible to redeclare protected objects
  2. if i want to test my model in detail (eg for a short time period), i need to declare those objects publicly again in order to see their variables

I wonder if there's a trick to set the 'verbosity' of a Modelica model. Maybe what I would like is a third keyword next to public, protected, eg. transparent. Then, when setting up a simulation, I want be able to set the verbosity level to 1, or 2 with the following effect:

1--> consider all transparentelements as protected

2--> consider all transparentelements as public

This effect would propagate to all models and submodels.
I don't think this already exists. But is there an easy workaround?

Thanks,
Roel

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

栖迟 2024-12-14 03:34:21

正如 Michael Tiller 上面所写,所有 Modelica 工具中的处理方式并不相同,并且没有明确的答案。要给出特定于 OpenModelica 的答案,可以使用 simulate(ModelName,outputFilter="regex") 来仅存储与给定正则表达式完全匹配的变量(默认为 .*< /code>,匹配任何变量)。

As Michael Tiller wrote above, this is not handled the same way in all Modelica tools and there is no definite answer. To give an OpenModelica-specific answer, it's possible to use simulate(ModelName,outputFilter="regex"), to store only the variables that fully match the given regex (default is .*, matching any variable).

深海少女心 2024-12-14 03:34:21

罗尔,

我知道有几个人正在努力解决这个问题。目前,所有这一切都取决于所使用的工具。我不知道其他工具如何处理结果过滤,但在 Dymola 中,您可以通过为信号提供特殊限定符(例如受保护)来控制它(正如您所指出的)。

我过去做过的一件事是从模型扩展,然后为我感兴趣的东西添加一堆输出信号。然后您可以在 Dymola 中选择“输出”以确保这些信号进入结果文件。这远非完美,因为 a) 列出您想要的所有内容可能会变得乏味,b) 严格不允许引用受保护的变量(尽管 Dymola 让您摆脱它,但会发出警告)。

在达索,我们正在积极讨论这个想法,并希望沿着这些思路提供一些更好的功能。目前尚不清楚此类功能是否严格特定于工具,或者是否会以某种方式涉及该语言。但如果与语言相关,我们(当然)将与设计组合作制定其他工具供应商也可以支持的规范。

Roel,

I know several people wrestling with this issue. At the moment, all of this depends on the tool being used. I don't know how other tools handle filtering of results, but in Dymola you control it (as you point out) by giving the signals special qualifiers (e.g. protected).

One thing I've done in the past is to extend from a model and then add a bunch of output signals for things I'm interested in. Then you can select "Outputs" in Dymola to make sure those get in the results file. This is far from perfect because a) listing everything you want can get tedious and b) referencing protected variables is not strictly allowed (although Dymola lets you get away with it but issues a warning).

At Dassault, we are actively discussing this idea and hope to provide some better functionality along these lines. It isn't clear whether such functionality will be strictly tool specific or whether it will involve the language somehow. But if it is language related, we will (of course) work with the design group to formulate a specification that other tool vendors can support as well.

澉约 2024-12-14 03:34:21

在 SystemModeler 中,您可以转到仿真中心实验浏览器中的“设置”选项卡。单击底部的“输出”并选择要存储的变量。

(选项为状态变量导数代数变量参数受保护变量 如果您标记存储模拟日志选项,您将获得一些关于随时间变化的事件和功能评估的有趣统计数据,从而开启另一种可能性来跟踪创建更多评估的模拟和模型的部分)

In SystemModeler, you go to the Settings tab in the Experiment Browswer in Simulation Center. Click on Output on the bottom and select which variables to store.

(The options are state variables, derivatives, algebraic variables, parameters, protected variables and if you mark the Store simulation log-option, you'll get some interesting statistics on events over time and function evaluations, opening another possibility to track down parts of the simulation and model that creates more evaluations)

‘画卷フ 2024-12-14 03:34:21

我不确定这是否对您有帮助,但在 Dymola 中,您可以转到“模拟”->“设置”->“输出”并标记一个复选框,显示“存储受保护的变量”。这样就可以将大多数变量声明为受保护:在正常模拟期间,它们不会被存储,但在调试模型时,您只需标记该复选框即可存储它们。
当然,这与您建议的关键字透明不同,但也许它会有所帮助......

I am not sure if this helps you, but in Dymola you can go to Simulation->Setup->Output and mark a checkbox saying "Store Protected variables". That way it is possible to declare most variables as protected: during normal simulation they are not stored, but when debugging your model, you just mark that checkbox and they are stored.
Of course that is not the same as your suggested keyword transparent, but maybe it helps a little...

近箐 2024-12-14 03:34:21

有点晚了,但在 Dymola 2013 FD01 及更高版本中,您可以使用注释 __Dymola_selections 根据名称(和模型名称)选择要存储的变量,甚至可以过滤用户定义的标签 - 这样您就可以在模型中创建一个标签名称“透明”。请参阅手册中的“匹配和变量选择”。

A bit late, but in Dymola 2013 FD01 and later you can select which variables to store based on names (and model names) using the annotation __Dymola_selections, and even filter on user-defined tags - so you could create a tag name "transparent" in the model. See "Matching and variable selections" in the manual.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文