Opened 12 years ago
Closed 11 years ago
#2062 closed defect (fixed)
Cardinality reports one but should report two
Reported by: | Peter Aronsson | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | critical | Milestone: | 1.9.3 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: | daniel.bouskela@…, audrey.Jardin@… |
Description
The following model reports cardinality(u) == 1 but should report cardinality(u) == 2:
model CardinalityBug Modelica.Blocks.Interfaces.BooleanInput u; Modelica.Blocks.Logical.And and1; parameter String card = "cardinality is "+String(cardinality(u)); equation connect(u,and1.u1); connect(u,and1.u2); end CardinalityBug;
This language construct is used in Controlsystems in ThermoSysPro.
Change History (6)
comment:1 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:2 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | accepted → assigned |
It's easy to fix this for this test in particular, but from what I can tell it breaks all the other code. (From my quick glance at the code, I suspect cardinality in OpenModelica only works correctly if there is at most one connect-equation using the cref in a particular component)
comment:3 by , 12 years ago
Owner: | changed from | to
---|
The problem is that we do union on the list when we should do list append in Ceval.cevalCardinality2. So per model we always get a cardinality of 1.
However, if you change that list union to list append then things start to
break as Martin pointed out (50 Models in the testsuite).
Why? Because we don't care about deleted components which are added later
on in the instantiation. So the actual problem is that we do not filter the
Env.CSetsType we add to the sets and to the env by the deleted components.
I will fix this myself. We should not Ceval.ceval the cardinality operator
at all during instantiation, only evaluate it at the end of instantiation
when we have all the information. Also we should either delete the connect crefs
matching deleted components from the Connect.SETS.connectionCrefs and the Env
or just use the info in the Connect.SETS as is the most updated one (I just have
to see how to get it from there in the way the cardinality wants it).
Cheers,
Adrian Pop/
comment:4 by , 11 years ago
Milestone: | 1.9.0 → 2.0.0 |
---|
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I'll have a (very) quick look.