﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5188	When not triggering in initialization	andreas.heuermann@…	Lennart Ochel	"
Is the following behavior for when equations while initializing desired? When simulating the following model {{{a}}} stays 1, so the when equation is not evaluated.

{{{
model initial_when
  Real x(start=1), dx;
  discrete Real a(start=1);
  Boolean y(start=false);
  Boolean z(start=false);
  Boolean h1(start=false, fixed=true), h2;

equation
  der(x) = dx;
  dx = a*x;
  
  h1 = x>=0;
  h2 = dx>=2;
  
  when h1 then // equivalent to ""if edge(h1) then"" // equivalent to ""if h1 and not pre(h1) then"" 
    y = true;
  end when;
  
  when y then
    a = 2.0;
  end when;
  
  when h2 then
    z = true;
  end when;
  
end initial_when;
}}}

If 
{{{
when h1 then
  y = true;
end when;
}}}
is replaced with
{{{
  if edge(h1) then
    y = true;
  else
    y = pre(y);
  end if;
}}}
{{{y}}} is set to //true// as expected. Of course {{{a}}} is still wrong.
Dymola is returning the same result as OpenModelica in both cases."	discussion	closed	normal	Future	Initialization	v1.13.0-dev-nightly	invalid	when, if edge, initial equation	
