Skip to content

Commit

Permalink
- add in case of constant variables every time a parameter bound equa…
Browse files Browse the repository at this point in the history
…tion to the simulation code and in case of parameters only if it is not constant

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13968 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Nov 19, 2012
1 parent e0f41a7 commit b3fb8f5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Compiler/BackEnd/SimCodeUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6823,19 +6823,21 @@ algorithm
DAE.Exp e,cre;
DAE.ElementSource source;
list<Integer> v1,v2;
Integer pos,epos;
Integer pos;
list<BackendDAE.Var> v,kn;
Boolean b1,b2;

case ((var as BackendDAE.VAR(varName=cr, bindExp=SOME(e), source = source),(eqns,v,kn,v1,v2,pos)))
equation
false = Expression.isConst(e);
b1 = BackendVariable.isParam(var);
b2 = Expression.isConstValue(e);
// if not parameter use it, else use it only if not constant
true = (not b1) or (b1 and not b2);
cre = Expression.crefExp(cr);
initialEquation = BackendDAE.EQUATION(cre, e, source);
epos = listLength(v1)+1;
var1 = BackendVariable.setVarKind(var,BackendDAE.VARIABLE());
then
((var,(initialEquation :: eqns,var1::v,kn,epos::v1,pos::v2,pos+1)));

((var,(initialEquation :: eqns,var1::v,kn,pos::v1,pos::v2,pos+1)));
case ((var,(eqns,v,kn,v1,v2,pos)))
equation
var1 = BackendVariable.setVarKind(var,BackendDAE.PARAM());
Expand Down

0 comments on commit b3fb8f5

Please sign in to comment.