Skip to content

Commit

Permalink
- Remove r12679 / #1787 work-around
Browse files Browse the repository at this point in the history
- Do not add an = 0.0 binding by default to every paramater that lacks a binding


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12686 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Aug 27, 2012
1 parent 07c2bff commit a00b45b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
10 changes: 6 additions & 4 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -45,6 +45,7 @@ public import DAE;
public import Env;

protected import BackendDAEUtil;
protected import BackendDump;
protected import BackendEquation;
protected import BackendVariable;
protected import BaseHashTable;
Expand Down Expand Up @@ -130,7 +131,7 @@ algorithm
outBackendDAE := BackendDAE.DAE(BackendDAE.EQSYSTEM(vars_1,eqnarr,NONE(),NONE(),BackendDAE.NO_MATCHING())::{},BackendDAE.SHARED(knvars,extVars,aliasVars,ieqnarr,reqnarr,constrarra,clsattrsarra,inCache,inEnv,functionTree,einfo,extObjCls,BackendDAE.SIMULATION(),{}));
BackendDAEUtil.checkBackendDAEWithErrorMsg(outBackendDAE);
Debug.fcall(Flags.DUMP_BACKENDDAE_INFO,print,"No. of Equations: " +& intString(BackendDAEUtil.equationSize(eqnarr)) +& "\nNo. of Variables: " +& intString(BackendVariable.varsSize(vars_1)) +& "\n");
Debug.execStat("generate Backend Data Structur",BackendDAE.RT_CLOCK_EXECSTAT_BACKEND_MODULES);
Debug.execStat("generate Backend Data Structure",BackendDAE.RT_CLOCK_EXECSTAT_BACKEND_MODULES);
end lower;

protected function lower2
Expand Down Expand Up @@ -609,7 +610,7 @@ algorithm
absynCommentOption = comment))
equation
kind_1 = lowerKnownVarkind(kind, name, dir, ct);
bind = fixParameterStartBinding(bind,dae_var_attr,kind_1);
// bind = fixParameterStartBinding(bind,t,dae_var_attr,kind_1);
tp = lowerType(t);
b = DAEUtil.boolVarVisibility(protection);
dae_var_attr = DAEUtil.setProtectedAttr(dae_var_attr,b);
Expand Down Expand Up @@ -689,14 +690,15 @@ end setMinMaxFromEnumeration1;

protected function fixParameterStartBinding
input Option<DAE.Exp> bind;
input DAE.Type ty;
input Option<DAE.VariableAttributes> attr;
input BackendDAE.VarKind kind;
output Option<DAE.Exp> outBind;
algorithm
outBind := matchcontinue (bind,attr,kind)
outBind := matchcontinue (bind,ty,attr,kind)
local
DAE.Exp exp;
case (NONE(),_,BackendDAE.PARAM())
case (NONE(),DAE.T_REAL(source=_),_,BackendDAE.PARAM())
equation
exp = DAEUtil.getStartAttr(attr);
then SOME(exp);
Expand Down
17 changes: 0 additions & 17 deletions Compiler/FrontEnd/ExpressionSimplify.mo
Expand Up @@ -516,28 +516,11 @@ protected function simplifyIfExp
algorithm
exp := match (cond,tb,fb)
local
Real r;
Integer i;
Boolean b,b1;
DAE.Exp e;
// Condition is constant
case (DAE.BCONST(true),tb,fb) then tb;
case (DAE.BCONST(false),tb,fb) then fb;
// because ther is somewhere an error (maybe eval return reals instead of bools)
case (DAE.RCONST(r),tb,fb)
equation
b = r ==. 1.0;
b1 = r ==. 0.0;
true = b or b1;
then
Util.if_(b,tb,fb);
case (DAE.ICONST(i),tb,fb)
equation
b = i == 1;
b1 = i == 0;
true = b or b1;
then
Util.if_(b,tb,fb);
// The expression is the condition
case (exp,DAE.BCONST(true),DAE.BCONST(false)) then exp;
case (exp,DAE.BCONST(false),DAE.BCONST(true))
Expand Down

0 comments on commit a00b45b

Please sign in to comment.