Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: Oct 10, 2009

The Differential-Algebraic Equation (DAE) Solver

1 ratings | 5.00 out of 5
Print

Overview

The DAE solver solves differential algebraic equations with initial conditions of the following form: f(t,y,y')=0. Most DAE problems with initial conditions, stiff or non-stiff, index-1 or higher index up to 3, could be solved by using the DAE solver.

What is DAE?

Differential-Algebraic Equation (DAE) is a kind of differential equation in the fully implicit form:

                                                    (1)

Where y=(x,z)T. x are the differential variables and z are the algebraic variables.

DAE is different from Ordinary Differential Equation (ODE). Most DAE problems could be regarded as a combination of ODE and constraints. ODE is a special subset of DAE.

ODE:          

DAE:           

For example, a simple pendulum is a typical DAE problem and could be written in the DAE form.

Figure 1. Simple pendulum

                                                            (2)

As shown in Figure 1, l is the length of the massless rod. m is the mass of the bob and g is the acceleration of gravity, which is approximately 9.8 N/kg approximately. x,y are the coordinates of the bob. Vx, Vy are the velocities of the (x,y) coordinate components, and V'x, V'y are the accelerations.  is a Lagrange multiplier that represents the effect by the constraint. The equation (*) represents the constraint between the bob's coordinates and the length of the rod.

DAE is widely used in real-life applications and plays a prominent role in engineering, physics, and mathematics. DAE is especially useful in multi-body mechanics, circuit design, and simulation.

The DAE solver

The solver solves the general form of differential equations with an initial value (t0 ,y(0) , y'(0)):

                                                                                  (3)

Where  

 

 .

Most differential equations in application use this form or can easily be converted to this form by moving the right side of the equation to the left side.

Radau IIA, a collocation method of the Runge-Kutta family, which has 3 stages per step and a precision order of 5, is utilized. To get solution (t,y,y') at tout from the initial value, time [t0 , tout] is separated into many steps: t0 , t1 , t2 , ..., tout , where t1=t0+h1 , t2=t0+h1+h2 , ... , tout . hk is the k-th step size which is controlled by the solver such that the error satisfies the specified tolerance.

The DAE solver solves the equation (3) step by step. As mentioned before, each step is separated into different stages, as shown in Figure 2.

Figure 2. Solver strategy

Most DAE problems with initial conditions, stiff or non-stiff, index-1 or higher index up to 3, could be solved by using the DAE solver.

How to use this solver

To illustrate how to use this solver, take the previous simple pendulum problem as an example.

Define your problem and write user-defined function

You can easily convert the equations shown in (2) into the implicit form f(t,y,y')=0:

                
After the reformulation above, you could write your own VI for this problem.

New from template Res function(user).vit and fill in your own code as Figure 3.

Figure 3. Simple pendulum user-defined function

Initial value

Consistent initial value (t0 ,y(0) , y'(0))  should be provided to satisfy f(t,y,y')=0.

In the simple pendulum problem, the consistent initial condition is:

Notice that y'4 doesn’t appear in equation (4). In this case, you can give this differentiate variable a zero initial value.

Call DAE solver

After you finish the user-defined VI and determine what the initial condition (t0 ,y(0) , y'(0)) is, set up the simulation parameters according to the context help. Then call the DAE solver as shown in Figure 4.

Figure 4. Call the DAE solver

Show the results

Use the front panel to show the results by using different types of graph indicators. You also can create an animation to show the motion of your model.

The result of the simple pendulum is shown in Figure 5. 

Figure 5. Simple Pendulum result

Another simulation example is the multibody system called Andrews’ squeezer mechanism[1]. This simulation example was first promoted by Giles[2] and Manning[3], and later became a well-known test example for numerical DAE solvers. This example consists of 7 rigid bodies and a massless spring connected by frictionless joints, represented by white dots. A, B, C and O are fixed points, as shown in Figure 6. The motor at point O drives the system in plane motion. The math model of this system is a typical DAE because it contains not only differential equations to describe movements, but also algebraic equations to describe the constraints between joints.

Figure 6. Result of “Andrews’ squeezer mechanism”[1]

Conclusion

This application note introduces the LabVIEW DAE solver and how to solve the general form of differential equations.

Contact

Please contact dsp.nish@ni.com if you have questions about this article or would like to get the source code of this DAE solver.

Reference

[1] E.Hairer, G.Wanner, Solving Ordinary Differential Equations II, Springer-Verlag, 1996, P 530-536.

[2] D.R.A. Giles, A comparison of three problem-oriented simulation programs of dynamic mechanical systems. 1978. Thesis, Univ. Waterloo, Ontario.

[3] D.W. Manning, A computer technique for simulating dynamic multibody systems based on dynamic formalism. 1981. Thesis, Univ. Waterloo, Ontario.

Requirements


Filename: dae_video.zip

Software Requirements


Language(s): LabVIEW

 
1 ratings | 5.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).