simulation_environment.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
33 #ifndef ACADO_TOOLKIT_SIMULATION_ENVIRONMENT_HPP
34 #define ACADO_TOOLKIT_SIMULATION_ENVIRONMENT_HPP
35 
36 
38 
40 
41 #include <acado/clock/clock.hpp>
42 #include <acado/curve/curve.hpp>
43 
46 
47 
49 
50 
51 
73 {
74  //
75  // PUBLIC MEMBER FUNCTIONS:
76  //
77  public:
78 
82 
92  SimulationEnvironment( double _startTime,
93  double _endTime,
94  Process& _process,
95  Controller& _controller
96  );
97 
103  );
104 
107  virtual ~SimulationEnvironment();
108 
114  );
115 
116 
125  returnValue setProcess( Process& _process
126  );
127 
136  returnValue setController( Controller& _controller
137  );
138 
139 
147  );
148 
156  returnValue initializeAlgebraicStates( const char* fileName
157  );
158 
159 
172  returnValue init( const DVector &x0_,
173  const DVector &p_ = emptyConstVector
174  );
175 
176 
184  returnValue step( );
185 
196  returnValue step( double intermediateTime
197  );
198 
199 
207  returnValue run( );
208 
209 
214  inline uint getNY( ) const;
215 
220  inline uint getNU( ) const;
221 
226  inline uint getNP( ) const;
227 
228 
233  inline uint getNumSteps( ) const;
234 
235 
242  inline returnValue getProcessOutput( Curve& _processOutput
243  ) const;
244 
251  inline returnValue getSampledProcessOutput( VariablesGrid& _sampledProcessOutput
252  );
253 
254 
262  );
263 
271  );
272 
280  );
281 
282 
289  inline returnValue getFeedbackControl( Curve& _feedbackControl
290  ) const;
291 
298  inline returnValue getFeedbackControl( VariablesGrid& _sampledFeedbackControl
299  );
300 
301 
308  inline returnValue getFeedbackParameter( Curve& _feedbackParameter
309  ) const;
310 
317  inline returnValue getFeedbackParameter( VariablesGrid& _sampledFeedbackParameter
318  );
319 
320 
321 
322  //
323  // PROTECTED MEMBER FUNCTIONS:
324  //
325  protected:
326 
331  virtual returnValue setupOptions( );
332 
337  virtual returnValue setupLogging( );
338 
339 
347  double determineComputationalDelay( double controllerRuntime
348  ) const;
349 
350 
351  //
352  // PROTECTED MEMBERS:
353  //
354  protected:
355  double startTime;
356  double endTime;
368 };
369 
370 
372 
373 
374 
375 #include <acado/simulation_environment/simulation_environment.ipp>
376 
377 
378 #endif // ACADO_TOOLKIT_SIMULATION_ENVIRONMENT_HPP
379 
380 
381 /*
382  * end of file
383  */
SimulationEnvironment & operator=(const SimulationEnvironment &rhs)
Calculates the control inputs of the Process based on the Process outputs.
Definition: controller.hpp:71
returnValue setController(Controller &_controller)
virtual returnValue setupLogging()
returnValue getProcessDifferentialStates(VariablesGrid &_diffStates)
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
uint getNP() const
returnValue getFeedbackControl(Curve &_feedbackControl) const
returnValue getProcessAlgebraicStates(VariablesGrid &_algStates)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
#define CLOSE_NAMESPACE_ACADO
Simulates real time measurements for simulations.
returnValue getSampledProcessOutput(VariablesGrid &_sampledProcessOutput)
virtual returnValue setupOptions()
returnValue init(const DVector &x0_, const DVector &p_=emptyConstVector)
returnValue initializeAlgebraicStates(const VariablesGrid &_xa_init)
static const DVector emptyConstVector
Definition: vector.hpp:336
returnValue getProcessOutput(Curve &_processOutput) const
uint getNumSteps() const
double determineComputationalDelay(double controllerRuntime) const
Allows to work with piecewise-continous function defined over a scalar time interval.
Definition: curve.hpp:52
void rhs(const real_t *x, real_t *f)
uint getNY() const
Base class for building-blocks of the SimulationEnvironment.
Allows to run closed-loop simulations of dynamic systems.
Simulates the process to be controlled based on a dynamic model.
Definition: process.hpp:71
#define BEGIN_NAMESPACE_ACADO
returnValue setProcess(Process &_process)
returnValue getProcessIntermediateStates(VariablesGrid &_interStates)
uint getNU() const
returnValue getFeedbackParameter(Curve &_feedbackParameter) const


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:06