Ticket #63 (closed defect: invalid)
Cardinality operator not correctly defined
| Reported by: | otter | Owned by: | otter |
|---|---|---|---|
| Priority: | normal | Milestone: | ModelicaSpec3.1 |
| Component: | --Modelica Specification-- | Version: | 3.0 |
| Severity: | normal | Keywords: | |
| Cc: | Hide ticket: | no |
Description
Issue report from Stefan Vorkoetter:
The Modelica specification in section 3.7.2.1 defines cardinality(c) as:
Returns the number of (inside and outside) occurrences of connector instance c in a connect-equation as an Integer number.
By that definition, the cardinality of c below is 1:
connect(c,b); connect(b,a);
Likewise, in the following, cardinality(c) is 2:
connect(c,b); connect(c,a);
Clearly the above two pairs of connect equations are semantically equivalent, yet cardinality yields two different answers for these two cases.
p.173 of Fritzson states "a model library might be built with the assumption that only one connection can be made to each connector". To me, that implies that the proper definition of cardinality should be along the lines of:
"cardinality(c) is number of connectors in the connection set containing c".
With that definition, the answer is 2 in both examples above, since the connection set in both cases is {a,b,c}.
This seems to be a bug in the definition of cardinality in the specification and should be corrected for Modelica 3.1, so that cardinality is with respect to the connection set.
