Skip to content

Commit

Permalink
Compiler/BackEnd/BackendDAEUtil.mo
Browse files Browse the repository at this point in the history
  - again: internally generated call start(v) depends not on v
Compiler/BackEnd/BackendDump.mo
  - rename some functions to get consistent naming style
Compiler/BackEnd/Initialization.mo
  - remove previously introduced fallback cases
Compiler/BackEnd/SimCodeUtil.mo
  - remove some fucntions
    - fixInitialThing
    - simvarFixed
    - nonFixifyIfHasInit
testsuite/simulation/modelica/initialization/
  - test for additional initial conditions added by auto-fixed variables
  - move some tests from FAILINGTESTFILES to TESTFILES
testsuite/simulation/libraries/msl32/Modelica.Thermal.HeatTransfer.Examples.TwoMasses.mos
  - expected outputs
testsuite/simulation/libraries/msl32/Makefile
  - move some test from TESTFILES to FAILINGTESTFILES
    - Modelica.Fluid.Examples.AST_BatchPlant.Test.OneTank.mos
    - Modelica.Fluid.Examples.AST_BatchPlant.Test.TwoTanks.mos
    - Modelica.Fluid.Examples.AST_BatchPlant.Test.TankWithEmptyingPipe1.mos
    - Modelica.Fluid.Examples.AST_BatchPlant.Test.TankWithEmptyingPipe2.mos
    - Modelica.Fluid.Examples.AST_BatchPlant.Test.TanksWithEmptyingPipe2.mos
    - Modelica.Fluid.Examples.AST_BatchPlant.Test.TanksWithEmptyingPipe1.mos
  - sort tests alphabetically


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14316 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Dec 10, 2012
1 parent a210f23 commit 7b9a324
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 261 deletions.
6 changes: 3 additions & 3 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -7051,7 +7051,7 @@ algorithm

// Debug dumping
Debug.fcall(Flags.JAC_DUMP2, BackendDump.dumpFullMatching, bdaeMatching);
Debug.fcall(Flags.JAC_DUMP2,BackendDump.dumpVars,BackendVariable.varList(varswithDiffs));
Debug.fcall(Flags.JAC_DUMP2,BackendDump.printVarList,BackendVariable.varList(varswithDiffs));
Debug.fcall(Flags.JAC_DUMP2,BackendDump.dumpEqns,BackendEquation.equationList(orderedEqns));
Debug.fcall(Flags.JAC_DUMP2,BackendDump.dumpIncidenceMatrix,adjMatrix);
Debug.fcall(Flags.JAC_DUMP2,BackendDump.dumpIncidenceMatrixT,adjMatrixT);
Expand Down Expand Up @@ -11965,7 +11965,7 @@ algorithm
eqnmark = arrayCreate(arrayLength(ass2),false);
(g0,othercomps1) = getOtherEquationsPointZero(othercomps,vars,eqns,repl,eqnmark,mapIncRowEqn,{},{});
Debug.fcall(Flags.TEARING_DUMP, print,"k0:\n");
Debug.fcall(Flags.TEARING_DUMP, BackendDump.dumpVars,k0);
Debug.fcall(Flags.TEARING_DUMP, BackendDump.printVarList,k0);
Debug.fcall(Flags.TEARING_DUMP, print,"g0:\n");
Debug.fcall(Flags.TEARING_DUMP, BackendDump.dumpEqns,g0);
// replace tearing vars with zero and other wars with temp variables to get residual equations for point zero (h(z0,k0)=h0)
Expand Down Expand Up @@ -12000,7 +12000,7 @@ algorithm
pdcr_lst = BackendEquation.equationUnknownCrefs(g,BackendVariable.daeVars(isyst),kvars);
pdvarlst = List.map(pdcr_lst,makePardialDerVar);
Debug.fcall(Flags.TEARING_DUMP, print,"PartialDerivatives:\n");
Debug.fcall(Flags.TEARING_DUMP, BackendDump.dumpVars,pdvarlst);
Debug.fcall(Flags.TEARING_DUMP, BackendDump.printVarList,pdvarlst);
Debug.fcall(Flags.TEARING_DUMP, print,"dh/dz extra:\n");
Debug.fcall(Flags.TEARING_DUMP, BackendDump.dumpEqns,g);
tvarexps = List.map2(tvars,getTVarCrefExps,vars,ishared);
Expand Down
5 changes: 2 additions & 3 deletions Compiler/BackEnd/BackendDAETransform.mo
Expand Up @@ -1144,8 +1144,7 @@ algorithm
fail();
else
equation
msg = "BackendDAETransform.analyseStrongComponentBlock failed";
Error.addMessage(Error.INTERNAL_ERROR, {msg});
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponentBlock failed"});
then
fail();
end matchcontinue;
Expand Down Expand Up @@ -1494,7 +1493,7 @@ algorithm
then (contEqnLst,contVarLst,discEqnLst,discVarLst,indxcontEqnLst,indxcontVarLst,indxdiscEqnLst,indxdiscVarLst);
case (_,_,_,_)
equation
BackendDump.dumpVars(varLst);
BackendDump.printVarList(varLst);
BackendDump.dumpEqns(eqnLst);
then fail();
end matchcontinue;
Expand Down
7 changes: 5 additions & 2 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -1253,7 +1253,7 @@ algorithm
case (var as BackendDAE.VAR(bindValue = SOME(_)), _, _, _)
equation
print("*** Not Ceval.eval var: ");
BackendDump.dumpVars({var});
BackendDump.printVar(var);
print("\n");
then
var;
Expand Down Expand Up @@ -3799,7 +3799,10 @@ algorithm
res = incidenceRowExp1(varslst,p,pa,false);
then
((e,false,(vars,res)));


// lochel: internally generated call start(v) depends not on v
case ((e as DAE.CALL(path = Absyn.IDENT(name = "$_start")), (vars, pa))) then ((e, false, (vars, pa)));

/* pre(v) is considered a known variable */
case (((e as DAE.CALL(path = Absyn.IDENT(name = "pre")),(vars,pa)))) then ((e,false,(vars,pa)));

Expand Down
109 changes: 58 additions & 51 deletions Compiler/BackEnd/BackendDump.mo
Expand Up @@ -77,13 +77,39 @@ protected import Util;
// These are functions, that print directly to the standard-stream.
// =============================================================================

public function printVariables "function printVariables
Helper function to dump."
input BackendDAE.Variables vars;
algorithm
_ := List.fold(BackendVariable.varList(vars), printVars1, 1);
end printVariables;

public function printVarList "function printVarList
Helper function to dump."
input list<BackendDAE.Var> vars;
algorithm
_ := List.fold(vars, printVars1, 1);
end printVarList;

public function printVar "function printVar
"
input BackendDAE.Var inVar;
algorithm
print(varString(inVar) +& "\n");
end printVar;

protected function printVars1 "function printVars1
Helper function to printVariables and printVarList"
input BackendDAE.Var inVar;
input Integer inVarNo;
output Integer outVarNo;
algorithm
print(intString(inVarNo));
print(": ");
printVar(inVar);
outVarNo := inVarNo + 1;
end printVars1;

public function printEquation "function printEquation
author: PA
Helper function to print_equations"
Expand Down Expand Up @@ -166,6 +192,15 @@ end printEquationNo;
// there output (e.g. with some kind of headings).
// =============================================================================

public function dumpVariables "function dumpVariables"
input BackendDAE.Variables inVars;
input String heading;
algorithm
print("\n" +& heading +& "\n========================================\n");
printVariables(inVars);
print("\n");
end dumpVariables;

public function dumpBackendDAE "function dumpBackendDAE
This function dumps the BackendDAE.BackendDAE representaton to stdout."
input BackendDAE.BackendDAE inBackendDAE;
Expand Down Expand Up @@ -220,7 +255,7 @@ algorithm
print(varlen_str);
print(")\n");
print("=========\n");
dumpVars(vars);
printVarList(vars);
print("\n");
print("\nEquations (");
eqnsl := BackendEquation.equationList(eqns);
Expand Down Expand Up @@ -275,15 +310,15 @@ algorithm
print(varlen_str);
print(")\n");
print("=============================\n");
dumpVars(knvars);
printVarList(knvars);
print("External Objects (");
extvars = BackendVariable.varList(vars3);
varlen = listLength(extvars);
varlen_str = intString(varlen);
print(varlen_str);
print(")\n");
print("=============================\n");
dumpVars(extvars);
printVarList(extvars);

print("Classes of External Objects (");
varlen = listLength(extObjCls);
Expand Down Expand Up @@ -531,7 +566,7 @@ public function dumpBackendDAEVarList
input String header;
algorithm
print(header +& "\n");
dumpVars(inBackendDAEVarList);
printVarList(inBackendDAEVarList);
print("===================\n");
end dumpBackendDAEVarList;

Expand Down Expand Up @@ -604,7 +639,7 @@ algorithm
equation
print("SingleEquation: " +& intString(e) +& "\n");
var = BackendVariable.getVarAt(vars,v);
dumpVars({var});
printVarList({var});
eqn = BackendDAEUtil.equationNth(eqns,e-1);
dumpEqns({eqn});
dumpEqnsSolved2(rest,eqns,vars);
Expand All @@ -614,7 +649,7 @@ algorithm
equation
print("Mixed EquationSystem:\n");
varlst = List.map1r(vlst, BackendVariable.getVarAt, vars);
dumpVars(varlst);
printVarList(varlst);
eqnlst = BackendEquation.getEqns(elst,eqns);
dumpEqns(eqnlst);
dumpEqnsSolved2({comp},eqns,vars);
Expand All @@ -625,7 +660,7 @@ algorithm
equation
print("Equationsystem " +& jacobianTypeStr(jacType) +& ":\n");
varlst = List.map1r(vlst, BackendVariable.getVarAt, vars);
dumpVars(varlst);
printVarList(varlst);
eqnlst = BackendEquation.getEqns(elst,eqns);
dumpEqns(eqnlst);
dumpEqnsSolved2(rest,eqns,vars);
Expand All @@ -635,7 +670,7 @@ algorithm
equation
print("ArrayEquation:\n");
varlst = List.map1r(vlst, BackendVariable.getVarAt, vars);
dumpVars(varlst);
printVarList(varlst);
eqn = BackendDAEUtil.equationNth(eqns,e-1);
dumpEqns({eqn});
dumpEqnsSolved2(rest,eqns,vars);
Expand All @@ -645,7 +680,7 @@ algorithm
equation
print("Algorithm:\n");
varlst = List.map1r(vlst, BackendVariable.getVarAt, vars);
dumpVars(varlst);
printVarList(varlst);
eqn = BackendDAEUtil.equationNth(eqns,e-1);
dumpEqns({eqn});
dumpEqnsSolved2(rest,eqns,vars);
Expand All @@ -655,7 +690,7 @@ algorithm
equation
print("ComplexEquation:\n");
varlst = List.map1r(vlst, BackendVariable.getVarAt, vars);
dumpVars(varlst);
printVarList(varlst);
eqn = BackendDAEUtil.equationNth(eqns,e-1);
dumpEqns({eqn});
dumpEqnsSolved2(rest,eqns,vars);
Expand All @@ -665,7 +700,7 @@ algorithm
equation
print("WhenEquation:\n");
varlst = List.map1r(vlst, BackendVariable.getVarAt, vars);
dumpVars(varlst);
printVarList(varlst);
eqn = BackendDAEUtil.equationNth(eqns,e-1);
dumpEqns({eqn});
dumpEqnsSolved2(rest,eqns,vars);
Expand All @@ -678,9 +713,9 @@ algorithm
vlst1 = List.flatten(List.map(eqnsvartpllst,Util.tuple22));
elst1 = List.map(eqnsvartpllst,Util.tuple21);
varlst = List.map1r(vlst1, BackendVariable.getVarAt, vars);
dumpVars(varlst);
printVarList(varlst);
varlst = List.map1r(vlst, BackendVariable.getVarAt, vars);
dumpVars(varlst);
printVarList(varlst);
eqnlst = BackendEquation.getEqns(elst1,eqns);
dumpEqns(eqnlst);
eqnlst = BackendEquation.getEqns(elst,eqns);
Expand Down Expand Up @@ -1766,7 +1801,7 @@ algorithm
vars := BackendVariable.varList(vars1);
varlen_str := "Variables (" +& intString(listLength(vars)) +& ")";
tags := DumpHTML.addHeadingTag(2,varlen_str,{});
tags := dumpVarsHTML(vars,prefixId,tags);
tags := printVarListHTML(vars,prefixId,tags);
eqnsl := BackendEquation.equationList(eqns);
eqnlen_str := "Equations (" +& intString(listLength(eqnsl)) +& "," +& intString(BackendDAEUtil.equationSize(eqns)) +& ")";
tags := DumpHTML.addHeadingTag(2,eqnlen_str,tags);
Expand All @@ -1781,9 +1816,9 @@ algorithm
outTpl := (doc,i+1);
end dumpEqSystemHTML;

protected function dumpVarsHTML
"function: dumpVarsHTML
Helper function to dumpVars."
protected function printVarListHTML
"function: printVarListHTML
Helper function to printVarList."
input list<BackendDAE.Var> vars;
input String prefixId;
input DumpHTML.Tags inTags;
Expand All @@ -1794,11 +1829,11 @@ algorithm
((tags,_)) := List.fold1(vars,dumpVarHTML,prefixId,({},1));
outTags := DumpHTML.addHyperLinkTag("javascript:toggle('" +& prefixId +& "variables')","Variablen einblenden","Variablen ein/ausblenden",inTags);
outTags := DumpHTML.addDivisionTag(prefixId +& "variables",{("background","#FFFFCC"),("display","none")},tags,outTags);
end dumpVarsHTML;
end printVarListHTML;

protected function dumpVarHTML
"function: dumpVar
Helper function to dumpVars."
Helper function to printVarList."
input BackendDAE.Var inVar;
input String prefixId;
input tuple<DumpHTML.Tags,Integer> inTpl;
Expand All @@ -1818,8 +1853,8 @@ algorithm
end dumpVarHTML;

protected function dumpEqnsHTML
"function: dumpVarsHTML
Helper function to dumpVars."
"function: printVarListHTML
Helper function to printVarList."
input list<BackendDAE.Equation> eqns;
input String prefixId;
input DumpHTML.Tags inTags;
Expand Down Expand Up @@ -2196,36 +2231,8 @@ algorithm
end match;
end dumpExtObjCls;

public function dumpVarsArray "function dumpVarsArray
Helper function to dump."
input BackendDAE.Variables vars;
algorithm
_ := List.fold(BackendVariable.varList(vars), dumpVar, 1);
end dumpVarsArray;

public function dumpVars
"function: dumpVars
Helper function to dump."
input list<BackendDAE.Var> vars;
algorithm
_ := List.fold(vars,dumpVar,1);
end dumpVars;

protected function dumpVar "function dumpVar
Helper function to dumpVars."
input BackendDAE.Var inVar;
input Integer inVarNo;
output Integer outVarNo;
algorithm
print(intString(inVarNo));
print(": ");
print(varString(inVar));
print("\n");
outVarNo := inVarNo + 1;
end dumpVar;

public function varString "function varString
Helper function to dumpVars."
Helper function to printVarList."
input BackendDAE.Var inVar;
output String outStr;
protected
Expand Down Expand Up @@ -3049,7 +3056,7 @@ algorithm
print("AliasVariables: ");
print(sl);
print("\n===============\n");
dumpVars(vars);
printVarList(vars);
print("\n");
end dumpAliasVariables;

Expand Down

0 comments on commit 7b9a324

Please sign in to comment.