From: Ben Spivey on
I need to convert an ODE model in Simulink to a DAE model to address stiffness issues; however, I have found no instructions on how to create a DAE model with mass-matrices using Level-1 Simulink code.

In Matlab, the mass matrix is defined in 'options' and added to the ode call; however, there is no ode call in the Simulink Level-1 s-function. I checked 'configuration parameters' since it has some options for the ode call, but I didn't see a place to add a mass matrix.

My model would be very complicated and not very clean to convert into function blocks rather than Simulink, and I chose Level-1 initially because it is the currently recommended version of the s-functions.

Has anyone else run into this issue?

Ben
From: James Allison on
Algebraic constraints in a DAE show up as algebraic loops in Simulink.
Simulink does not solve DAEs directly, but uses an equation solver at
each time step to solve any algebraic loops (algebraic constraints).
Sometimes this nested solution approach can result in a slow simulation,
but if the alternative is including fast dynamics that break the
algebraic loop, the resulting stiff ODE may be much slower to simulate
in Simulink than the non-stiff DAE.

If you can put your DAE in the form required by MATLAB, you should be
able to create a graphical representation of your system Simulink. It
may require some algebraic manipulation first if your matrix is
something other than ones on the diagonal for the differential
equations, and zeros everywhere else. The algebraic loop solver is
normally successful at solving algebraic constraints as long as the DAE
index is not greater than one, and there are no discontinuities in the
algebraic loops.

-James

Ben Spivey wrote:
> I need to convert an ODE model in Simulink to a DAE model to address
> stiffness issues; however, I have found no instructions on how to create
> a DAE model with mass-matrices using Level-1 Simulink code.
>
> In Matlab, the mass matrix is defined in 'options' and added to the ode
> call; however, there is no ode call in the Simulink Level-1 s-function.
> I checked 'configuration parameters' since it has some options for the
> ode call, but I didn't see a place to add a mass matrix.
>
> My model would be very complicated and not very clean to convert into
> function blocks rather than Simulink, and I chose Level-1 initially
> because it is the currently recommended version of the s-functions.
>
> Has anyone else run into this issue?
>
> Ben
From: Ben Spivey on
Thank you for your comments. I have used nested approaches before but haven't tried it with this model yet. I figured that mass matrices could be used, but it gives some resolution knowing that this is not an option with level-1 s-functions. I may compare the stiff solution with ode15s to a nested solution.

Ben


James Allison <james.allison(a)mathworks.com> wrote in message <i17gal$hk3$1(a)fred.mathworks.com>...
> Algebraic constraints in a DAE show up as algebraic loops in Simulink.
> Simulink does not solve DAEs directly, but uses an equation solver at
> each time step to solve any algebraic loops (algebraic constraints).
> Sometimes this nested solution approach can result in a slow simulation,
> but if the alternative is including fast dynamics that break the
> algebraic loop, the resulting stiff ODE may be much slower to simulate
> in Simulink than the non-stiff DAE.
>
> If you can put your DAE in the form required by MATLAB, you should be
> able to create a graphical representation of your system Simulink. It
> may require some algebraic manipulation first if your matrix is
> something other than ones on the diagonal for the differential
> equations, and zeros everywhere else. The algebraic loop solver is
> normally successful at solving algebraic constraints as long as the DAE
> index is not greater than one, and there are no discontinuities in the
> algebraic loops.
>
> -James
>
> Ben Spivey wrote:
> > I need to convert an ODE model in Simulink to a DAE model to address
> > stiffness issues; however, I have found no instructions on how to create
> > a DAE model with mass-matrices using Level-1 Simulink code.
> >
> > In Matlab, the mass matrix is defined in 'options' and added to the ode
> > call; however, there is no ode call in the Simulink Level-1 s-function.
> > I checked 'configuration parameters' since it has some options for the
> > ode call, but I didn't see a place to add a mass matrix.
> >
> > My model would be very complicated and not very clean to convert into
> > function blocks rather than Simulink, and I chose Level-1 initially
> > because it is the currently recommended version of the s-functions.
> >
> > Has anyone else run into this issue?
> >
> > Ben