@@ -174,87 +174,52 @@ algorithm
174174 BackendDAE . Var var ;
175175 DAE . CallAttributes attr;
176176 Boolean negate;
177+ String idn;
177178
178179 case (DAE . CALL (path= Absyn . IDENT (name= "der" ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}), (globalKnownVars, aliasvars, _)) equation
179180 (var , _) = BackendVariable . getVarSingle(cr, globalKnownVars);
180181 false = BackendVariable . isVarOnTopLevelAndInput(var );
181182 (zero, _) = Expression . makeZeroExpression(Expression . arrayDimension(tp));
182183 then (zero, (globalKnownVars, aliasvars, true ));
183184
184- case (DAE . CALL (path= Absyn . IDENT (name= "pre" ), expLst= {e as DAE . CREF (componentRef= cr)}), (globalKnownVars, aliasvars, _)) equation
185+ case (DAE . CALL (path= Absyn . IDENT (name= idn ), expLst= {e as DAE . CREF (componentRef= cr)}), (globalKnownVars, aliasvars, _)) guard idn == "pre" or idn == "previous" equation
185186 (_, _) = BackendVariable . getVarSingle(cr, globalKnownVars);
186187 then(e, (globalKnownVars, aliasvars, true ));
187188
188- case (DAE . CALL (path= Absyn . IDENT (name= "previous" ), expLst= {e as DAE . CREF (componentRef= cr)}), (globalKnownVars, aliasvars, _)) equation
189- (_, _) = BackendVariable . getVarSingle(cr, globalKnownVars);
190- then(e, (globalKnownVars, aliasvars, true ));
191-
192- case (DAE . CALL (path= Absyn . IDENT (name= "pre" ), expLst= {e as DAE . CREF (componentRef= DAE . CREF_IDENT (ident= "time" ))}), (globalKnownVars, aliasvars, _))
193- then (e, (globalKnownVars, aliasvars, true ));
194-
195- case (DAE . CALL (path= Absyn . IDENT (name= "previous" ), expLst= {e as DAE . CREF (componentRef= DAE . CREF_IDENT (ident= "time" ))}), (globalKnownVars, aliasvars, _))
196- then (e, (globalKnownVars, aliasvars, true ));
197-
198- case (DAE . CALL (path= Absyn . IDENT (name= "pre" ), expLst= {e as DAE . UNARY (DAE . UMINUS (_), DAE . CREF (componentRef= DAE . CREF_IDENT (ident= "time" )))}), (globalKnownVars, aliasvars, _))
189+ case (DAE . CALL (path= Absyn . IDENT (name= idn), expLst= {e as DAE . CREF (componentRef= DAE . CREF_IDENT (ident= "time" ))}), (globalKnownVars, aliasvars, _)) guard idn== "pre" or idn== "previous"
199190 then (e, (globalKnownVars, aliasvars, true ));
200191
201- case (DAE . CALL (path= Absyn . IDENT (name= "previous" ), expLst= {e as DAE . UNARY (DAE . UMINUS (_), DAE . CREF (componentRef= DAE . CREF_IDENT (ident= "time" )))}), (globalKnownVars, aliasvars, _))
202- then (e, (globalKnownVars, aliasvars, true ));
203-
204- case (DAE . CALL (path= Absyn . IDENT (name= "pre" ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}, attr= attr), (globalKnownVars, aliasvars, _)) equation
205- (var , _) = BackendVariable . getVarSingle(cr, aliasvars);
206- (cr, negate) = BackendVariable . getAlias(var );
207- e = DAE . CREF (cr, tp);
208- e = if negate then Expression . negate(e) else e;
209- (e, _) = ExpressionSimplify . simplify(DAE . CALL (Absyn . IDENT ("pre" ), {e}, attr));
210- (e, _) = Expression . traverseExpBottomUp(e, traverserExpsimplifyTimeIndepFuncCalls, (globalKnownVars, aliasvars, false ));
192+ case (DAE . CALL (path= Absyn . IDENT (name= idn), expLst= {e as DAE . UNARY (DAE . UMINUS (_), DAE . CREF (componentRef= DAE . CREF_IDENT (ident= "time" )))}), (globalKnownVars, aliasvars, _)) guard idn== "pre" or idn== "previous"
211193 then (e, (globalKnownVars, aliasvars, true ));
212194
213- case (DAE . CALL (path= Absyn . IDENT (name= "previous" ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}, attr= attr), (globalKnownVars, aliasvars, _)) equation
195+ case (DAE . CALL (path= Absyn . IDENT (name= idn ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}, attr= attr), (globalKnownVars, aliasvars, _)) guard idn == "pre" or idn == "previous" equation
214196 (var , _) = BackendVariable . getVarSingle(cr, aliasvars);
215197 (cr, negate) = BackendVariable . getAlias(var );
216198 e = DAE . CREF (cr, tp);
217199 e = if negate then Expression . negate(e) else e;
218- (e, _) = ExpressionSimplify . simplify(DAE . CALL (Absyn . IDENT ("previous" ), {e}, attr));
200+ (e, _) = ExpressionSimplify . simplify(DAE . CALL (Absyn . IDENT (idn ), {e}, attr));
219201 (e, _) = Expression . traverseExpBottomUp(e, traverserExpsimplifyTimeIndepFuncCalls, (globalKnownVars, aliasvars, false ));
220202 then (e, (globalKnownVars, aliasvars, true ));
221203
222- case (DAE . CALL (path= Absyn . IDENT (name= "change" ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}), (globalKnownVars, aliasvars, _)) equation
204+ case (DAE . CALL (path= Absyn . IDENT (name= idn ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}), (globalKnownVars, aliasvars, _)) guard idn == "change" or idn == "edge" equation
223205 (_::_, _) = BackendVariable . getVar(cr, globalKnownVars);
224206 zero = Expression . arrayFill(Expression . arrayDimension(tp), DAE . BCONST (false ));
225207 then (zero, (globalKnownVars, aliasvars, true ));
226208
227- case (DAE . CALL (path= Absyn . IDENT (name= "change" ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}), (globalKnownVars, aliasvars, _)) equation
209+ case (DAE . CALL (path= Absyn . IDENT (name= idn ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}), (globalKnownVars, aliasvars, _)) guard idn == "change" or idn == "edge" equation
228210 (_::_, _) = BackendVariable . getVar(cr, aliasvars);
229211 zero = Expression . arrayFill(Expression . arrayDimension(tp), DAE . BCONST (false ));
230212 then (zero, (globalKnownVars, aliasvars, true ));
231213
232- case (DAE . CALL (path= Absyn . IDENT (name= "change" ), expLst= {DAE . CREF (componentRef= DAE . CREF_IDENT (ident= "time" ))}), (globalKnownVars, aliasvars, _))
233- then (DAE . BCONST (false ), (globalKnownVars, aliasvars, true ));
234-
235- case (DAE . CALL (path= Absyn . IDENT (name= "change" ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}, attr= attr), (globalKnownVars, aliasvars, _)) equation
236- (var , _) = BackendVariable . getVarSingle(cr, aliasvars);
237- (cr, negate) = BackendVariable . getAlias(var );
238- e = DAE . CREF (cr, tp);
239- e = if negate then Expression . negate(e) else e;
240- (e, _) = ExpressionSimplify . simplify(DAE . CALL (Absyn . IDENT ("change" ), {e}, attr));
241- (e, _) = Expression . traverseExpBottomUp(e, traverserExpsimplifyTimeIndepFuncCalls, (globalKnownVars, aliasvars, false ));
242- then (e, (globalKnownVars, aliasvars, true ));
243-
244- case (DAE . CALL (path= Absyn . IDENT (name= "edge" ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}), (globalKnownVars, aliasvars, _)) equation
245- (_, _) = BackendVariable . getVarSingle(cr, globalKnownVars);
246- zero = Expression . arrayFill(Expression . arrayDimension(tp), DAE . BCONST (false ));
247- then (zero, (globalKnownVars, aliasvars, true ));
248-
249- case (DAE . CALL (path= Absyn . IDENT (name= "edge" ), expLst= {DAE . CREF (componentRef= DAE . CREF_IDENT (ident= "time" ))}), (globalKnownVars, aliasvars, _))
214+ case (DAE . CALL (path= Absyn . IDENT (name= idn), expLst= {DAE . CREF (componentRef= DAE . CREF_IDENT (ident= "time" ))}), (globalKnownVars, aliasvars, _)) guard idn== "change" or idn== "edge"
250215 then (DAE . BCONST (false ), (globalKnownVars, aliasvars, true ));
251216
252- case (DAE . CALL (path= Absyn . IDENT (name= "edge" ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}, attr= attr), (globalKnownVars, aliasvars, _)) equation
217+ case (DAE . CALL (path= Absyn . IDENT (name= idn ), expLst= {DAE . CREF (componentRef= cr, ty= tp)}, attr= attr), (globalKnownVars, aliasvars, _)) guard idn == "change" or idn == "edge" equation
253218 (var , _) = BackendVariable . getVarSingle(cr, aliasvars);
254219 (cr, negate) = BackendVariable . getAlias(var );
255220 e = DAE . CREF (cr, tp);
256221 e = if negate then Expression . negate(e) else e;
257- (e, _) = ExpressionSimplify . simplify(DAE . CALL (Absyn . IDENT ("edge" ), {e}, attr));
222+ (e, _) = ExpressionSimplify . simplify(DAE . CALL (Absyn . IDENT (idn ), {e}, attr));
258223 (e, _) = Expression . traverseExpBottomUp(e, traverserExpsimplifyTimeIndepFuncCalls, (globalKnownVars, aliasvars, false ));
259224 then (e, (globalKnownVars, aliasvars, true ));
260225
0 commit comments