openmodelicainterest  

Re: Acausal systems modelling and compilation

Francesco Casella
Thu, 17 Dec 2009 09:27:03 -0800

Arquimedes Canedo wrotea scritto:

A fundamental question would be this. Is acausality a concept that
facilitates the high-level abstraction of continuous system
descriptions ? It seems that this is what enables Modelica to have its
elegant semantics. The compiler is doing all necessary arrangements to
transform the mathematical (at the highest level of abstraction)
description of systems into a causal implementation needed by
execution in a computer.
I've been reading about the topic and I found this interesting comparison:
http://www.claytex.com/Products/Dymola/ModellingMethod/tabid/193/Default.aspx
Although they show how the Modelica has a cleaner representation, in
the end, its compiler derives the context and decides between one of
the possible variations in the block-diagram.

If my guess is right, the generated code is most of the time, in
causal form.

In fact, for most Modelica tools, it is always in causal form (state space form). The transformation can be done symbolically in many cases, otherwise you need also some numeric solvers to come into action.

                                        Francesco

On Thu, Dec 17, 2009 at 2:23 AM, Peter Fritzson <pe...@ida.liu.se> wrote:
Dear Arquimedes,
see below.

-----Original Message-----
From: owner-openmodelicainter...@ida.liu.se
[mailto:owner-openmodelicainter...@ida.liu.se] On Behalf Of Arquimedes
Canedo
Sent: den 16 december 2009 05:25
To: OpenModelicaInterest@ida.liu.se
Subject: Acausal systems modelling and compilation

Hello,


I am new to Modelica and the acausal paradigm of system design. I am
familiar with the causal block-diagram notation but it seems that Modelica
is just a different world. I am also learning about the underlying
mathematics of Modelica.

I have several questions about the compilation of acausal systems into
simulation code and I hope this is the right place to ask them.

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.

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 ?.

- This is to generate more efficient code, e.g. many simple blocks in the
BLT form
 can be transformed into assignment statements.

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 ?.

- You are mixing the issues of index reduction and solver.
The index is automatically reduced to 1.
DASSL can handle DAEs, but not high index.


What criteria does openmodelica apply for the selection of DASSL or Euler ?

- OpenMOdelica always uses DASSL. (Some experimental versions used Euler)

I know this is highly dependent on the problem itself, but how often do you
get systems with index >= 2 ? How do you handle them ?, is it possible to
apply index reduction again and again until we reach our target ?

- Most mechanical system models (e.g. from MultiBody) are index 3.


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 ?

- Yes, the compiler is automatically transforming a acausal system into
a partly causal implementation (but subsystems in the BLT having 2 or more
variables,
are still acausal simultaneous systems of equations)


Thank you,

Arquimedes

Best regards,

Peter Fritzson






--
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