Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacement of deprecated function cardinality(c) in Modelica

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.

e.g.

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

where C is FluidInlet or FluidOutlet

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

like image 704
Tomillo Avatar asked Nov 21 '19 15:11

Tomillo


1 Answers

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

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

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

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

like image 179
Hans Olsson Avatar answered Oct 03 '22 08:10

Hans Olsson