openmodelicainterest  

Re: Acausal systems modelling and compilation

Francesco Casella
Thu, 17 Dec 2009 09:26:57 -0800

Hi Arquimedes,

Somewhere else I read that index reduction is considered a symbolic
manipulation of DAEs and therefore, this transformation, may affect
the original semantics and behaviour of the original system.

I've heard some people saying this but, honestly, I can't see how the semantics would be affected.

The solution of an initial value problem for a higher index DAE and for the same DAE brought to index 1 with Pantelides / Dummy Derivatives is exactly the same.
Finally, to extend the point of acausality in Modelica, you mentioned
that the system remains acausal if there are algebraic loops. What
options do we have for handling algebraic loops ? More algebraic
transformations, or is there a way to iteratively approximate its
solution ?

If the implicit algebraic equations have a unique solution in closed form, a symbolic manipulator could solve them symbolically and replace them with their closed-form solution. Otherwise, you typically use numerical, Newton-like solvers, which require to know the residuals of the implicit equations, and possibly their Jacobian w.r.t. the unknowns.

Best

                                Francesco


Thanks,

Arquimedes


On Thu, Dec 17, 2009 at 1:24 AM, Francesco Casella
<case...@elet.polimi.it> wrote:
Hi Arquimedes,

I have read the Open Modelica Compiler Phases document and it gives a
very good high-level perspective on how the omc works. I have also
read some of the related papers on the omc compiler and this is where
things start getting fuzzy.
I'd suggest you to also read the books by Tiller and by Fritzson about
Modelica :)

While I can see the benefit of ordering the dependency matrix in BLT
form for reducing the reaching definitions of variables for
parallelization, I don't fully understand why this step is necessary
for generating uniprocessor code. Is it to reduce the complexity of
the matrix manipulation algorithms ? How does the BLT form affect the
quality of the generated code, in the case of uniprocessor ?.
Even with a single thread, in general it is obviously easier to solve N
smaller systems than one, single, bigger system.

Concerning the numerical solver selection, I have seen the ongoing
discussion about DAEs with index > 1. It seems that DAEs are passed to
the index reduction and if the resulting system has an index == 1 then
we can easily solve with fixed-step ODE solvers, Runge-Kutta methods
for example. However, if the index > 1, are we forced to use DASSL ?.
No, if the system has index > 1, symbolic index reduction is applied to
reduce it to index = 1, no matter what solver is later used. BTW, DASSL
cannot handle index>1 DAEs.

What criteria does openmodelica apply for the selection of DASSL or
Euler ?
DASSL is a high-order, variable step size BDF solver, with support for event
handling. Euler is a simple one-step, first order solver, usually employed
at fixed time step for real-time simulation.

An excellent source to know more about this is the book by Petzold and
Ascher "Computer Methods for ordinary differential equations and
differential-algebraic equations.

Note that OMC conceptually brings the DAE into ODE form before linking to a
solver, so even if DASSL is used, it is used as an ode solver.

I know this is highly dependent on the problem itself, but how often
do you get systems with index >= 2 ?
In mechanical systems, every time you make a rigid connection, you get index
= 3.

In electrical circuit, you get index=2 whenever connect condensers in
parallel, or inductors in series.

How do you handle them ?
Pantelides' algorithm + dummy derivative algorithm.

, is it
possible to apply index reduction again and again until we reach our
target ?
Yes, if OMC can differentiate the constraint equations enough times.

Finally, I would like to ask about the meaning of 'acausality' inside
a Modelica compiler, openmodelica in this case. After deciding the
ordering of equations based on their data dependencies and scheduling
them, aren't we transforming the 'acausal' system into a 'causal' one
No, if there are algebraic loops (i.e. implicit algebraic equations) in the
model.

Hope this helps

                               Francesco

--
Francesco Casella - Ph.D.
Dipartimento di Elettronica e Informazione
Politecnico di Milano
Via Ponzio 34/5
I-20133 MILANO - ITALY

Tel:    +39-02-2399-3465 (Leonardo)
       +39-02-2399-7749 (Polo di Cremona)
Fax:    +39-02-2399-3412
e-mail: case...@elet.polimi.it
web:    http://home.dei.polimi.it/casella
Skype:  callto://francesco.casella





--
Francesco Casella - Ph.D.
Dipartimento di Elettronica e Informazione
Politecnico di Milano
Via Ponzio 34/5
I-20133 MILANO - ITALY

Tel:    +39-02-2399-3465 (Leonardo)
        +39-02-2399-7749 (Polo di Cremona)
Fax:    +39-02-2399-3412
e-mail: case...@elet.polimi.it
web:    http://home.dei.polimi.it/casella
Skype:  callto://francesco.casella