openmodelicainterest  

RE: Acausal systems modelling and compilation

Peter Fritzson
Wed, 16 Dec 2009 09:48:19 -0800

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