Skip to content

Commit

Permalink
- dont apply partlintornsystem for systems including dummy states
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23804 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed Dec 16, 2014
1 parent f792688 commit 7743e11
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions Compiler/BackEnd/HpcOmEqSystems.mo
Expand Up @@ -195,9 +195,9 @@ algorithm
comp = listGet(compsIn,compIdx);
BackendDAE.TORNSYSTEM(tearingvars = tvarIdcs, residualequations = resEqIdcs, otherEqnVarTpl = otherEqnVarTpl, linear = linear) = comp;
true = linear;
//true = intLe(listLength(tvarIdcs),3);
true = intLe(listLength(tvarIdcs),3);
print("LINEAR TORN SYSTEM OF SIZE "+intString(listLength(tvarIdcs))+"\n");

false = compHasDummyState(comp,systIn);
// build the new components, the new variables and the new equations
(varsNew,eqsNew,_,resEqs,matchingNew) = reduceLinearTornSystem2(systIn,sharedIn,tvarIdcs,resEqIdcs,otherEqnVarTpl,tornSysIdxIn);

Expand Down Expand Up @@ -308,6 +308,38 @@ algorithm
end matchcontinue;
end reduceLinearTornSystem1;

protected function compHasDummyState"outputs true if the component solves a dummy state var
author: Waurich TUD 2014-12"
input BackendDAE.StrongComponent comp;
input BackendDAE.EqSystem syst;
output Boolean hasDummy;
algorithm
hasDummy := match(comp,syst)
local
Boolean b;
BackendDAE.Variables vars;
list<Integer> varIdcs, otherVars;
list<BackendDAE.Var> varLst;
list<tuple<Integer,list<Integer>>> otherEqnVarTpl;
case(BackendDAE.TORNSYSTEM(tearingvars=varIdcs,otherEqnVarTpl=otherEqnVarTpl),BackendDAE.EQSYSTEM(orderedVars=vars))
equation
otherVars = List.flatten(List.map(otherEqnVarTpl,Util.tuple22));
//varIdcs = listAppend(varIdcs,otherVars);
varLst = List.map1(varIdcs,BackendVariable.getVarAtIndexFirst,vars);
b = List.fold(List.map(varLst,BackendVariable.isDummyStateVar),boolOr,false);
if b then print("THERE IS A DUMMY STATE!"); end if;
then b;
case(BackendDAE.EQUATIONSYSTEM(vars=varIdcs),BackendDAE.EQSYSTEM(orderedVars=vars))
equation
varLst = List.map1(varIdcs,BackendVariable.getVarAtIndexFirst,vars);
b = List.fold(List.map(varLst,BackendVariable.isDummyStateVar),boolOr,false);
if b then print("THERE IS A DUMMY STATE!"); end if;
then b;
else
then false;
end match;
end compHasDummyState;

protected function updateAssignmentsByComp"updates the assignments by the information given in the component.
author:Waurich TUD 2014-11"
input BackendDAE.StrongComponent comp;
Expand Down

0 comments on commit 7743e11

Please sign in to comment.