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 #include <acado/integrator/integrator_lyapunov.hpp> 00044 #include <acado/integrator/integrator_lyapunov45.hpp> 00045 00046 00047 BEGIN_NAMESPACE_ACADO 00048 00049 00050 // 00051 // PUBLIC MEMBER FUNCTIONS: 00052 // 00053 00054 IntegratorLYAPUNOV45::IntegratorLYAPUNOV45( ) 00055 :IntegratorLYAPUNOV(7,0.25){ 00056 00057 if( A != 0 ) initializeButcherTableau(); 00058 } 00059 00060 IntegratorLYAPUNOV45::IntegratorLYAPUNOV45( const DifferentialEquation &rhs_ ) 00061 :IntegratorLYAPUNOV(rhs_,7,0.25){ 00062 00063 if( A != 0 ) initializeButcherTableau(); 00064 } 00065 00066 IntegratorLYAPUNOV45::IntegratorLYAPUNOV45( const IntegratorLYAPUNOV45& arg ) 00067 :IntegratorLYAPUNOV(arg){ } 00068 00069 IntegratorLYAPUNOV45::~IntegratorLYAPUNOV45( ){ } 00070 00071 IntegratorLYAPUNOV45& IntegratorLYAPUNOV45::operator=( const IntegratorLYAPUNOV45& arg ){ 00072 00073 if( this != &arg ){ 00074 IntegratorLYAPUNOV::operator=(arg); 00075 } 00076 return *this; 00077 } 00078 00079 Integrator* IntegratorLYAPUNOV45::clone() const{ 00080 00081 return new IntegratorLYAPUNOV45(*this); 00082 } 00083 00084 00085 void IntegratorLYAPUNOV45::initializeButcherTableau(){ 00086 00087 A[0][0] = 0.0; 00088 A[0][1] = 0.0; 00089 A[0][2] = 0.0; 00090 A[0][3] = 0.0; 00091 A[0][4] = 0.0; 00092 A[0][5] = 0.0; 00093 A[0][6] = 0.0; 00094 00095 A[1][0] = 1.0/5.0; 00096 A[1][1] = 0.0; 00097 A[1][2] = 0.0; 00098 A[1][3] = 0.0; 00099 A[1][4] = 0.0; 00100 A[1][5] = 0.0; 00101 A[1][6] = 0.0; 00102 00103 A[2][0] = 3.0/40.0; 00104 A[2][1] = 9.0/40.0; 00105 A[2][2] = 0.0; 00106 A[2][3] = 0.0; 00107 A[2][4] = 0.0; 00108 A[2][5] = 0.0; 00109 A[2][6] = 0.0; 00110 00111 A[3][0] = 44.0/45.0; 00112 A[3][1] = -56.0/15.0; 00113 A[3][2] = 32.0/9.0; 00114 A[3][3] = 0.0; 00115 A[3][4] = 0.0; 00116 A[3][5] = 0.0; 00117 A[3][6] = 0.0; 00118 00119 A[4][0] = 19372.0/6561.0; 00120 A[4][1] = -25360.0/2187.0; 00121 A[4][2] = 64448.0/6561.0; 00122 A[4][3] = -212.0/729.0; 00123 A[4][4] = 0.0; 00124 A[4][5] = 0.0; 00125 A[4][6] = 0.0; 00126 00127 A[5][0] = 9017.0/3168.0; 00128 A[5][1] = -355.0/33.0; 00129 A[5][2] = 46732.0/5247.0; 00130 A[5][3] = 49.0/176.0; 00131 A[5][4] = -5103.0/18656.0; 00132 A[5][5] = 0.0; 00133 A[5][6] = 0.0; 00134 00135 A[6][0] = 35.0/384.0; 00136 A[6][1] = 0.0; 00137 A[6][2] = 500.0/1113.0; 00138 A[6][3] = 125.0/192.0; 00139 A[6][4] = -2187.0/6784.0; 00140 A[6][5] = 11.0/84.0; 00141 A[6][6] = 0.0; 00142 00143 b4[0] = 5179.0/57600.0; 00144 b4[1] = 0.0; 00145 b4[2] = 7571.0/16695.0; 00146 b4[3] = 393.0/640.0; 00147 b4[4] = -92097.0/339200.0; 00148 b4[5] = 187.0/2100.0; 00149 b4[6] = 1.0/40.0; 00150 00151 b5[0] = 35.0/384.0; 00152 b5[1] = 0.0; 00153 b5[2] = 500.0/1113.0; 00154 b5[3] = 125.0/192.0; 00155 b5[4] = -2187.0/6784.0; 00156 b5[5] = 11.0/84.0; 00157 b5[6] = 0.0; 00158 00159 c[0] = 0.0; 00160 c[1] = 0.2; 00161 c[2] = 0.3; 00162 c[3] = 0.8; 00163 c[4] = 8.0/9.0; 00164 c[5] = 1.0; 00165 c[6] = 1.0; 00166 } 00167 00168 00169 CLOSE_NAMESPACE_ACADO 00170 00171 // end of file.