Skip to content

Commit

Permalink
- added DAE.ElementSource to all records in DAE.Element.
Browse files Browse the repository at this point in the history
- changed all the models accordingly.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4760 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Jan 8, 2010
1 parent 890fa49 commit cbb570c
Show file tree
Hide file tree
Showing 21 changed files with 2,151 additions and 1,811 deletions.
32 changes: 20 additions & 12 deletions Compiler/BackendVarTransform.mo
Expand Up @@ -65,49 +65,55 @@ algorithm
Integer indx;
list<DAE.Exp> expl,expl1,expl2;
DAELow.WhenEquation whenEqn,whenEqn1;
DAE.ElementSource source "the origin of the element";

case ({},_) then {};
case ((DAELow.ARRAY_EQUATION(indx,expl)::es),repl)
case ((DAELow.ARRAY_EQUATION(indx,expl,source)::es),repl)
equation
expl1 = Util.listMap2(expl,VarTransform.replaceExp,repl,NONE);
expl2 = Util.listMap(expl1,Exp.simplify);
es_1 = replaceEquations(es,repl);
then
(DAELow.ARRAY_EQUATION(indx,expl2)::es_1);
case ((DAELow.EQUATION(exp = e1,scalar = e2) :: es),repl)
(DAELow.ARRAY_EQUATION(indx,expl2,source)::es_1);

case ((DAELow.EQUATION(exp = e1,scalar = e2,source = source) :: es),repl)
equation
e1_1 = VarTransform.replaceExp(e1, repl, NONE);
e2_1 = VarTransform.replaceExp(e2, repl, NONE);
e1_2 = Exp.simplify(e1_1);
e2_2 = Exp.simplify(e2_1);
es_1 = replaceEquations(es, repl);
then
(DAELow.EQUATION(e1_2,e2_2) :: es_1);
(DAELow.EQUATION(e1_2,e2_2,source) :: es_1);

case (((a as DAELow.ALGORITHM(index = _)) :: es),repl)
equation
es_1 = replaceEquations(es, repl);
then
(a :: es_1);
case ((DAELow.SOLVED_EQUATION(componentRef = cr,exp = e) :: es),repl)

case ((DAELow.SOLVED_EQUATION(componentRef = cr,exp = e,source = source) :: es),repl)
equation
e_1 = VarTransform.replaceExp(e, repl, NONE);
e_2 = Exp.simplify(e_1);
es_1 = replaceEquations(es, repl);
then
(DAELow.SOLVED_EQUATION(cr,e_2) :: es_1);
case ((DAELow.RESIDUAL_EQUATION(exp = e) :: es),repl)
(DAELow.SOLVED_EQUATION(cr,e_2,source) :: es_1);

case ((DAELow.RESIDUAL_EQUATION(exp = e,source = source) :: es),repl)
equation
e_1 = VarTransform.replaceExp(e, repl, NONE);
e_2 = Exp.simplify(e_1);
es_1 = replaceEquations(es, repl);
then
(DAELow.RESIDUAL_EQUATION(e_2) :: es_1);
(DAELow.RESIDUAL_EQUATION(e_2,source) :: es_1);

case ((DAELow.WHEN_EQUATION(whenEqn) :: es),repl)
case ((DAELow.WHEN_EQUATION(whenEqn,source) :: es),repl)
equation
whenEqn1 = replaceWhenEquation(whenEqn,repl);
es_1 = replaceEquations(es, repl);
then
(DAELow.WHEN_EQUATION(whenEqn1) :: es_1);
(DAELow.WHEN_EQUATION(whenEqn1,source) :: es_1);

case ((a :: es),repl)
equation
Expand Down Expand Up @@ -349,16 +355,18 @@ algorithm
DAELow.Equation a;
DAE.ComponentRef cr;
list<Integer> dims;
DAE.ElementSource source "the origin of the element";

case ({},_) then {};
case ((DAELow.MULTIDIM_EQUATION(left = e1,right = e2,dimSize = dims) :: es),repl)
case ((DAELow.MULTIDIM_EQUATION(left = e1,right = e2,dimSize = dims,source=source) :: es),repl)
equation
e1_1 = VarTransform.replaceExp(e1, repl, NONE);
e2_1 = VarTransform.replaceExp(e2, repl, NONE);
e1_2 = Exp.simplify(e1_1);
e2_2 = Exp.simplify(e2_1);
es_1 = replaceMultiDimEquations(es, repl);
then
(DAELow.MULTIDIM_EQUATION(dims,e1_2,e2_2) :: es_1);
(DAELow.MULTIDIM_EQUATION(dims,e1_2,e2_2,source) :: es_1);
end matchcontinue;
end replaceMultiDimEquations;

Expand Down

0 comments on commit cbb570c

Please sign in to comment.