Skip to content

Commit

Permalink
- check Min, Max, Nominal asserts of constant false
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8199 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Mar 12, 2011
1 parent f668356 commit d02d19c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -873,7 +873,7 @@ algorithm
minmax :=
matchcontinue (attr,name,source)
local
DAE.Exp e,cond;
DAE.Exp e,cond,msg;
list<Option<DAE.Exp>> ominmax;
String str;
DAE.ExpType tp;
Expand All @@ -882,11 +882,13 @@ algorithm
ominmax = DAEUtil.getMinMax(attr);
str = ComponentReference.crefStr(name);
str = stringAppendList({"Variable ",str," out of limit"});
msg = DAE.SCONST(str);
e = Expression.crefExp(name);
tp = Expression.typeof(e);
cond = lowerMinMax1(ominmax,e,tp);
checkAssertCondition(cond,msg);
then
{DAE.ALGORITHM_STMTS({DAE.STMT_ASSERT(cond,DAE.SCONST(str),source)})};
{DAE.ALGORITHM_STMTS({DAE.STMT_ASSERT(cond,msg,source)})};
case(_,_,_) then {};
end matchcontinue;
end lowerMinMax;
Expand Down Expand Up @@ -923,7 +925,7 @@ algorithm
nominal :=
matchcontinue (attr,name,source)
local
DAE.Exp e,cond;
DAE.Exp e,cond,msg;
list<Option<DAE.Exp>> ominmax;
String str;
DAE.ExpType tp;
Expand All @@ -932,10 +934,12 @@ algorithm
ominmax = DAEUtil.getMinMax(attr);
str = ComponentReference.crefStr(name);
str = stringAppendList({"Nominal ",str," out of limit"});
msg = DAE.SCONST(str);
tp = Expression.typeof(e);
cond = lowerMinMax1(ominmax,e,tp);
checkAssertCondition(cond,msg);
then
{DAE.ALGORITHM_STMTS({DAE.STMT_ASSERT(cond,DAE.SCONST(str),source)})};
{DAE.ALGORITHM_STMTS({DAE.STMT_ASSERT(cond,msg,source)})};
case(_,_,_) then {};
end matchcontinue;
end lowerNominal;
Expand Down

0 comments on commit d02d19c

Please sign in to comment.