Skip to content

Commit 824f98b

Browse files
author
Jens Frenkel
committed
- BackendEquation.traverseBackendDAEExpsEqnOutEqn: special case for it initial() then ... else ... end if; only else branch needs to be checked
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14424 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 1fde75c commit 824f98b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Compiler/BackEnd/BackendEquation.mo

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ algorithm
978978
list<Integer> dimSize;
979979
DAE.Algorithm alg;
980980
list<list<BackendDAE.Equation>> eqnstrue;
981-
list<BackendDAE.Equation> eqnsfalse;
981+
list<BackendDAE.Equation> eqns,eqnsfalse,eqnsfalse1;
982982
Boolean diffed;
983983
case (BackendDAE.EQUATION(exp = e1,scalar = e2,source=source,differentiated=diffed),_,_)
984984
equation
@@ -1039,9 +1039,19 @@ algorithm
10391039
bres = Util.boolOrList({b1,b2});
10401040
then
10411041
(BackendDAE.COMPLEX_EQUATION(size,e_1,e_2,source,diffed),bres,ext_arg_2);
1042+
1043+
// special case for it initial() then ... else ... end if; only else branch needs to be checked
1044+
case (BackendDAE.IF_EQUATION(conditions={e1 as DAE.CALL(path=Absyn.IDENT("initial"))},eqnstrue={eqns},eqnsfalse=eqnsfalse,source=source),_,_)
1045+
equation
1046+
(eqnsfalse,eqnsfalse1,ext_arg_2) = traverseBackendDAEExpsEqnListOutEqn(eqnsfalse,{},func,inTypeA);
1047+
bres = List.isNotEmpty(eqnsfalse1);
1048+
eqnsfalse1 = Util.if_(bres,eqnsfalse1,eqnsfalse);
1049+
then
1050+
(BackendDAE.IF_EQUATION({e1},{eqns},eqnsfalse1,source),bres,ext_arg_2);
1051+
10421052
case (BackendDAE.IF_EQUATION(conditions = expl, eqnstrue = eqnstrue, eqnsfalse = eqnsfalse,source=source),_,_)
10431053
equation
1044-
print("not implemented error - BackendDAE.IF_EQUATION - BackendEquation.traverseBackendDAEExpsEqnWithStop\n");
1054+
print("not implemented error - BackendDAE.IF_EQUATION - BackendEquation.traverseBackendDAEExpsEqnOutEqn\n");
10451055
//(expl,ext_arg_1) = traverseBackendDAEExpList(expl,func,inTypeA);
10461056
//(eqnslst,ext_arg_2) = List.map1Fold(eqnslst,traverseBackendDAEExpsEqnList,func,ext_arg_1);
10471057
//(eqnsfalse,ext_arg_2) = traverseBackendDAEExpsEqnListOutEqn(eqnsfalse,func,ext_arg_2);

0 commit comments

Comments
 (0)