integrator_runge_kutta45.cpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023  *
00024  */
00025 
00026 
00027 
00034 #include <acado/utils/acado_utils.hpp>
00035 #include <acado/matrix_vector/matrix_vector.hpp>
00036 #include <acado/symbolic_expression/symbolic_expression.hpp>
00037 #include <acado/function/function_.hpp>
00038 #include <acado/function/differential_equation.hpp>
00039 #include <acado/integrator/integrator.hpp>
00040 #include <acado/integrator/integrator_runge_kutta.hpp>
00041 #include <acado/integrator/integrator_runge_kutta45.hpp>
00042 
00043 
00044 
00045 BEGIN_NAMESPACE_ACADO
00046 
00047 
00048 //
00049 // PUBLIC MEMBER FUNCTIONS:
00050 //
00051 
00052 IntegratorRK45::IntegratorRK45( )
00053                :IntegratorRK(7,0.25){
00054 
00055     if( A != 0 ) initializeButcherTableau();
00056 }
00057 
00058 IntegratorRK45::IntegratorRK45( const DifferentialEquation &rhs_ )
00059                :IntegratorRK(rhs_,7,0.25){
00060 
00061     if( A != 0 ) initializeButcherTableau();
00062 }
00063 
00064 IntegratorRK45::IntegratorRK45( const IntegratorRK45& arg )
00065                :IntegratorRK(arg){ }
00066 
00067 IntegratorRK45::~IntegratorRK45( ){ }
00068 
00069 IntegratorRK45& IntegratorRK45::operator=( const IntegratorRK45& arg ){
00070 
00071     if( this != &arg ){
00072         IntegratorRK::operator=(arg);
00073     }
00074     return *this;
00075 }
00076 
00077 Integrator* IntegratorRK45::clone() const{
00078 
00079     return new IntegratorRK45(*this);
00080 }
00081 
00082 
00083 void IntegratorRK45::initializeButcherTableau(){
00084 
00085     A[0][0] = 0.0;
00086     A[0][1] = 0.0;
00087     A[0][2] = 0.0;
00088     A[0][3] = 0.0;
00089     A[0][4] = 0.0;
00090     A[0][5] = 0.0;
00091     A[0][6] = 0.0;
00092 
00093     A[1][0] = 1.0/5.0;
00094     A[1][1] = 0.0;
00095     A[1][2] = 0.0;
00096     A[1][3] = 0.0;
00097     A[1][4] = 0.0;
00098     A[1][5] = 0.0;
00099     A[1][6] = 0.0;
00100 
00101     A[2][0] = 3.0/40.0;
00102     A[2][1] = 9.0/40.0;
00103     A[2][2] = 0.0;
00104     A[2][3] = 0.0;
00105     A[2][4] = 0.0;
00106     A[2][5] = 0.0;
00107     A[2][6] = 0.0;
00108 
00109     A[3][0] = 44.0/45.0;
00110     A[3][1] = -56.0/15.0;
00111     A[3][2] = 32.0/9.0;
00112     A[3][3] = 0.0;
00113     A[3][4] = 0.0;
00114     A[3][5] = 0.0;
00115     A[3][6] = 0.0;
00116 
00117     A[4][0] = 19372.0/6561.0;
00118     A[4][1] = -25360.0/2187.0;
00119     A[4][2] = 64448.0/6561.0;
00120     A[4][3] = -212.0/729.0;
00121     A[4][4] = 0.0;
00122     A[4][5] = 0.0;
00123     A[4][6] = 0.0;
00124 
00125     A[5][0] = 9017.0/3168.0;
00126     A[5][1] = -355.0/33.0;
00127     A[5][2] = 46732.0/5247.0;
00128     A[5][3] = 49.0/176.0;
00129     A[5][4] = -5103.0/18656.0;
00130     A[5][5] = 0.0;
00131     A[5][6] = 0.0;
00132 
00133     A[6][0] = 35.0/384.0;
00134     A[6][1] = 0.0;
00135     A[6][2] = 500.0/1113.0;
00136     A[6][3] = 125.0/192.0;
00137     A[6][4] = -2187.0/6784.0;
00138     A[6][5] = 11.0/84.0;
00139     A[6][6] = 0.0;
00140 
00141     b4[0] = 5179.0/57600.0;
00142     b4[1] = 0.0;
00143     b4[2] = 7571.0/16695.0;
00144     b4[3] = 393.0/640.0;
00145     b4[4] = -92097.0/339200.0;
00146     b4[5] = 187.0/2100.0;
00147     b4[6] = 1.0/40.0;
00148 
00149     b5[0] = 35.0/384.0;
00150     b5[1] = 0.0;
00151     b5[2] = 500.0/1113.0;
00152     b5[3] = 125.0/192.0;
00153     b5[4] = -2187.0/6784.0;
00154     b5[5] = 11.0/84.0;
00155     b5[6] = 0.0;
00156 
00157     c[0] = 0.0;
00158     c[1] = 0.2;
00159     c[2] = 0.3;
00160     c[3] = 0.8;
00161     c[4] = 8.0/9.0;
00162     c[5] = 1.0;
00163     c[6] = 1.0;
00164 }
00165 
00166 
00167 CLOSE_NAMESPACE_ACADO
00168 
00169 // end of file.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:58:37