Skip to content

Commit

Permalink
- fix internal generation of discrete cse variables
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24769 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Feb 25, 2015
1 parent d871311 commit 9d43642
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions Compiler/BackEnd/BackendVariable.mo
Expand Up @@ -1616,33 +1616,30 @@ algorithm
NONE(),NONE(),DAE.NON_CONNECTOR(),DAE.NOT_INNER_OUTER());
end createDummyVar;

public function createCSEVar
"Creates a cse variable with the name of inCref."
public function createCSEVar "Creates a cse variable with the name of inCref.
TODO: discrete real varaibales are not treated correctly"
input DAE.ComponentRef inCref;
input DAE.Type varType;
input DAE.Type inType;
output BackendDAE.Var outVar;
algorithm
outVar := match (inCref)
local
DAE.ElementSource source;
list<Absyn.Path> typeLst;
Absyn.Path path;
case (_) guard(ComponentReference.traverseCref(inCref,ComponentReference.crefIsRec,false)) equation
DAE.T_COMPLEX(complexClassType=ClassInf.RECORD(path),source=typeLst) = varType;
source = DAE.SOURCE(Absyn.dummyInfo,{},NONE(),{},path::typeLst,{},{});
outVar = BackendDAE.VAR(inCref, BackendDAE.VARIABLE(), DAE.BIDIR(), DAE.NON_PARALLEL(),
varType, NONE(), NONE(), {}, source,
NONE(), SOME(BackendDAE.AVOID()), NONE(), DAE.NON_CONNECTOR(), DAE.NOT_INNER_OUTER());
then outVar;
case(_) equation
outVar = BackendDAE.VAR(inCref, BackendDAE.VARIABLE(), DAE.BIDIR(), DAE.NON_PARALLEL(),
varType, NONE(), NONE(), {}, DAE.emptyElementSource,
NONE(), SOME(BackendDAE.AVOID()), NONE(), DAE.NON_CONNECTOR(), DAE.NOT_INNER_OUTER());
then outVar;
else
equation
Error.addMessage(Error.INTERNAL_ERROR, {"BackendVariable.createCSEVar failed."});
then fail();
local
DAE.ElementSource source;
list<Absyn.Path> typeLst;
Absyn.Path path;
BackendDAE.VarKind varKind;

case (_) guard(ComponentReference.traverseCref(inCref, ComponentReference.crefIsRec, false)) equation
DAE.T_COMPLEX(complexClassType=ClassInf.RECORD(path), source=typeLst) = inType;
source = DAE.SOURCE(Absyn.dummyInfo, {}, NONE(), {}, path::typeLst, {}, {});
varKind = if Types.isDiscreteType(inType) then BackendDAE.DISCRETE() else BackendDAE.VARIABLE();
outVar = BackendDAE.VAR(inCref, varKind, DAE.BIDIR(), DAE.NON_PARALLEL(), inType, NONE(), NONE(), {}, source, NONE(), SOME(BackendDAE.AVOID()), NONE(), DAE.NON_CONNECTOR(), DAE.NOT_INNER_OUTER());
then outVar;

case (_) equation
varKind = if Types.isDiscreteType(inType) then BackendDAE.DISCRETE() else BackendDAE.VARIABLE();
outVar = BackendDAE.VAR(inCref, varKind, DAE.BIDIR(), DAE.NON_PARALLEL(), inType, NONE(), NONE(), {}, DAE.emptyElementSource, NONE(), SOME(BackendDAE.AVOID()), NONE(), DAE.NON_CONNECTOR(), DAE.NOT_INNER_OUTER());
then outVar;
end match;
end createCSEVar;

Expand Down

0 comments on commit 9d43642

Please sign in to comment.