Back to index

kdeartwork  4.3.2
Public Member Functions | Protected Member Functions | Private Attributes
EulerOdeSolver Class Reference

ODE solver for the Euler equations. More...

#include <rotation.h>

Inheritance diagram for EulerOdeSolver:
Inheritance graph
[legend]
Collaboration diagram for EulerOdeSolver:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 EulerOdeSolver (const double &t, const double &dt, const double &A, const double &B, const double &C, Vector12d &y, const double &eps)
 Constructor for the ODE solver for the Euler equations.
void integrate (const double &dx)
 Integrates the ordinary differential equation from the current x value to x+dx.
const double & X (void) const
 Get current x value.
void X (const double &a)
 Set current x value.
const Matrix< double, D, 1 > & Y (void) const
 Get current y value.
void Y (const Matrix< double, D, 1 > &a)
 Set current y values.
const Matrix< double, D, 1 > & dYdX (void) const
 Get current dy/dx value.
const double & dX (void) const
 Get current estimated step size dX.
void dX (const double &a)
 Set estimated step size dX.
const double & Eps (void) const
 Get current presision.
void Eps (const double &a)
 Set estimated presision.

Protected Member Functions

Vector12d f (const double &x, const Vector12d &y) const
 ODE function for the Euler equation system.
virtual Matrix< double, D, 1 > f (const double &x, const Matrix< double, D, 1 > &y) const =0
 ODE function.

Private Attributes

double m_A
 Moments of inertia along the three figure axes.
double m_B
double m_C

Detailed Description

ODE solver for the Euler equations.

Class implements RkOdeSolver<double> to solve the Euler equations of motion tor the rotating object.

Definition at line 58 of file rotation.h.


Constructor & Destructor Documentation

EulerOdeSolver::EulerOdeSolver ( const double &  t,
const double &  dt,
const double &  A,
const double &  B,
const double &  C,
Vector12d y,
const double &  eps 
)

Constructor for the ODE solver for the Euler equations.

Parameters:
tTime in seconds, integration variable
dtInitial time increment in seconds for integration, auto adjusted later to guarantee precision
AMoment of inertia along 1. figure axis
BMoment of inertia along 2. figure axis
CMoment of inertia along 3. figure axis
yVector of 12 elements containing the initial rotation vector omega (elements 0 to 2), and the initial rotating systems coordinate vectors e1, e2, e3 (elements 3 to 5, 6 to 8, and 9 to 11).
epsRelative precision per integration step, see RkOdeSolver::RkOdeSolver().

Definition at line 102 of file rotation.cpp.

   : RkOdeSolver<double,12>(t, y, dt, eps),
     m_A(A),
     m_B(B),
     m_C(C)
{
}

Member Function Documentation

const double & RkOdeSolver< double , D >::dX ( void  ) const [inherited]

Get current estimated step size dX.

Returns:
Reference of dX value.
void RkOdeSolver< double , D >::dX ( const double &  a) [inherited]

Set estimated step size dX.

Parameters:
aThe value to be set.
const Matrix<double ,D,1>& RkOdeSolver< double , D >::dYdX ( void  ) const [inherited]

Get current dy/dx value.

Returns:
Reference of dy/dx vector.
const double & RkOdeSolver< double , D >::Eps ( void  ) const [inherited]

Get current presision.

Returns:
Reference of precision value.
void RkOdeSolver< double , D >::Eps ( const double &  a) [inherited]

Set estimated presision.

Parameters:
aThe value to be set.
Vector12d EulerOdeSolver::f ( const double &  x,
const Vector12d y 
) const [protected]

ODE function for the Euler equation system.

Parameters:
xtime in seconds
yVector of 12 elements containing the rotation vector omega (elements 0 to 2), and the rotating systems coordinate vectors e1, e2, e3 (elements 3 to 5, 6 to 8, and 9 to 11).
Returns:
derivation dy/dx

Definition at line 117 of file rotation.cpp.

{
   // unused
   (void)x;

   // vec omega in body coor. sys.: omega_body = (p, q, r)
   const Vector3d omega_body(y.start<3>());

   // body unit vectors in fixed frame coordinates
   Matrix3d e;
   for (int i=0; i<3; ++i)
   {
      e.col(i) = y.segment<3>(3+i*3);
   }

   // vec omega in global fixed coor. sys.
   const Vector3d omega = e * omega_body;

   // return vector y'
   Vector12d ypr;

   // omega_body'
   ypr[0] = -(m_C-m_B)/m_A * omega_body[1] * omega_body[2]; // p'
   ypr[1] = -(m_A-m_C)/m_B * omega_body[2] * omega_body[0]; // q'
   ypr[2] = -(m_B-m_A)/m_C * omega_body[0] * omega_body[1]; // r'

   // e1', e2', e3'
   for (int i=0; i<3; ++i)
   {
      ypr.segment<3>(3+i*3) = omega.cross(e.col(i));
   }

   return ypr;
}
virtual Matrix<double ,D,1> RkOdeSolver< double , D >::f ( const double &  x,
const Matrix< double , D, 1 > &  y 
) const [protected, pure virtual, inherited]

ODE function.

Parameters:
xIntegration value
yFunction value
Returns:
Derivation

This purely virtual function returns the value of dy/dx for the given parameter values of x and y. This function is integrated by the Runge-Kutta algorithm.

void RkOdeSolver< double , D >::integrate ( const double &  dx) [inherited]

Integrates the ordinary differential equation from the current x value to x+dx.

Parameters:
dxx-interval size to integrate over starting from x. dx may be negative.

The integration is performed by calling rkStepCheck() repeatedly until the desired x value is reached.

const double & RkOdeSolver< double , D >::X ( void  ) const [inherited]

Get current x value.

Returns:
Reference of x value.
void RkOdeSolver< double , D >::X ( const double &  a) [inherited]

Set current x value.

Parameters:
aThe value to be set.
const Matrix<double ,D,1>& RkOdeSolver< double , D >::Y ( void  ) const [inherited]

Get current y value.

Returns:
Reference of y vector.
void RkOdeSolver< double , D >::Y ( const Matrix< double , D, 1 > &  a) [inherited]

Set current y values.

Parameters:
aThe vector to be set.

Member Data Documentation

double EulerOdeSolver::m_A [private]

Moments of inertia along the three figure axes.

Definition at line 93 of file rotation.h.

double EulerOdeSolver::m_B [private]

Definition at line 93 of file rotation.h.

double EulerOdeSolver::m_C [private]

Definition at line 93 of file rotation.h.


The documentation for this class was generated from the following files: