Skip to content

Commit

Permalink
- start to separate DAELow.mo on the files BackendDAEUtil.mo and Bac…
Browse files Browse the repository at this point in the history
…kendDAETransform.mo

 - all functions regarding the lowering are moved to BackendDAETransform and util functions need there
   moved to BackendDAEUtil



git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/sjoelund-functiontree@6587 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Oct 25, 2010
1 parent e9fd73a commit 447f484
Show file tree
Hide file tree
Showing 13 changed files with 7,724 additions and 7,554 deletions.
3,165 changes: 3,165 additions & 0 deletions Compiler/BackendDAETransform.mo

Large diffs are not rendered by default.

1,331 changes: 1,326 additions & 5 deletions Compiler/BackendDAEUtil.mo

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions Compiler/BackendDump.mo
Expand Up @@ -38,6 +38,7 @@ package BackendDump
"

public import BackendDAE;
public import BackendDAEUtil;
public import ComponentReference;
public import DAE;

Expand Down Expand Up @@ -203,7 +204,7 @@ algorithm
case (eqno,BackendDAE.DAELOW(orderedEqs = eqns))
equation
eqno_1 = eqno - 1;
eq = DAELow.equationNth(eqns, eqno_1);
eq = BackendDAEUtil.equationNth(eqns, eqno_1);
printEquation(eq);
then
();
Expand Down Expand Up @@ -514,7 +515,7 @@ algorithm
case (BackendDAE.DAELOW(vars1,vars2,vars3,av,eqns,reqns,ieqns,ae,algs,BackendDAE.EVENT_INFO(zeroCrossingLst = zc),extObjCls))
equation
print("Variables (");
vars = DAELow.varList(vars1);
vars = BackendDAEUtil.varList(vars1);
varlen = listLength(vars);
varlen_str = intString(varlen);
print(varlen_str);
Expand All @@ -523,15 +524,15 @@ algorithm
dumpVars(vars);
print("\n");
print("Known BackendDAE.Variables (constants) (");
knvars = DAELow.varList(vars2);
knvars = BackendDAEUtil.varList(vars2);
varlen = listLength(knvars);
varlen_str = intString(varlen);
print(varlen_str);
print(")\n");
print("=============================\n");
dumpVars(knvars);
print("External Objects (");
extvars = DAELow.varList(vars3);
extvars = BackendDAEUtil.varList(vars3);
varlen = listLength(extvars);
varlen_str = intString(varlen);
print(varlen_str);
Expand All @@ -547,23 +548,23 @@ algorithm
print("=============================\n");
dumpExtObjCls(extObjCls);
print("\nEquations (");
eqnsl = DAELow.equationList(eqns);
eqnsl = BackendDAEUtil.equationList(eqns);
eqnlen = listLength(eqnsl);
eqnlen_str = intString(eqnlen);
print(eqnlen_str);
print(")\n");
print("=========\n");
dumpEqns(eqnsl);
print("Simple Equations (");
reqnsl = DAELow.equationList(reqns);
reqnsl = BackendDAEUtil.equationList(reqns);
eqnlen = listLength(reqnsl);
eqnlen_str = intString(eqnlen);
print(eqnlen_str);
print(")\n");
print("=========\n");
dumpEqns(reqnsl);
print("Initial Equations (");
ieqnsl = DAELow.equationList(ieqns);
ieqnsl = BackendDAEUtil.equationList(ieqns);
eqnlen = listLength(ieqnsl);
eqnlen_str = intString(eqnlen);
print(eqnlen_str);
Expand Down Expand Up @@ -1189,7 +1190,7 @@ algorithm
equation
s1 = dumpMarkedEqns(dae, es);
e_1 = e - 1;
eqn = DAELow.equationNth(eqns, e_1);
eqn = BackendDAEUtil.equationNth(eqns, e_1);
s2 = equationStr(eqn);
res = stringAppendList({s2,";\n",s1});
then
Expand Down
22 changes: 12 additions & 10 deletions Compiler/CevalScript.mo
Expand Up @@ -62,6 +62,8 @@ public import Values;

protected import AbsynDep;
protected import BackendDump;
protected import BackendDAEUtil;
protected import BackendDAETransform;
protected import ConnectionGraph;
protected import ClassInf;
protected import ClassLoader;
Expand Down Expand Up @@ -340,8 +342,8 @@ algorithm
Inst.instantiateClass(cache,InnerOuter.emptyInstHierarchy,p_1, path);
dae = DAEUtil.transformationsBeforeBackend(dae);
ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(path,dae,env));
/*((daelow as BackendDAE.DAELOW(orderedVars=vars,orderedEqs=eqnarr,complexEqns = BackendDAE.COMPLEX_EQUATIONS(arrayEqs=ae,ifEqns=ifeqns)))) = DAELow.lower(dae, false, true) "no dummy state" ;*/
((daelow as BackendDAE.DAELOW(vars,_,_,_,eqnarr,_,_,ae,_,_,_))) = DAELow.lower(dae, Env.getFunctionTree(cache), false, true) "no dummy state" ;
/*((daelow as BackendDAE.DAELOW(orderedVars=vars,orderedEqs=eqnarr,complexEqns = BackendDAE.COMPLEX_EQUATIONS(arrayEqs=ae,ifEqns=ifeqns)))) = BackendDAETransform.lower(dae, false, true) "no dummy state" ;*/
((daelow as BackendDAE.DAELOW(vars,_,_,_,eqnarr,_,_,ae,_,_,_))) = BackendDAETransform.lower(dae, Env.getFunctionTree(cache), false, true) "no dummy state" ;
m = DAELow.incidenceMatrix(daelow);
mt = DAELow.transposeMatrix(m);
/* jac = DAELow.calculateJacobian(vars, eqnarr, ae,ifeqns, m, mt,false); */
Expand Down Expand Up @@ -2372,7 +2374,7 @@ algorithm
file_dir = getFileDir(a_cref, p);
elimLevel = RTOpts.eliminationLevel();
RTOpts.setEliminationLevel(0); // No variable eliminiation
dlow = DAELow.lower(dae, Env.getFunctionTree(cache), false, false);
dlow = BackendDAETransform.lower(dae, Env.getFunctionTree(cache), false, false);
RTOpts.setEliminationLevel(elimLevel); // Reset elimination level
flatModelicaStr = DAEDump.dumpStr(dae,Env.getFunctionTree(cache));
flatModelicaStr = stringAppend("OldEqStr={'", flatModelicaStr);
Expand Down Expand Up @@ -3506,10 +3508,10 @@ algorithm
elimLevel = RTOpts.eliminationLevel();
RTOpts.setEliminationLevel(0); // No variable elimination
(dlow as BackendDAE.DAELOW(orderedVars = BackendDAE.VARIABLES(numberOfVars = varSize),orderedEqs = eqns))
= DAELow.lower(dae, Env.getFunctionTree(cache), false/* no dummy variable*/, true);
= BackendDAETransform.lower(dae, Env.getFunctionTree(cache), false/* no dummy variable*/, true);
Debug.fcall("dumpdaelow", BackendDump.dump, dlow);
RTOpts.setEliminationLevel(elimLevel); // reset elimination level.
eqnSize = DAELow.equationSize(eqns);
eqnSize = BackendDAEUtil.equationSize(eqns);
(eqnSize,varSize) = subtractDummy(DAELow.daeVars(dlow),eqnSize,varSize);
simpleEqnSize = DAELow.countSimpleEquations(eqns);
eqnSizeStr = intString(eqnSize);
Expand Down Expand Up @@ -3546,10 +3548,10 @@ algorithm
elimLevel = RTOpts.eliminationLevel();
RTOpts.setEliminationLevel(0); // No variable elimination
(dlow as BackendDAE.DAELOW(orderedVars = BackendDAE.VARIABLES(numberOfVars = varSize),orderedEqs = eqns))
= DAELow.lower(dae, Env.getFunctionTree(cache), false/* no dummy variable*/, true);
= BackendDAETransform.lower(dae, Env.getFunctionTree(cache), false/* no dummy variable*/, true);
Debug.fcall("dumpdaelow", BackendDump.dump, dlow);
RTOpts.setEliminationLevel(elimLevel); // reset elimination level.
eqnSize = DAELow.equationSize(eqns);
eqnSize = BackendDAEUtil.equationSize(eqns);
(eqnSize,varSize) = subtractDummy(DAELow.daeVars(dlow),eqnSize,varSize);
simpleEqnSize = DAELow.countSimpleEquations(eqns);
eqnSizeStr = intString(eqnSize);
Expand Down Expand Up @@ -3893,7 +3895,7 @@ algorithm
(cache,env,_,dae_1) = Inst.instantiateClass(cache, InnerOuter.emptyInstHierarchy, p_1, classname);
dae = DAEUtil.transformationsBeforeBackend(dae_1);
ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(classname,dae,env));
dlow = DAELow.lower(dae, Env.getFunctionTree(cache), true, true);//Verificare cosa fa
dlow = BackendDAETransform.lower(dae, Env.getFunctionTree(cache), true, true);//Verificare cosa fa
xml_filename = System.stringAppendList({filenameprefix,".xml"});
funcelems = DAEUtil.getFunctionList(Env.getFunctionTree(cache));
Print.clearBuf();
Expand Down Expand Up @@ -3931,7 +3933,7 @@ algorithm
(cache,env,_,dae_1) = Inst.instantiateClass(cache, InnerOuter.emptyInstHierarchy, p_1, classname);
dae = DAEUtil.transformationsBeforeBackend(dae_1);
ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(classname,dae,env));
dlow = DAELow.lower(dae, Env.getFunctionTree(cache), true, true);
dlow = BackendDAETransform.lower(dae, Env.getFunctionTree(cache), true, true);
m = DAELow.incidenceMatrix(dlow);
mT = DAELow.transposeMatrix(m);
(_,_,dlow_1,m,mT) = DAELow.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(), BackendDAE.REMOVE_SIMPLE_EQN()), Env.getFunctionTree(cache));
Expand Down Expand Up @@ -3973,7 +3975,7 @@ algorithm
(cache,env,_,dae_1) = Inst.instantiateClass(cache, InnerOuter.emptyInstHierarchy, p_1, classname);
dae = DAEUtil.transformationsBeforeBackend(dae_1);
ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(classname,dae,env));
dlow = DAELow.lower(dae, Env.getFunctionTree(cache), true, true);
dlow = BackendDAETransform.lower(dae, Env.getFunctionTree(cache), true, true);
m = DAELow.incidenceMatrix(dlow);
mT = DAELow.transposeMatrix(m);
(ass1,ass2,dlow_1,m,mT) = DAELow.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(), BackendDAE.REMOVE_SIMPLE_EQN()),Env.getFunctionTree(cache));
Expand Down

0 comments on commit 447f484

Please sign in to comment.