simulation_environment.hpp
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 
00033 #ifndef ACADO_TOOLKIT_SIMULATION_ENVIRONMENT_HPP
00034 #define ACADO_TOOLKIT_SIMULATION_ENVIRONMENT_HPP
00035 
00036 
00037 #include <acado/utils/acado_utils.hpp>
00038 
00039 #include <acado/simulation_environment/simulation_block.hpp>
00040 
00041 #include <acado/clock/clock.hpp>
00042 #include <acado/curve/curve.hpp>
00043 
00044 #include <acado/process/process.hpp>
00045 #include <acado/controller/controller.hpp>
00046 
00047 
00048 BEGIN_NAMESPACE_ACADO
00049 
00050 
00051 
00072 class SimulationEnvironment : public SimulationBlock
00073 {
00074         //
00075         //  PUBLIC MEMBER FUNCTIONS:
00076         //
00077         public:
00078 
00081                 SimulationEnvironment( );
00082 
00092                 SimulationEnvironment(  double _startTime,
00093                                                                 double _endTime,
00094                                                                 Process& _process,
00095                                                                 Controller& _controller
00096                                                                 );
00097         
00102                 SimulationEnvironment(  const SimulationEnvironment &rhs
00103                                                                 );
00104         
00107                 virtual ~SimulationEnvironment();
00108         
00113                 SimulationEnvironment& operator=(       const SimulationEnvironment &rhs
00114                                                                                         );
00115         
00116 
00125                 returnValue setProcess( Process& _process
00126                                                                 );
00127 
00136                 returnValue setController(      Controller& _controller
00137                                                                         );
00138 
00139 
00146                 returnValue initializeAlgebraicStates(  const VariablesGrid& _xa_init
00147                                                                                                 );
00148 
00156                 returnValue initializeAlgebraicStates(  const char* fileName
00157                                                                                                 );
00158 
00159 
00172         returnValue init(       const DVector &x0_,
00173                                                         const DVector &p_ = emptyConstVector
00174                                                         );
00175 
00176 
00184                 returnValue step( );
00185 
00196                 returnValue step(       double intermediateTime
00197                                                         );
00198 
00199 
00207                 returnValue run( );
00208 
00209 
00214                 inline uint getNY( ) const;
00215 
00220                 inline uint getNU( ) const;
00221 
00226                 inline uint getNP( ) const;
00227 
00228 
00233                 inline uint getNumSteps( ) const;
00234 
00235 
00242                 inline returnValue getProcessOutput(    Curve& _processOutput
00243                                                                                                 ) const;
00244 
00251                 inline returnValue getSampledProcessOutput(     VariablesGrid& _sampledProcessOutput
00252                                                                                                         );
00253 
00254 
00261                 inline returnValue getProcessDifferentialStates(        VariablesGrid& _diffStates
00262                                                                                                                         );
00263 
00270                 inline returnValue getProcessAlgebraicStates(           VariablesGrid& _algStates
00271                                                                                                                         );
00272 
00279                 inline returnValue getProcessIntermediateStates(        VariablesGrid& _interStates
00280                                                                                                                         );
00281 
00282 
00289                 inline returnValue getFeedbackControl(  Curve& _feedbackControl
00290                                                                                                 ) const;
00291 
00298                 inline returnValue getFeedbackControl(  VariablesGrid& _sampledFeedbackControl
00299                                                                                                 );
00300 
00301 
00308                 inline returnValue getFeedbackParameter(        Curve& _feedbackParameter
00309                                                                                                         ) const;
00310 
00317                 inline returnValue getFeedbackParameter(        VariablesGrid& _sampledFeedbackParameter
00318                                                                                                         );
00319 
00320 
00321 
00322         //
00323         //  PROTECTED MEMBER FUNCTIONS:
00324         //
00325         protected:
00326 
00331                 virtual returnValue setupOptions( );
00332 
00337                 virtual returnValue setupLogging( );
00338 
00339 
00347                 double determineComputationalDelay(     double controllerRuntime
00348                                                                                         ) const;
00349 
00350 
00351         //
00352         //  PROTECTED MEMBERS:
00353         //
00354         protected:
00355                 double startTime;                                                       
00356                 double endTime;                                                         
00358                 Process* process;                                                       
00359                 Controller* controller;                                         
00361                 SimulationClock simulationClock;                        
00363                 Curve processOutput;                                            
00364                 Curve feedbackControl;                                          
00365                 Curve feedbackParameter;                                        
00367                 uint nSteps;                                                            
00368 };
00369 
00370 
00371 CLOSE_NAMESPACE_ACADO
00372 
00373 
00374 
00375 #include <acado/simulation_environment/simulation_environment.ipp>
00376 
00377 
00378 #endif  // ACADO_TOOLKIT_SIMULATION_ENVIRONMENT_HPP
00379 
00380 
00381 /*
00382  *      end of file
00383  */


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 12:00:14