Ticket #63 (closed defect: invalid)

Opened 7 months ago

Last modified 7 months ago

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.

Attachments

Change History

Changed 7 months ago by HansOlsson

  • status changed from new to closed
  • resolution set to invalid

Changed 7 months ago by HansOlsson

Sent in e-mail (one type corrected):

After thinking more I realize that this is really a non-issue, and the proposed change would lose important semantic information.

The reason is that in a library you would normally have cardinality-asserts on each connector (e.g. in Bond-graphs). Thus you currently either get an assertion-failure for connector “c” OR for connector “b”. Counting all members of the “connection set” would generate the same diagnostics in both cases – making it hard to find the error.

Add/Change #63 (Cardinality operator not correctly defined)

Author



Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.