替换 Modelica 中已弃用的函数基数(c) [英] Replacement of deprecated function cardinality(c) in Modelica

查看:53
本文介绍了替换 Modelica 中已弃用的函数基数(c)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档中指出,该 cardinality() 函数已弃用,不应再使用.但是,它仍然在诸如 ThermoSysPro 之类的库中使用.

In the documentation it is indicated, that cardinality() function is deprecated and should no longer be used. However, it is still used in the libraries such as ThermoSysPro.

例如

if (cardinality(C) == 0) then
 some code
end if;

其中 CFluidInletFluidOutlet

谁能举一个简单的例子来说明如何替换它?

Could anyone give a simple example of how it could be replaced?

推荐答案

通常的解决方案是使连接器有条件,如果启用,您需要它已连接.

The usual solution is to make the connector conditional, and if enabled you require that it is connected.

对于物理连接器,您可以看到热端口和支持的处理方式:Modelica.Electrical.Analog.Interfaces.ConditionalHeatPortModelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2

For physical connectors you can see how heatports and support is handled in: Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2

对于控制信号,您可以看到 p_inh_in 等在Modelica.Fluid.Sources.Boundary_pTModelica.Fluid.Sources.Boundary_ph

For control signals you can see how p_in, h_in etc are handled in Modelica.Fluid.Sources.Boundary_pT Modelica.Fluid.Sources.Boundary_ph

然而,ThermoSysPro 的连接器不属于这两个类别,理想情况下也应该清理.

However, the connectors of ThermoSysPro belong in neither of those categories and that should ideally also be cleaned up.

这篇关于替换 Modelica 中已弃用的函数基数(c)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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