Skip to content

Commit

Permalink
- fix for evalOutputOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
vwaurich committed Nov 20, 2015
1 parent 4564e1c commit 487eea1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 2 additions & 4 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -5439,8 +5439,6 @@ end addTimeAsState4;
//-------------------------------------
//Evaluate Output Variables Only.
//-------------------------------------


public function evaluateOutputsOnly"Computes only the scc which are necessary in order to calculate the output vars.
author: Waurich TUD 09/2015"
input BackendDAE.BackendDAE daeIn;
Expand Down Expand Up @@ -5522,7 +5520,7 @@ algorithm
(states,stateIndxs) := BackendVariable.getVarLst(crefs,vars,{},{});
(stateIndxs,states) := List.filter1OnTrueSync(stateIndxs,stateVarIsNotVisited,varVisited,states);//not yet visited
if not listEmpty(stateIndxs) then
print("states "+stringDelimitList(List.map(states,BackendDump.varString),"\n ")+"\n");
//print("states "+stringDelimitList(List.map(states,BackendDump.varString),"\n ")+"\n");
List.map2_0(stateIndxs,Array.updateIndexFirst,1,varVisited);
//add the new tasks which are necessary for the states
stateTasks1 := List.map(List.map1(stateIndxs,Array.getIndexFirst,varCompMapping),Util.tuple31);
Expand Down Expand Up @@ -5572,7 +5570,7 @@ algorithm

(syst, _, _, mapEqnIncRow, mapIncRowEqn) := BackendDAEUtil.getIncidenceMatrixScalar(syst, BackendDAE.NORMAL(), SOME(funcTree));
syst := BackendDAETransform.strongComponentsScalar(syst,shared,mapEqnIncRow,mapIncRowEqn);

syst.removedEqs := BackendEquation.emptyEqns();
else
print("No output variables in this system\n");
end if;
Expand Down
20 changes: 11 additions & 9 deletions Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -6415,7 +6415,7 @@ protected
SimCodeVar.SimVar var;
algorithm
if not listEmpty(varLst) then
print(header+":\n----------------------\n");
print(header+"\n----------------------\n");
for var in varLst loop
print(simVarString(var)+"\n");
end for;
Expand Down Expand Up @@ -6587,40 +6587,40 @@ algorithm
case(SimCode.SES_RESIDUAL(index=idx,exp=exp))
equation
s = intString(idx) +": "+ ExpressionDump.printExpStr(exp)+" (RESIDUAL)";
print(s+"\n");
print(s);
then ();

case(SimCode.SES_SIMPLE_ASSIGN(index=idx,cref=cref,exp=exp))
equation
s = intString(idx) +": "+ ComponentReference.printComponentRefStr(cref) + "=" + ExpressionDump.printExpStr(exp)+"[" +DAEDump.daeTypeStr(Expression.typeof(exp))+ "]";
print(s+"\n");
print(s);
then ();

case(SimCode.SES_ARRAY_CALL_ASSIGN(index=idx,lhs=lhs,exp=exp))
equation
s = intString(idx) +": "+ ExpressionDump.printExpStr(lhs) + "=" + ExpressionDump.printExpStr(exp)+"[" +DAEDump.daeTypeStr(Expression.typeof(exp))+ "]";
print(s+"\n");
print(s);
then ();

case(SimCode.SES_IFEQUATION(index=idx))
equation
s = intString(idx) +": "+ " (IF)";
print(s+"\n");
print(s);
then ();

case(SimCode.SES_ALGORITHM(index=idx,statements=stmts))
equation
sLst = List.map(stmts,DAEDump.ppStatementStr);
sLst = List.map1(sLst, stringAppend, "\t");
s = intString(idx) +": "+ List.fold(sLst,stringAppend,"");
print(s+"\n");
print(s);
then ();

case(SimCode.SES_INVERSE_ALGORITHM(index=idx,statements=stmts)) equation
sLst = List.map(stmts, DAEDump.ppStatementStr);
sLst = List.map1(sLst, stringAppend, "\t");
s = intString(idx) +": "+ List.fold(sLst, stringAppend, "");
print(s+"\n");
print(s);
then ();

// no dynamic tearing
Expand Down Expand Up @@ -6689,7 +6689,6 @@ algorithm
dumpSimEqSystem(cont);
print("\t");
dumpSimEqSystemLst(eqs,"\n\t");
print("\n");
then ();

case(SimCode.SES_WHEN(index=idx, conditions=crefs, whenStmtLst = whenStmtLst, elseWhen=elseWhen))
Expand Down Expand Up @@ -6809,12 +6808,15 @@ public function dumpSimCodeDebug"prints the simcode debug output to std out."
protected
list<Option<SimCode.JacobianMatrix>> jacObs;
algorithm
print("algebraicEquations: \n-----------------------\n");
print("allEquations: \n-----------------------\n");
dumpSimEqSystemLst(simCode.allEquations,"\n");
print("\n--------------\n");
print("odeEquations ("+intString(listLength(simCode.odeEquations))+" systems): \n-----------------------\n");
List.map1_0(simCode.odeEquations,dumpSimEqSystemLst,"\n");
print("\n--------------\n");
print("algebraicEquations ("+intString(listLength(simCode.algebraicEquations))+" systems): \n-----------------------\n");
List.map1_0(simCode.algebraicEquations,dumpSimEqSystemLst,"\n");
print("\n--------------\n");
print("initialEquations: ("+intString(listLength(simCode.initialEquations))+")\n-----------------------\n");
dumpSimEqSystemLst(simCode.initialEquations,"\n");
print("removedInitialEquations: \n-----------------------\n");
Expand Down

0 comments on commit 487eea1

Please sign in to comment.