Skip to content

Commit

Permalink
- fixing Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation
Browse files Browse the repository at this point in the history
  by changing alias start-value and nominal-value selection.
   - prioritise the own variable attribute-value
- downgrade test Modelica.Fluid.Examples.HeatingSystem.mos for now.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25021 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Mar 11, 2015
1 parent 0f31e57 commit 3b82e2a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Compiler/BackEnd/RemoveSimpleEquations.mo
Expand Up @@ -129,7 +129,7 @@ protected type VarSetAttributes =
tuple<Integer, list<tuple<Option<DAE.Exp>, DAE.ComponentRef>>>,
list<tuple<DAE.Exp, DAE.ComponentRef>>,
tuple<Option<DAE.Exp>,
Option<DAE.Exp>>
Option<DAE.Exp>>
> "fixed, list<startvalue, origin, cr>, nominal, (min, max)";

protected constant VarSetAttributes EMPTYVARSETATTRIBUTES = (false, (-1, {}), {}, (NONE(), NONE()));
Expand Down Expand Up @@ -3210,7 +3210,7 @@ algorithm
outVar := matchcontinue(iZeroFreeValues, iFavorit, iStr, iAttributeName, inFunc, inVar)
local
DAE.Exp e, es;
DAE.ComponentRef cr, crs;
DAE.ComponentRef cr, crs, crVar;
BackendDAE.Var v;
list<tuple<DAE.Exp, DAE.ComponentRef>> zerofreevalues;
Integer i, is;
Expand All @@ -3223,9 +3223,8 @@ algorithm
// end of list analyse what we got
case ({}, rest, _, _, _, _) equation
((e, cr, i)) = selectNonZeroExpression(rest);
s = iStr + "=> select value from " + ComponentReference.printComponentRefStr(cr) + "(" + iAttributeName + " = " + ExpressionDump.printExpStr(e) + ")\n" +
" because its component reference (or its binding component reference) is closer to the top level scope with depth: " + intString(i) + ".\n" +
" If we have equal component reference depth for several components choose the one with non zero binding.";
crVar = BackendVariable.varCref(inVar);
s = iStr + "=> select value from " + ComponentReference.printComponentRefStr(cr) + "(" + iAttributeName + " = " + ExpressionDump.printExpStr(e) + ") for variable: " + ComponentReference.printComponentRefStr(crVar) + "\n";
Error.addMessage(Error.COMPILER_WARNING, {s});
v = inFunc(inVar, e);
then v;
Expand All @@ -3241,14 +3240,18 @@ algorithm
s = iStr + " * candidate: " + ComponentReference.printComponentRefStr(cr) + "(" + iAttributeName + " = " + ExpressionDump.printExpStr(e) + ")\n";
i = selectMinDepth(ComponentReference.crefDepth(cr), e);
true = intEq(i, is);
favorit = (e, cr, i)::(es, crs, is)::rest;
crVar = BackendVariable.varCref(inVar);
favorit = if ComponentReference.crefEqual(crVar, cr) then {(e, cr, i),(es, crs, is)} else {(es, crs, is),(e, cr, i)};
favorit = listAppend(favorit,rest);
then selectFreeValue1(zerofreevalues, favorit, s, iAttributeName, inFunc, inVar);

// less than, remove all from list, return just this one
case ((e, cr)::zerofreevalues, (_, _, is)::_, _, _, _, _) equation
case ((e, cr)::zerofreevalues, (es, crs, is)::_, _, _, _, _) equation
s = iStr + " * candidate: " + ComponentReference.printComponentRefStr(cr) + "(" + iAttributeName + " = " + ExpressionDump.printExpStr(e) + ")\n";
i = selectMinDepth(ComponentReference.crefDepth(cr), e);
favorit = if intLt(i, is) then {(e, cr, i)} else iFavorit;
crVar = BackendVariable.varCref(inVar);
favorit = if ComponentReference.crefEqual(crVar, crs) then {(es, crs, is),(e, cr, i)} else favorit;
then selectFreeValue1(zerofreevalues, favorit, s, iAttributeName, inFunc, inVar);
end matchcontinue;
end selectFreeValue1;
Expand Down

0 comments on commit 3b82e2a

Please sign in to comment.