Skip to content

Commit

Permalink
- dump Statistic about the system with +d=backenddaeinfo
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11249 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Mar 1, 2012
1 parent e894cf8 commit 5a7544b
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 27 deletions.
3 changes: 2 additions & 1 deletion Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -44,7 +44,7 @@ public import DAE;

protected import Algorithm;
protected import BackendDAEUtil;
protected import BackendDump;
//protected import BackendDump;
protected import BackendEquation;
protected import BackendVariable;
protected import BaseHashTable;
Expand Down Expand Up @@ -139,6 +139,7 @@ algorithm
aliasVars := BackendDAEUtil.emptyAliasVariables();
outBackendDAE := BackendDAE.DAE(BackendDAE.EQSYSTEM(vars_1,eqnarr,NONE(),NONE(),BackendDAE.NO_MATCHING())::{},BackendDAE.SHARED(knvars,extVars,aliasVars,ieqnarr,reqnarr,arr_md_eqns,algarr,einfo,extObjCls,BackendDAE.SIMULATION()));
BackendDAEUtil.checkBackendDAEWithErrorMsg(outBackendDAE);
Debug.fcall(Flags.DUMP_BACKENDDAE_INFO,print,"No. of Equations: " +& intString(listLength(eqns_1)) +& " No. of Variables: " +& intString(BackendVariable.varsSize(vars_1)) +& "\n");
end lower;

protected function lower2
Expand Down
10 changes: 5 additions & 5 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -2439,14 +2439,14 @@ algorithm
// failure(DAE.UNARY(operator=DAE.UMINUS(ty=_),exp=DAE.CREF(componentRef=_)) = exp);
// BackendDump.debugStrExpStrExpStr(("Found ",ecr," = ",exp,"\n"));
expvars = BackendDAEUtil.incidenceRowExp(exp,vars, {},BackendDAE.NORMAL());
// print("expvars "); BackendDump.debuglst((expvars,intString)); print("\n");
// print("expvars "); BackendDump.debuglst((expvars,intString," ")); print("\n");
(expvars1::expvarseqns) = List.map1(expvars,varEqns,(pos,mT));
// print("expvars1 "); BackendDump.debuglst((expvars1,intString)); print("\n");
// print("expvars1 "); BackendDump.debuglst((expvars1,intString," ")); print("\n");
controleqns = getControlEqns(expvars1,expvarseqns);
// print("controleqns "); BackendDump.debuglst((controleqns,intString)); print("\n");
// print("controleqns "); BackendDump.debuglst((controleqns,intString," ")); print("\n");
(eqns1,arreqns1,algorithms1,einfo1,changed) = removeEqualFunctionCall(controleqns,ecr,exp,eqns,arreqns,algorithms,einfo,changed);
//print("changed1 "); BackendDump.debuglst((changed1,intString)); print("\n");
//print("changed2 "); BackendDump.debuglst((changed2,intString)); print("\n");
//print("changed1 "); BackendDump.debuglst((changed1,intString," ")); print("\n");
//print("changed2 "); BackendDump.debuglst((changed2,intString," ")); print("\n");
// print("Next\n");
then (({},m,(mT,vars,eqns1,arreqns1,algorithms1,einfo1,changed)));
case ((elem,pos,m,(mT,vars,eqns,arreqns,algorithms,einfo,changed)))
Expand Down
23 changes: 12 additions & 11 deletions Compiler/BackEnd/BackendDAETransform.mo
Expand Up @@ -231,7 +231,7 @@ algorithm
fail();
else
equation
Debug.fprint(Flags.FAILTRACE, "- BackendDAE.checkMatching failed\n");
Debug.fprint(Flags.FAILTRACE, "- BackendDAETransform.checkMatching failed\n");
then
fail();
end matchcontinue;
Expand Down Expand Up @@ -954,7 +954,7 @@ algorithm
equation
v = ass2[compelem];
then BackendDAE.SINGLEEQUATION(compelem,v);
case (comp,eqn_lst,var_varindx_lst,syst as BackendDAE.EQSYSTEM(orderedVars=vars,orderedEqs=eqns),shared as BackendDAE.SHARED(arrayEqs=ae,algorithms=al),m,mt,ass1,ass2,_)
case (comp,eqn_lst,var_varindx_lst,syst as BackendDAE.EQSYSTEM(orderedVars=vars,orderedEqs=eqns),shared as BackendDAE.SHARED(arrayEqs=ae,algorithms=al),m,mt,ass1,ass2,false)
equation
var_lst = List.map(var_varindx_lst,Util.tuple21);
true = BackendVariable.hasDiscreteVar(var_lst);
Expand All @@ -968,6 +968,7 @@ algorithm
case (comp,eqn_lst,var_varindx_lst,syst as BackendDAE.EQSYSTEM(orderedVars=vars,orderedEqs=eqns),shared as BackendDAE.SHARED(arrayEqs=ae,algorithms=al),m,mt,ass1,ass2,_)
equation
var_lst = List.map(var_varindx_lst,Util.tuple21);
// false = BackendVariable.hasDiscreteVar(var_lst); ToDo: Is this right, than it should be commited in
varindxs = List.map(var_varindx_lst,Util.tuple22);
eqn_lst = replaceDerOpInEquationList(eqn_lst);
ae1 = Util.arrayMap(ae,replaceDerOpMultiDimEquations);
Expand Down Expand Up @@ -2215,9 +2216,9 @@ algorithm
eqns_1 = List.setDifferenceOnTrue(eqns, diff_eqns, intEq);
true = intEq(listLength(eqns_1),0);
Debug.fcall(Flags.BLT_DUMP, print, "Reduce Index\ndiff equations: ");
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (diff_eqns,intString));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (diff_eqns,intString," "));
Debug.fcall(Flags.BLT_DUMP, print, "\nmarked equations: ");
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (eqns,intString));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (eqns,intString," "));
Debug.fcall(Flags.BLT_DUMP, BackendDump.dump, BackendDAE.DAE({syst},shared));
vec1 = assignmentsVector(ass1);
vec2 = assignmentsVector(ass2);
Expand All @@ -2234,9 +2235,9 @@ algorithm
diff_eqns = BackendDAEEXT.getDifferentiatedEqns();
eqns_1 = List.setDifferenceOnTrue(eqns, diff_eqns, intEq);
Debug.fcall(Flags.BLT_DUMP, print, "Reduce Index\nmarked equations: ");
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (eqns_1,intString));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (eqns_1,intString," "));
Debug.fcall(Flags.BLT_DUMP, print, "\ndiff equations: ");
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (diff_eqns,intString));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (diff_eqns,intString," "));
Debug.fcall(Flags.BLT_DUMP, print, "\n");
smeqs = BackendDump.dumpMarkedEqns(syst, eqns_1);
Debug.fcall(Flags.BLT_DUMP, print, smeqs);
Expand Down Expand Up @@ -2505,7 +2506,7 @@ algorithm
eqns_1 = BackendEquation.equationSetnth(eqns,e_1,eqn_1);
eqnslst1 = collectVarEqns(ilst,e::eqnslst,mt,arrayLength(mt));
Debug.fcall(Flags.BLT_DUMP, print, "Update Incidence Matrix: ");
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst,(eqnslst1,intString));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst,(eqnslst1,intString," "));
Debug.fcall(Flags.BLT_DUMP, print, "\n");
syst = BackendDAE.EQSYSTEM(v1,eqns_1,SOME(m),SOME(mt),matching);
shared = BackendDAE.SHARED(kv,ev,av,ie,seqns,ae1,al1,BackendDAE.EVENT_INFO(wclst1,zc),eoc,btp);
Expand Down Expand Up @@ -3643,7 +3644,7 @@ algorithm
// analyse jac
(eqnjac,l) = analyseJac1(jac,inStates,knvars,1);
Debug.fcall(Flags.BLT_DUMP, print ,"\n");
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst ,(eqnjac,dumpEqnJac));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst ,(eqnjac,dumpEqnJac," "));
Debug.fcall(Flags.BLT_DUMP, print ,"\n");
// next
(jacsys,orgeqns) = calculateJacobianSystem(rest,syst,shared,inStates);
Expand Down Expand Up @@ -4094,7 +4095,7 @@ algorithm
ep2 = ep1+1;
ep3 = ep1+2;
Debug.fcall(Flags.BLT_DUMP, print, "Update Incidence Matrix: ");
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst,({ep1,ep2,ep3},intString));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst,({ep1,ep2,ep3},intString," "));
Debug.fcall(Flags.BLT_DUMP, print, "\n");
syst = BackendDAEUtil.updateIncidenceMatrix(syst, shared, {ep1,ep2,ep3});
ast = getAssigned(stateno,ass1,ass2);
Expand Down Expand Up @@ -4182,7 +4183,7 @@ algorithm
equation
(state,stateno) = selectDummyState(dummystates, stateindx, syst, shared);
Debug.fcall(Flags.BLT_DUMP, BackendDump.debugStrCrefStr, ("Selected ",state," as dummy state\n From candidates: "));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst ,(dummystates,ComponentReference.printComponentRefStr));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst ,(dummystates,ComponentReference.printComponentRefStr," "));
Debug.fcall(Flags.BLT_DUMP, print ,"\n");
// update statecandidates
states = removeStatefromCandidates(stateno,states);
Expand Down Expand Up @@ -4232,7 +4233,7 @@ algorithm
"We need to change variables in the differentiated equations and in the equations having the dummy derivative" ;
syst = makeAlgebraic(syst, dummystate);
Debug.fcall(Flags.BLT_DUMP, print ,"Update Incidence Matrix: ");
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (changedeqns,intString));
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst, (changedeqns,intString," "));
Debug.fcall(Flags.BLT_DUMP, print ,"\n");
syst = BackendDAEUtil.updateIncidenceMatrix(syst, shared, changedeqns);
then
Expand Down
5 changes: 5 additions & 0 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -6037,6 +6037,7 @@ algorithm
Debug.execStat("expandAlgorithmsbyInitStmts",BackendDAE.RT_CLOCK_EXECSTAT_BACKEND_MODULES);
Debug.fcall(Flags.DUMP_INDX_DAE, print, "dumpindxdae:\n");
Debug.fcall(Flags.DUMP_INDX_DAE, BackendDump.dump, outSODE);
Debug.fcall(Flags.DUMP_BACKENDDAE_INFO, BackendDump.dumpCompShort, outSODE);
end getSolvedSystem;

public function preOptimiseBackendDAE
Expand Down Expand Up @@ -6601,6 +6602,10 @@ algorithm
realAdd(getGlobalRoot(Global.profilerTime2Index),t));
end profilerstop2;

/*************************************************
* traverse BackendDAE equation systems
************************************************/

public function mapEqSystem1
"Helper to map a preopt module over each equation system"
input BackendDAE.BackendDAE dae;
Expand Down

0 comments on commit 5a7544b

Please sign in to comment.