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 #ifndef ACADO_TOOLKIT_DIFFERENTIAL_EQUATION_HPP 00035 #define ACADO_TOOLKIT_DIFFERENTIAL_EQUATION_HPP 00036 00037 00038 #include <acado/function/function_fwd.hpp> 00039 #include <acado/symbolic_expression/lyapunov.hpp> 00040 00041 00042 BEGIN_NAMESPACE_ACADO 00043 00044 00055 class DifferentialEquation : public Function{ 00056 00057 // 00058 // PUBLIC MEMBER FUNCTIONS: 00059 // 00060 public: 00061 00062 00064 DifferentialEquation( ); 00065 00067 DifferentialEquation( const double &tStart, const double &tEnd ); 00068 00070 DifferentialEquation( const double &tStart, const Parameter &tEnd ); 00071 00073 DifferentialEquation( const Parameter &tStart, const double &tEnd ); 00074 00076 DifferentialEquation( const Parameter &tStart, const Parameter &tEnd ); 00077 00078 00080 DifferentialEquation( const DifferentialEquation& arg ); 00081 00083 virtual ~DifferentialEquation( ); 00084 00086 DifferentialEquation& operator=( const DifferentialEquation& arg ); 00087 00088 00090 virtual DifferentialEquation* clone() const; 00091 00092 00094 DifferentialEquation& operator<<( const Expression& arg ); 00095 00097 DifferentialEquation& operator<<( const int& arg ); 00098 00100 DifferentialEquation& operator==( const Expression& arg ); 00101 00103 DifferentialEquation& operator==( const double &arg ); 00104 00106 DifferentialEquation& operator==( const DVector& arg ); 00107 00109 DifferentialEquation& operator==( const DMatrix& arg ); 00110 00111 00113 BooleanType isDAE( ) const; 00114 00116 BooleanType isODE( ) const; 00117 00119 inline BooleanType isImplicit( ) const; 00120 00121 00128 virtual BooleanType makeImplicit(); 00129 00130 00131 00134 inline int getNumDynamicEquations() const; 00135 00136 00139 inline int getNumAlgebraicEquations() const; 00140 00141 00143 virtual BooleanType isDiscretized( ) const; 00144 00145 00151 inline double getStartTime() const; 00152 00153 00159 inline double getEndTime() const; 00160 00161 00168 inline int getStartTimeIdx() const; 00169 00170 00177 inline int getEndTimeIdx() const; 00178 00179 00180 00183 virtual double getStepLength() const; 00184 00185 00186 inline int getStateEnumerationIndex( int index_ ); 00187 00188 00189 inline DVector getDifferentialStateComponents() const; 00190 00191 00192 00194 DifferentialEquation& addDifferential( const Expression& arg ); 00195 00197 DifferentialEquation& addDifferential( const double &arg ); 00198 00200 DifferentialEquation& addAlgebraic( const Expression& arg ); 00201 00203 DifferentialEquation& addAlgebraic( const double &arg ); 00204 00206 DifferentialEquation& addDifferential( const DVector& arg ); 00207 00209 DifferentialEquation& addAlgebraic( const DVector& arg ); 00210 00212 DifferentialEquation& addDifferential( const DMatrix& arg ); 00213 00215 DifferentialEquation& addAlgebraic( const DMatrix& arg ); 00216 00217 DifferentialEquation& operator==(const Lyapunov& arg ); 00218 00219 Lyapunov getLyapunovObject( ) const; 00220 00221 BooleanType hasLyapunovEquation( ) const; 00222 00223 00234 Expression getODEexpansion( const int &order ) const; 00235 00236 00237 inline int* getComponents() const; 00238 00239 00240 00241 // PROTECTED MEMBER FUNCTIONS: 00242 // --------------------------- 00243 protected: 00244 00245 00247 void setup(); 00248 00249 00251 void copy( const DifferentialEquation &arg ); 00252 00253 00254 00255 00256 00257 // PROTECTED MEMBERS: 00258 // ------------------ 00259 00260 protected: 00261 00262 DifferentialEquationType det; 00263 BooleanType is_implicit; 00264 BooleanType is_discretized; 00265 00266 int counter ; 00267 int *component; 00268 00269 Parameter *T1, *T2; 00270 double t1, t2; 00271 00272 double stepLength; // for discretized dynamic equations only 00273 Lyapunov lyap; 00274 }; 00275 00276 00277 CLOSE_NAMESPACE_ACADO 00278 00279 00280 00281 #include <acado/function/differential_equation.ipp> 00282 00283 00284 #endif // ACADO_TOOLKIT_DIFFERENTIAL_EQUATION_HPP 00285 00286 // end of file.