Changeset 13968


Ignore:
Timestamp:
2012-11-19T17:06:05+01:00 (11 years ago)
Author:
jfrenkel
Message:
  • add in case of constant variables every time a parameter bound equation to the simulation code and in case of parameters only if it is not constant
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/BackEnd/SimCodeUtil.mo

    r13927 r13968  
    68246824      DAE.ElementSource source;
    68256825      list<Integer> v1,v2;
    6826       Integer pos,epos;
     6826      Integer pos;
    68276827      list<BackendDAE.Var> v,kn;
     6828      Boolean b1,b2;
    68286829     
    68296830    case ((var as BackendDAE.VAR(varName=cr, bindExp=SOME(e), source = source),(eqns,v,kn,v1,v2,pos)))
    68306831      equation
    6831         false = Expression.isConst(e);
     6832        b1 = BackendVariable.isParam(var);
     6833        b2 = Expression.isConstValue(e);
     6834        // if not parameter use it, else use it only if not constant
     6835        true = (not b1) or (b1 and not b2);
    68326836        cre = Expression.crefExp(cr);
    68336837        initialEquation = BackendDAE.EQUATION(cre, e, source);
    6834         epos = listLength(v1)+1;
    68356838        var1 = BackendVariable.setVarKind(var,BackendDAE.VARIABLE());
    68366839      then
    6837         ((var,(initialEquation :: eqns,var1::v,kn,epos::v1,pos::v2,pos+1)));
    6838        
     6840        ((var,(initialEquation :: eqns,var1::v,kn,pos::v1,pos::v2,pos+1)));       
    68396841    case ((var,(eqns,v,kn,v1,v2,pos)))
    68406842      equation
Note: See TracChangeset for help on using the changeset viewer.