两相 Modelica 媒体示例 [英] Two-Phase Modelica Media example

查看:73
本文介绍了两相 Modelica 媒体示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 OpenModelica 中开发一种流动模拟,该流动具有单一的液体或蒸气物质.Modelica.Media.Water 模型确实有两个阶段,但非常复杂,并且很难为完全不同的物质重现.我想找到一个我可以使用的两相介质的简单示例.有一个部分包 TemplateMedium 和一个部分包 PartialTwoPhaseMedium,但我没有看到任何关于如何编写一个可以处于两个阶段之一的全新媒体的示例.
如果任何人都可以提供一个简单的例子,或者只是一个所需的最小属性和方程集的列表,作为起点,这将是非常有用的.

I am trying to develop a simulation in OpenModelica of a flow that has a single substance that will be liquid or vapor. The Modelica.Media.Water models do have two phases, but are extremely complicated, and would be very hard to reproduce for a completely different substance. I would like to find a simple example of a two phase medium that I can work from. There is a partial package TemplateMedium and a partial package PartialTwoPhaseMedium, but I don't see any examples of how to write a completely new Medium that can be in either of two phase.
If anyone can provide a simple example, or just a list of the minimum set of properties and equations that are required that would be extremely helpful as a starting point.

要解决评论中的一些问题:我刚刚开始使用这个模型,所以我试图了解如何构建媒体模型的细节,以及模型中包含我的具体内容以及必须为每个新媒体添加的内容.我使用丙烯,所以有很好的数据可用.这是包含在 CoolProp 中的媒体之一,因此能够使用 ExternalMedia 和 CoolProp 将非常有用,但我相信这些尚未与 OpenModelica 一起使用,从许多评论和错误报告来看.

To address some of the question in comments: I am just getting started on this model, so I am trying to understand the details of how the Media model is constructed, and what my specifics are included in the model versus what has to be added for each new media. I working with propylene, so there is good data available. This is one of the media that is included in CoolProp, so being able to use ExternalMedia and CoolProp would be very useful, but I believe that these are not yet working with OpenModelica, from a number of comments and bug reports.

推荐答案

通常,您的媒体模型可以用 Modelica 编写,也可以重用现有的外部库.编写好的中等模型需要大量的工作,因此重用现有的库通常是一个好主意.这是 ExternalMedia(开源)或 TILMedia(商业)采用的方法.如果您对开源工作流感兴趣,将 ExternalMedia 与 Coolprop 结合使用是一个合理的决定.OpenModelica、ExternalMedia 和 CoolProp 三个项目都接受来自社区的贡献,因此也许您应该帮助改进这些项目,而不是编写自己的库.已经有很多工作正在进行,我不确定当前的状态.编写合格的错误报告(包括重现问题的步骤)也是一种非常受欢迎的贡献方式.

Generally, your medium model can be written in Modelica or you can reuse an existing external library. Writing good medium models is a lot of work, so reusing existing libraries is usually a good idea. This is the approach taken by ExternalMedia (open source) or TILMedia (commercial). If you are interested in an open-source workflow, ExternalMedia in combination with Coolprop is a reasonable decision. All three projects OpenModelica, ExternalMedia and CoolProp accept contributions from the community, so maybe you should help improving these instead of writing your own library. There is a lot of work going on already, I am unsure of the current status. Writing qualified bug reports (including steps to reproduce the problem) is also a very welcome way to contribute.

对于某些应用程序,最好在 Modelica 中直接使用 Medium 模型.这是 Modelica.Media(显然)、HelmholtzMedia 和来自 XRG 或 Modelon 的商业媒体库(不是 100% 确定)采用的方法.还有一些实现,但这些既不是开源也不是商业的,只有信息是例如会议论文.您可以查看的示例包括 R134a 媒体来自 MSL 或来自 HelmholtzMedia 库 的代码.此外,查看 ExternalMedia 实现可能会有所帮助.
对于不能改变相的流体,Annex60 库中有一些很好的例子.

For some applications, it might be good to have the Medium model directly in Modelica. This is the approach taken by Modelica.Media (obviously), HelmholtzMedia and the commercial media libraries from XRG or Modelon (not 100% sure about that). There are some more implementations, but these are neither open source nor commercial, only information are e.g. conference papers. The examples you can look at include the R134a medium from the MSL or the code from the HelmholtzMedia library. Also, looking at the ExternalMedia implementation might help.
For fluids that cannot change phase, there are some good examples in the Annex60 library.

因为你有一种可以改变相的纯物质,你的新介质应该从 PartialTwoPhaseMedium 扩展.PartialTwoPhaseMedium 是部分的,仅定义存在哪些函数,但(主要)不定义函数的算法.您必须为接口中可用的每个函数编写一个算法,并且没有算法才能完全兼容.首先,您应该至少实现一个 setState 函数,例如setState_ph 函数.然后,至少实现一个 setSat 函数和 BaseProperties.

As you have a pure substance that can change phase, your new medium should extend from PartialTwoPhaseMedium. PartialTwoPhaseMedium is partial, defining only what functions are there, but (mostly) not the algorithms of the functions. You will have to write an algorithm for each and every function that is available in the interface and does not have an algorithm in order to be fully compatible. For a start, you should implement at least one of the setState funtions, e.g. the setState_ph function. Then later, implement at least one setSat function and the BaseProperties.

如果您实现自己的介质,您还可以选择如何对其进行建模:使用完整的多参数亥姆霍兹能量状态方程、更简单的状态方程(如 Peng-Robinson 或其他三次 EoS)、一些多项式或样条,基于表格的方法,如 TTSE 或 SBTL,可能还有更多选项.

If you implement your own medium, you also have the choice of how to model it: Using the full multiparameter Helmholtz energy equation of state, a simpler equation of state like Peng-Robinson or other cubic EoS, some polynomials or splines, table-based methods like TTSE or SBTL and probably many more options.

这篇关于两相 Modelica 媒体示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆