Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niklwors committed Aug 18, 2015
2 parents f79d963 + 32ed7bf commit 1654145
Show file tree
Hide file tree
Showing 50 changed files with 1,964 additions and 2,418 deletions.
87 changes: 38 additions & 49 deletions Compiler/BackEnd/BackendDAE.mo
Expand Up @@ -383,14 +383,47 @@ end Equation;

public
uniontype WhenEquation
record WHEN_EQ "equation when condition then left = right; [elsewhenPart] end when;"
.DAE.Exp condition "the when-condition";
.DAE.ComponentRef left "left hand side of equation";
.DAE.Exp right "right hand side of equation";
record WHEN_STMTS "equation when condition then cr = exp, reinit(...), terminate(...) or assert(...)"
.DAE.Exp condition "the when-condition" ;
list<WhenOperator> whenStmtLst;
Option<WhenEquation> elsewhenPart "elsewhen equation with the same cref on the left hand side.";
end WHEN_EQ;
end WHEN_STMTS;
end WhenEquation;

public
uniontype WhenOperator
record ASSIGN " left_cr = right_exp"
.DAE.ComponentRef left "left hand side of equation";
.DAE.Exp right "right hand side of equation";
.DAE.ElementSource source "origin of equation";
end ASSIGN;

record REINIT "Reinit Statement"
.DAE.ComponentRef stateVar "State variable to reinit";
.DAE.Exp value "Value after reinit";
.DAE.ElementSource source "origin of equation";
end REINIT;

record ASSERT
.DAE.Exp condition;
.DAE.Exp message;
.DAE.Exp level;
.DAE.ElementSource source "the origin of the component/equation/algorithm";
end ASSERT;

record TERMINATE "The Modelica built-in terminate(msg)"
.DAE.Exp message;
.DAE.ElementSource source "the origin of the component/equation/algorithm";
end TERMINATE;

record NORETCALL "call with no return value, i.e. no equation.
Typically side effect call of external function but also
Connections.* i.e. Connections.root(...) functions."
.DAE.Exp exp;
.DAE.ElementSource source "the origin of the component/equation/algorithm";
end NORETCALL;
end WhenOperator;

public
type ExternalObjectClasses = list<ExternalObjectClass>
"classes of external objects stored in list";
Expand Down Expand Up @@ -540,62 +573,18 @@ public
uniontype EventInfo
record EVENT_INFO
list<TimeEvent> timeEvents "stores all information related to time events";
list<WhenClause> whenClauseLst "list of when clauses. The WhenEquation data type refer to this list by position";
list<ZeroCrossing> zeroCrossingLst "list of zero crossing conditions";
list<ZeroCrossing> sampleLst "[deprecated] list of sample as before, only used by cpp runtime (TODO: REMOVE ME)";
list<ZeroCrossing> relationsLst "list of zero crossing function as before";
Integer numberMathEvents "stores the number of math function that trigger events e.g. floor, ceil, integer, ...";
end EVENT_INFO;
end EventInfo;

public
uniontype WhenOperator
record REINIT "Reinit Statement"
.DAE.ComponentRef stateVar "State variable to reinit";
.DAE.Exp value "Value after reinit";
.DAE.ElementSource source "origin of equation";
end REINIT;

record ASSERT
.DAE.Exp condition;
.DAE.Exp message;
.DAE.Exp level;
.DAE.ElementSource source "the origin of the component/equation/algorithm";
end ASSERT;

record TERMINATE "The Modelica built-in terminate(msg)"
.DAE.Exp message;
.DAE.ElementSource source "the origin of the component/equation/algorithm";
end TERMINATE;

record NORETCALL "call with no return value, i.e. no equation.
Typically side effect call of external function but also
Connections.* i.e. Connections.root(...) functions."
.DAE.Exp exp;
.DAE.ElementSource source "the origin of the component/equation/algorithm";
end NORETCALL;
end WhenOperator;

public
uniontype WhenClause
record WHEN_CLAUSE
.DAE.Exp condition "the when-condition";
list<WhenOperator> reinitStmtLst "list of reinit statements associated to the when clause.";
Option<Integer> elseClause "index of elsewhen clause";

// HL only needs to know if it is an elsewhen the equations take care of which clauses are related.

// The equations associated to the clause are linked to this when clause by the index in the
// when clause list where this when clause is stored.
end WHEN_CLAUSE;
end WhenClause;

public
uniontype ZeroCrossing
record ZERO_CROSSING
.DAE.Exp relation_ "function";
list<Integer> occurEquLst "list of equations where the function occurs";
list<Integer> occurWhenLst "list of when clauses where the function occurs";
end ZERO_CROSSING;
end ZeroCrossing;

Expand Down

0 comments on commit 1654145

Please sign in to comment.