Skip to content

Commit 2fa0ca4

Browse files
committed
Solving of linear system of equations generates incorrect results. - the problem was the fact that continuous equations were classified as discrete and ended up in functionDAE_output2 which is never called during the continuous integration but only at events. git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@3601 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent ea63061 commit 2fa0ca4

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Compiler/DAELow.mo

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,9 +1397,10 @@ algorithm
13971397
case (Exp.CREF(componentRef = cr),vars,knvars)
13981398
equation
13991399
failure((_,_) = getVar(cr, vars));
1400-
(_,_) = getVar(cr,knvars);
1400+
((VAR(cr,kind,dir,vartype,bind,value,dims,ind,orig,clname,attr,comment,flow_) :: _),_) = getVar(cr, knvars);
1401+
res = isKindDiscrete(kind);
14011402
then
1402-
true;
1403+
res;
14031404
case (Exp.BINARY(exp1 = e1,operator = op,exp2 = e2),vars,knvars)
14041405
equation
14051406
b1 = isDiscreteExp(e1, vars,knvars);

Compiler/SimCodegen.mo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7371,12 +7371,12 @@ and after a discrete event."
73717371
algorithm
73727372
(contBlocks,discBlocks) := matchcontinue(dlow,ass1,ass2,m,mT,blocks)
73737373
local DAELow.Variables vars,vars2,knvars;
7374-
list<DAELow.Var> varLst;
7374+
list<DAELow.Var> varLst, varLstDiscrete;
73757375
DAELow.EquationArray eqns;
73767376
case (dlow as DAELow.DAELOW(orderedVars=vars,knownVars = knvars,orderedEqs=eqns),ass1,ass2,m,mT,blocks) equation
73777377
varLst = DAELow.varList(vars);
7378-
varLst = Util.listSelect(varLst,DAELow.isVarDiscrete);
7379-
vars2 = DAELow.listVar(varLst);
7378+
varLstDiscrete = Util.listSelect(varLst,DAELow.isVarDiscrete);
7379+
vars2 = DAELow.listVar(varLstDiscrete);
73807380
(contBlocks,discBlocks,_) = splitOutputBlocks2(vars2,vars,knvars,eqns,ass1,ass2,m,mT,blocks);
73817381
then (contBlocks,discBlocks);
73827382
end matchcontinue;
@@ -7436,7 +7436,7 @@ algorithm
74367436

74377437
/* Equation has variablity discrete time */
74387438
case(discVars,vars,knvars,eqns,blck,ass2,mT) equation
7439-
(eqn_lst,var_lst) = Util.listMap32(blck, getEquationAndSolvedVar, eqns, vars, ass2);
7439+
(eqn_lst,var_lst) = Util.listMap32(blck, getEquationAndSolvedVar, eqns, discVars, ass2);
74407440
var_lst = Util.listMap1(var_lst,DAELow.setVarKind,DAELow.DISCRETE());
74417441
discVars = DAELow.addVars(var_lst,discVars);
74427442
_::_ = Util.listSelect2(eqn_lst,discVars,knvars,DAELow.isDiscreteEquation);

0 commit comments

Comments
 (0)