Skip to content

Commit

Permalink
Fixes for bugs: #1129 #1122
Browse files Browse the repository at this point in the history
- Exp.crefPrefixOf did not handle the case:
  a.b.c is a prefix of a.b.c[1] when it should!
- because of the miss in Exp.crefPrefixOf the 
  unconnected flow components generated equations
  even if they belonged to deleted components!
- Now the models in:
  testsuite/libraries/msl31/Modelica.Electrical.Machines.Examples.mos
  testsuite/libraries/msl31/Modelica.Electrical.MultiPhase.Examples.mos
  are balanced, except for:
  Modelica.Electrical.Machines.Examples.SMEE_Generator has 503 equation(s) and 501 variable(s)
  which is a bit better as before it had: 509 eqs/501 vars.
- Exp.crefPrefixOf is now faster (reduces the testsuite run by about 5 minutes!)


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6297 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Oct 7, 2010
1 parent e22cd43 commit 7e5d06a
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions Compiler/Exp.mo
Expand Up @@ -789,7 +789,9 @@ public function crefPrefixOf
"function: crefPrefixOf
author: PA
Returns true if prefixCref is a prefix of fullCref
For example, a.b is a prefix of a.b.c"
For example, a.b is a prefix of a.b.c.
adrpo 2010-10-07,
added also that a.b.c is a prefix of a.b.c[1].*!"
input ComponentRef prefixCref;
input ComponentRef fullCref;
output Boolean outBoolean;
Expand All @@ -815,6 +817,15 @@ algorithm
then
res;

// adrpo: 2010-10-07: first is an ID, second is qualified, see if one is prefix of the other
// even if the first one DOESN'T HAVE SUBSCRIPTS!
case (DAE.CREF_IDENT(ident = id1,subscriptLst = {}),
DAE.CREF_QUAL(ident = id2,subscriptLst = ss2))
equation
true = stringEqual(id1, id2);
then
true;

// first is an ID, second is qualified, see if one is prefix of the other
case (DAE.CREF_IDENT(ident = id1,subscriptLst = ss1),
DAE.CREF_QUAL(ident = id2,subscriptLst = ss2))
Expand All @@ -823,13 +834,31 @@ algorithm
res = subscriptEqual(ss1, ss2);
then
res;

// adrpo: 2010-10-07: first is an ID, second is an ID, see if one is prefix of the other
// even if the first one DOESN'T HAVE SUBSCRIPTS!
case (DAE.CREF_IDENT(ident = id1,subscriptLst = {}),
DAE.CREF_IDENT(ident = id2,subscriptLst = ss2))
equation
true = stringEqual(id1, id2);
then
true;

case (DAE.CREF_IDENT(ident = id1,subscriptLst = ss1),
DAE.CREF_IDENT(ident = id2,subscriptLst = ss2))
equation
true = stringEqual(id1, id2);
res = subscriptEqual(ss1, ss2);
then
res;

// they might be equal, a.b.c is a prefix of a.b.c
/* adrpo: 2010-10-07. already handled by the cases above!
they might be equal, a.b.c is a prefix of a.b.c
case (cr1,cr2)
equation
true = crefEqualNoStringCompare(cr1, cr2);
then
true;
true;*/

// they are not a prefix of one-another
case (cr1,cr2)
Expand Down

0 comments on commit 7e5d06a

Please sign in to comment.