marco-compiler / marco

Modelica Advanced Research COmpiler
GNU Lesser General Public License v3.0
20 stars 5 forks source link

Perform computation of `start` attributes only when their dependencies are satisfied #13

Closed mscuttari closed 8 months ago

mscuttari commented 8 months ago

Let's consider the following model:

model TestStartParameter
   Real p1(start = p_start);
   Real p2;
   parameter Real p_start(fixed = false, start = 1e6);
   parameter Real p0 = 1e6;
equation 
   (p1 - p0)^2 + sin(1e-19*p1) = 1e10;
    p2 = p0*0.99;
initial equation 
    p_start = p2;
end TestStartParameter;

The causalization process for the initialization problem should obtain the following:

The first equation is apparently independent from the other two and may be scheduled before them. However, the start = p_start attribute of p1 induces a dependency between the first and the third equations, requiring the latter to be computed first.

The scheduling process should examine the additional dependencies given by start attributes, and perform such assignments only then all the dependencies are satisfied.

mscuttari commented 8 months ago

Solved with 52f534c