openmodelicainterest  

Re: [*****SPAM*****] Re: Acausal systems modelling and compilation

Rafael de Pelegrini Soares
Sat, 19 Dec 2009 05:01:47 -0800

Dear Francesco,

On Fri, Dec 18, 2009 at 7:58 PM, Francesco Casella
<case...@elet.polimi.it> wrote:
> Dear Rafael,
>
>> In a numerical sense, the solution of a index-reduced problem is not
>> the same of the original high-index problem.
>
> I was referring to the exact solution.

Agreed, the exact solution will be the same.

>> This is because the
>> reduced index problem accepts more solutions than the original one
>> (algebraic constraints are replaced by differential equations). This
>> is known as the "drift-off" effect.
>
> I'm sorry, but I don't agree with this. It depends how you build the
> reduced-index problem. If you use the dummy derivative algorithm
> (http://portal.acm.org/citation.cfm?id=153121) there will be no drift-off at
> all.
>
> Let's take a simple example
>
> der(x1) = 1 + y
> der(x2) = -y
> x1 = x2
>
> this is an index 2 problem. If you apply the dummy derivatives algorithm,
> you differentiate the third equation, *but you also keep the original one*.
> In order to avoid an overdetermined system, you then demote one of the state
> variables in the differentiated state to algebraic variable (e.g. x2), and
> introduce one extra algebraic variable (the dummy derivative) in place of
> the derivative of this ex-state (e.g., der_x2 instead of der(x2)).
>
> As a result, you get this first-order, index-1 DAE:
>
> der(x1) = 1 + y
> der_x2 = -y
> x1 = x2
> der(x1) = der_x2
>
> which has only one state variable x1. These equations can be solved for
> der(x1), der_x2, y, x2, giving
>
> der(x1) = 1/2
> y = -1/2
> der_x2 = 1/2
> x2 = x1
>
> The first equation can be integrated giving x1 = x1(0) + 1/2*time (or, you
> can integrate it numerically), and there is of course no drift here, since
> x2 is always computed to be equal to x1 at each time step.

Yes, this is a simple problem. I've never implemented an automatic
solution by the dummy derivatives method, but the problem I see with
it is that for more complicated systems you will need to dynamically
(during solution) switch between states.This is because the problem
can become singular for some particular values of the variables, more
details at "Mattsson, Sven Erik, Olsson, H. and Elmqvist, Hilding,
Dynamic Selection of States in Dymola, in: Modelica Workshop, pages
61-67, 2000." I think this is a complicated procedure to implement
automatically. Although possible: the authors mention an
implementation in Dymola.

>> Please check "Hairer, E. and
>>
>> Wanner, G., Solving Ordinary Differential Equations II. Stiff and
>> Differential-Algebraic Problems, Springer-Verlag, 1996." for more
>> details on that effect.
>
> I don't have access to this book, but they are probably using a different
> method, I guess.

Indeed, I meant the solution by the direct replacement of constraints
by its differential version. The reference you mentioned before
(http://portal.acm.org/citation.cfm?id=153121) also visits the
"drift-off" topic.

Regards.

-- Rafael

>
> Best
>
>                                Francesco
>
>>
>> Just my 2 cents.
>>
>> 2009/12/17 Arquimedes Canedo <can...@gmail.com>:
>>>
>>> Francesco,
>>>
>>>
>>> Thanks for the insightful answers.
>>>
>>>
>>>> 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.
>>>
>>> This is good news. The only place where we could have numerical error
>>> is then the numerical solver itself.
>>>
>>>> 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.
>>>
>>> This sounds familiar, at least that is what Scicos/Simulink try to
>>> handle the algebraic loops.
>>> I guess this is all explained in detail in the books you have
>>> recommended before. I'll try to get my hands on them soon.
>>>
>>>
>>> Thanks,
>>>
>>> Arquimedes
>>>
>>
>>
>>
>
>
> --
> 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
>



-- 
Prof. Rafael de Pelegrini Soares, D.Sc
Chemical Engineering Department - UFRGS
raf...@enq.ufrgs.br, rafael....@gmail.com
office: +55 51 3308 3528