control_law.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 
00034 #include <acado/control_law/control_law.hpp>
00035 
00036 
00037 BEGIN_NAMESPACE_ACADO
00038 
00039 
00040 
00041 //
00042 // PUBLIC MEMBER FUNCTIONS:
00043 //
00044 
00045 ControlLaw::ControlLaw( ) : SimulationBlock( BN_CONTROL_LAW )
00046 {
00047 }
00048 
00049 
00050 ControlLaw::ControlLaw( double _samplingTime
00051                                                 ) : SimulationBlock( BN_CONTROL_LAW,_samplingTime )
00052 {
00053 }
00054 
00055 
00056 ControlLaw::ControlLaw( const ControlLaw& rhs ) : SimulationBlock( rhs )
00057 {
00058         u = rhs.u;
00059         p = rhs.u;
00060 }
00061 
00062 
00063 ControlLaw::~ControlLaw( )
00064 {
00065 }
00066 
00067 
00068 ControlLaw& ControlLaw::operator=( const ControlLaw& rhs )
00069 {
00070         if ( this != &rhs )
00071         {
00072                 SimulationBlock::operator=( rhs );
00073 
00074                 u = rhs.u;
00075                 p = rhs.u;
00076         }
00077 
00078     return *this;
00079 }
00080 
00081 
00082 
00083 returnValue ControlLaw::initializeAlgebraicStates( const VariablesGrid& _xa_init )
00084 {
00085         return ACADOERROR( RET_NOT_IMPLEMENTED_IN_BASE_CLASS );
00086 }
00087 
00088 
00089 returnValue ControlLaw::initializeAlgebraicStates( const char* fileName )
00090 {
00091         return ACADOERROR( RET_NOT_IMPLEMENTED_IN_BASE_CLASS );
00092 }
00093 
00094 
00095 
00096 returnValue ControlLaw::initializeControls( const VariablesGrid& _u_init )
00097 {
00098         return ACADOERROR( RET_NOT_IMPLEMENTED_IN_BASE_CLASS );
00099 }
00100 
00101 
00102 returnValue ControlLaw::initializeControls( const char* fileName )
00103 {
00104         return ACADOERROR( RET_NOT_IMPLEMENTED_IN_BASE_CLASS );
00105 }
00106 
00107 
00108 
00109 
00110 returnValue ControlLaw::step(   const DVector& _x,
00111                                                                 const DVector& _p,
00112                                                                 const VariablesGrid& _yRef
00113                                                                 )
00114 {
00115     return step( 0.0,_x,_p,_yRef );
00116 }
00117 
00118 
00119 returnValue ControlLaw::feedbackStep(   double currentTime,
00120                                                                                 const DVector& _x,
00121                                                                                 const DVector& _p,
00122                                                                                 const VariablesGrid& _yRef
00123                                                                                 )
00124 {
00125         // perform standard step
00126         return step( currentTime,_x,_p,_yRef );
00127 }
00128 
00129 
00130 returnValue ControlLaw::preparationStep(        double nextTime,
00131                                                                                         const VariablesGrid& _yRef
00132                                                                                         )
00133 {
00134         // do nothing by default
00135         return SUCCESSFUL_RETURN;
00136 }
00137 
00138 
00139 
00140 returnValue ControlLaw::shift(  double timeShift
00141                                                                 )
00142 {
00143         return ACADOERROR( RET_NO_REALTIME_MODE_AVAILABLE );
00144 }
00145 
00146 
00147 
00148 uint ControlLaw::getNX( ) const
00149 {
00150         return 0;
00151 }
00152 
00153 
00154 uint ControlLaw::getNXA( ) const
00155 {
00156         return 0;
00157 }
00158 
00159 
00160 uint ControlLaw::getNU( ) const
00161 {
00162         return 0;
00163 }
00164 
00165 
00166 uint ControlLaw::getNP( ) const
00167 {
00168         return 0;
00169 }
00170 
00171 
00172 uint ControlLaw::getNW( ) const
00173 {
00174         return 0;
00175 }
00176 
00177 
00178 uint ControlLaw::getNY( ) const
00179 {
00180         return 0;
00181 }
00182 
00183 
00184 double ControlLaw::getLengthPredictionHorizon( ) const
00185 {
00186         return samplingTime;
00187 }
00188 
00189 
00190 double ControlLaw::getLengthControlHorizon( ) const
00191 {
00192         return samplingTime;
00193 }
00194 
00195 
00196 //
00197 // PROTECTED MEMBER FUNCTIONS:
00198 //
00199 
00200 BooleanType ControlLaw::isInRealTimeMode( ) const
00201 {
00202         return BT_FALSE;
00203 }
00204 
00205 
00206 
00207 CLOSE_NAMESPACE_ACADO
00208 
00209 // end of file.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:36:56