Number of connectors in connection. This is a deprecated operator. It should no longer be used, since it will be removed in one of the next Modelica releases.
cardinality(c)
Returns the number of (inside and outside) occurrences of connector instance c in a connect statement as an Integer number.
[The cardinality operator allows the definition of connection dependent equations in a model.]
Instead of the cardinality(..) operator, often conditional connectors can be used, that are enabled/disabled via Boolean parameters.
connector Pin Real v; flow Real i; end Pin; model Resistor Pin p, n; equation // Handle cases if pins are not connected if cardinality(p) == 0 and cardinality(n) == 0 then p.v = 0; n.v = 0; elseif cardinality(p) == 0 then p.i = 0; elseif cardinality(n) == 0 then n.i = 0; end if; // Equations of resistor ... end Resistor;