Skip to content

Commit

Permalink
Prototype of a new RemoveSimpleEquation module added
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25255 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Bernhard Bachmann committed Mar 25, 2015
1 parent 5e2cdf6 commit 87b3833
Show file tree
Hide file tree
Showing 6 changed files with 3,394 additions and 2 deletions.
39 changes: 39 additions & 0 deletions Compiler/BackEnd/BackendVariable.mo
Expand Up @@ -725,6 +725,18 @@ algorithm
BackendDAE.VAR(values = SOME(DAE.VAR_ATTR_REAL(nominal=SOME(DAE.RCONST(outReal))))) := inVar;
end varNominal;

public function varHasNominalValue "author: BB"
input BackendDAE.Var inVar;
output Boolean outBool;
algorithm
try
BackendDAE.VAR(values = SOME(DAE.VAR_ATTR_REAL(nominal=SOME(DAE.RCONST())))) := inVar;
outBool := true;
else
outBool :=false;
end try;
end varHasNominalValue;

public function varCref "author: PA
extracts the ComponentRef of a variable"
input BackendDAE.Var inVar;
Expand Down Expand Up @@ -924,6 +936,18 @@ algorithm
end match;
end isVarDiscrete;

public function isDiscrete
"This functions checks if BackendDAE.Var is discrete"
input DAE.ComponentRef cr;
input BackendDAE.Variables vars;
output Boolean outBoolean;
protected
BackendDAE.Var v;
algorithm
({v},_) := getVar(cr,vars);
outBoolean := isVarDiscrete(v);
end isDiscrete;

public function isVarNonDiscrete
input BackendDAE.Var inVar;
output Boolean outBoolean;
Expand Down Expand Up @@ -1526,6 +1550,21 @@ algorithm
end matchcontinue;
end isOutputVar;

public function isOutput
input DAE.ComponentRef inCref;
input BackendDAE.Variables inVars;
output Boolean outBool;
algorithm
outBool:=
matchcontinue(inCref, inVars)
case(_, _) equation
((BackendDAE.VAR(varDirection = DAE.OUTPUT()) :: _),_) = getVar(inCref, inVars);
then true;

else false;
end matchcontinue;
end isOutput;

public function isProtectedVar
"author: Frenkel TUD 2013-01
Returns the DAE.Protected attribute."
Expand Down

0 comments on commit 87b3833

Please sign in to comment.