Skip to content

Commit

Permalink
- fixed bug with array with size 1.
Browse files Browse the repository at this point in the history
 - uncommented print of communicate status (breaks the testsuite)


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10268 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Nov 1, 2011
1 parent e370306 commit 79bc483
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
29 changes: 15 additions & 14 deletions Compiler/BackEnd/BackendDAETransform.mo
Expand Up @@ -876,7 +876,6 @@ algorithm
outComp:=
match (inComp,syst,shared,inIncidenceMatrix,inIncidenceMatrixT,inAss1,inAss2)
local
BackendDAE.Value compelem,v;
list<BackendDAE.Value> comp;
list<tuple<BackendDAE.Var,BackendDAE.Value>> var_varindx_lst;
array<Integer> ass1,ass2;
Expand All @@ -886,14 +885,10 @@ algorithm
list<BackendDAE.Equation> eqn_lst;
BackendDAE.EquationArray eqns;
BackendDAE.StrongComponent compX;
case (compelem::{},_,_,_,_,_,ass2)
equation
v = ass2[compelem];
then BackendDAE.SINGLEEQUATION(compelem,v);
case (comp,syst as BackendDAE.EQSYSTEM(orderedVars=vars,orderedEqs=eqns),shared,m,mt,ass1,ass2)
equation
(eqn_lst,var_varindx_lst) = List.map3_2(comp, getEquationAndSolvedVar_Internal, eqns, vars, ass2);
compX = analyseStrongComponentBlock(comp,eqn_lst,var_varindx_lst,syst,shared,m,mt,ass1,ass2);
compX = analyseStrongComponentBlock(comp,eqn_lst,var_varindx_lst,syst,shared,m,mt,ass1,ass2,false);
then
compX;
else
Expand All @@ -915,13 +910,15 @@ protected function analyseStrongComponentBlock"function: analyseStrongComponentB
input BackendDAE.IncidenceMatrix inIncidenceMatrix;
input BackendDAE.IncidenceMatrixT inIncidenceMatrixT;
input array<Integer> inAss1;
input array<Integer> inAss2;
input array<Integer> inAss2;
input Boolean inLoop; //true if the function call itself
output BackendDAE.StrongComponent outComp;
algorithm
outComp:=
matchcontinue (inComp,inEqnLst,inVarVarindxLst,syst,shared,inIncidenceMatrix,inIncidenceMatrixT,inAss1,inAss2)
matchcontinue (inComp,inEqnLst,inVarVarindxLst,syst,shared,inIncidenceMatrix,inIncidenceMatrixT,inAss1,inAss2,inLoop)
local
Integer i;
BackendDAE.Value compelem,v;
list<BackendDAE.Value> comp,varindxs;
list<tuple<BackendDAE.Var,BackendDAE.Value>> var_varindx_lst,var_varindx_lst_cond;
array<Integer> ass1,ass2;
Expand All @@ -938,31 +935,35 @@ algorithm
array<DAE.Algorithm> al;
Option<list<tuple<Integer, Integer, BackendDAE.Equation>>> jac;
BackendDAE.JacobianType jac_tp;
BackendDAE.StrongComponent sc;
case (comp,eqn_lst,var_varindx_lst,_,_,m,mt,ass1,ass2)
BackendDAE.StrongComponent sc;
case (comp,eqn_lst,var_varindx_lst,_,_,m,mt,ass1,ass2,false)
equation
SOME(i) = singleAlgorithmEquation(eqn_lst,NONE());
varindxs = List.map(var_varindx_lst,Util.tuple22);
then
BackendDAE.SINGLEALGORITHM(i,comp,varindxs);
case (comp,eqn_lst,var_varindx_lst,_,_,m,mt,ass1,ass2)
case (comp,eqn_lst,var_varindx_lst,_,_,m,mt,ass1,ass2,false)
equation
SOME(i) = singleArrayEquation(eqn_lst,NONE());
varindxs = List.map(var_varindx_lst,Util.tuple22);
then
BackendDAE.SINGLEARRAY(i,comp,varindxs);
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 (compelem::{},_,_,_,_,_,_,_,ass2,false)
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,_)
equation
var_lst = List.map(var_varindx_lst,Util.tuple21);
true = BackendVariable.hasDiscreteVar(var_lst);
true = BackendVariable.hasContinousVar(var_lst);
varindxs = List.map(var_varindx_lst,Util.tuple22);
(cont_eqn,cont_var,disc_eqn,disc_var,indxcont_eqn,indxcont_var,indxdisc_eqn,indxdisc_var) = splitMixedEquations(eqn_lst, comp, var_lst, varindxs);
var_varindx_lst_cond = List.threadTuple(cont_var,indxcont_var);
sc = analyseStrongComponentBlock(indxcont_eqn,cont_eqn,var_varindx_lst_cond,syst,shared,m,mt,ass1,ass2);
sc = analyseStrongComponentBlock(indxcont_eqn,cont_eqn,var_varindx_lst_cond,syst,shared,m,mt,ass1,ass2,true);
then
BackendDAE.MIXEDEQUATIONSYSTEM(sc,indxdisc_eqn,indxdisc_var);
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,_)
equation
var_lst = List.map(var_varindx_lst,Util.tuple21);
varindxs = List.map(var_varindx_lst,Util.tuple22);
Expand Down
2 changes: 1 addition & 1 deletion c_runtime/simulation_runtime.cpp
Expand Up @@ -1079,7 +1079,7 @@ void communicateStatus(const char *phase, double completionPercent /*0.0 to 1.0*
s << (int)(completionPercent*10000) << " " << phase << endl;
std::string str(s.str());
sim_communication_port.send(str);
cout << str;
//cout << str;
}
#endif
}
Expand Down

0 comments on commit 79bc483

Please sign in to comment.