Skip to content

Commit

Permalink
- fixed partlintornsystem for equation systems
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23499 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed Nov 21, 2014
1 parent 7ced61c commit 70cc730
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Compiler/BackEnd/HpcOmEqSystems.mo
Expand Up @@ -271,8 +271,8 @@ algorithm

// insert the new components into the BLT, update matching for the new equations
compsTmp = List.replaceAtWithList(compsNew,compIdx-1,compsIn);
List.threadMap1_0(eqIdcs,varIdcs,Array.updateIndexFirst,ass1);
List.threadMap1_0(varIdcs,eqIdcs,Array.updateIndexFirst,ass2);
List.threadMap1_0(varIdcs,eqIdcs,Array.updateIndexFirst,ass1);
List.threadMap1_0(eqIdcs,varIdcs,Array.updateIndexFirst,ass2);
matching = BackendDAE.MATCHING(ass1, ass2, compsTmp);

// add the new vars and equations to the original EqSystem
Expand All @@ -284,7 +284,7 @@ algorithm

//build new DAE-EqSystem
systTmp = BackendDAE.EQSYSTEM(vars,eqs,NONE(),NONE(),matching,stateSets,partitionKind);
(systTmp,_,_) = BackendDAEUtil.getIncidenceMatrix(systTmp, BackendDAE.NORMAL(),NONE());
//(systTmp,_,_) = BackendDAEUtil.getIncidenceMatrix(systTmp, BackendDAE.NORMAL(),NONE());

(systTmp,tornSysIdx) = reduceLinearTornSystem1(compIdx+1,compsTmp,ass1,ass2,systTmp,sharedIn,tornSysIdxIn+1);
then
Expand Down Expand Up @@ -383,6 +383,7 @@ algorithm
case(BackendDAE.EQUATION(exp=lhs,scalar=rhs))
equation
expLst1 = Expression.allTerms(lhs);
expLst1 = List.map(expLst1,Expression.negate);
expLst2 = Expression.allTerms(rhs);
expLst1 = listAppend(expLst1,expLst2);
//print("the expLst: "+ExpressionDump.printExpListStr(expLst1)+"\n");
Expand Down Expand Up @@ -458,10 +459,10 @@ algorithm
ovarsLst := List.map(ovarsLst, BackendVariable.transformXToXd); //try this
ovars := BackendVariable.listVar1(ovarsLst);
ovcrs := List.map(ovarsLst, BackendVariable.varCref);
BackendDump.dumpVarList(tvarsReplaced,"tvars");
BackendDump.dumpVarList(ovarsLst,"ovars");
BackendDump.dumpEquationList(reqns,"residualEquations");
BackendDump.dumpEquationList(otherEqnsLstReplaced,"otherEqnsLstReplaced");
//BackendDump.dumpVarList(tvarsReplaced,"tvars");
//BackendDump.dumpVarList(ovarsLst,"ovars");
//BackendDump.dumpEquationList(reqns,"residualEquations");
//BackendDump.dumpEquationList(otherEqnsLstReplaced,"otherEqnsLstReplaced");

//build the components and systems to get the system for computing the tearingVars
size := listLength(tvars);
Expand Down Expand Up @@ -1507,6 +1508,7 @@ algorithm
//print("detLst \n"+stringDelimitList(List.map(detLst,ExpressionDump.printExpStr),"\n")+"\n");
varExp = List.map(arrayList(vectorX),BackendVariable.varExp);
detLst = List.map1(detLst,function Expression.makeBinaryExp(inOp = DAE.DIV(ty=DAE.T_ANYTYPE_DEFAULT)),detA);
(detLst,_) = List.map_2(detLst,ExpressionSimplify.simplify);
eqLst = List.threadMap2(varExp, detLst, BackendEquation.generateEQUATION, DAE.emptyElementSource, BackendDAE.UNKNOWN_EQUATION_KIND());
//BackendDump.dumpEquationList(eqLst,"new residual eqs");
then (eqLst,{},{});
Expand Down Expand Up @@ -1553,6 +1555,7 @@ algorithm
a22 = listGet(arrayGet(matrix,2),2);
ty = Expression.typeof(a11);
det = DAE.BINARY(DAE.BINARY(a11,DAE.MUL(ty = ty),a22),DAE.SUB(ty=ty),DAE.BINARY(a12,DAE.MUL(ty = ty),a21));
(det,_) = ExpressionSimplify.simplify(det);
then det;
else
equation
Expand Down

0 comments on commit 70cc730

Please sign in to comment.