User-interface to formulate and solve model predictive control problems. More...
#include <real_time_algorithm.hpp>
Protected Attributes | |
DVector * | p0 |
VariablesGrid * | reference |
DVector * | x0 |
Protected Attributes inherited from OptimizationAlgorithmBase | |
OCPiterate | iter |
NLPsolver * | nlpSolver |
OCP * | ocp |
OCPiterate | userInit |
Protected Attributes inherited from ControlLaw | |
DVector | p |
DVector | u |
Protected Attributes inherited from SimulationBlock | |
BlockName | name |
RealClock | realClock |
double | samplingTime |
Protected Attributes inherited from UserInteraction | |
BlockStatus | status |
Protected Attributes inherited from Options | |
std::vector< OptionsList > | lists |
Protected Attributes inherited from Logging | |
std::vector< LogRecord > | logCollection |
int | logIdx |
Protected Attributes inherited from Plotting | |
PlotCollection | plotCollection |
User-interface to formulate and solve model predictive control problems.
The class RealTimeAlgorithm serves as a user-interface to formulate and solve model predictive control problems.
Definition at line 56 of file real_time_algorithm.hpp.
BEGIN_NAMESPACE_ACADO RealTimeAlgorithm::RealTimeAlgorithm | ( | ) |
Default constructor.
Definition at line 50 of file real_time_algorithm.cpp.
RealTimeAlgorithm::RealTimeAlgorithm | ( | const OCP & | ocp_, |
double | _samplingTime = DEFAULT_SAMPLING_TIME |
||
) |
Constructor which takes the optimal control problem to be solved online together with the sampling time.
[in] | ocp_ | Optimal control problem to be solved online. |
[in] | _samplingTime | Sampling time. |
Definition at line 69 of file real_time_algorithm.cpp.
RealTimeAlgorithm::RealTimeAlgorithm | ( | const RealTimeAlgorithm & | rhs | ) |
Copy constructor (deep copy).
@param[in] rhs Right-hand side object.
Definition at line 91 of file real_time_algorithm.cpp.
|
virtual |
Destructor.
Definition at line 104 of file real_time_algorithm.cpp.
|
protectedvirtual |
(not yet documented).
@param[in] . .
Implements OptimizationAlgorithmBase.
Definition at line 576 of file real_time_algorithm.cpp.
|
protected |
Frees memory of all members of the real time parameters.
Definition at line 551 of file real_time_algorithm.cpp.
|
virtual |
Clone constructor (deep copy).
\return Pointer to deep copy of base class type
Implements ControlLaw.
Definition at line 133 of file real_time_algorithm.cpp.
|
virtual |
Performs next feedback step of the control law based on given inputs.
@param[in] currentTime Current time. @param[in] _x Most recent value for differential states. @param[in] _p Most recent value for parameters. @param[in] _yRef Current piece of reference trajectory (if not specified during previous preparationStep). \note If a non-empty reference trajectory is provided, this one is used instead of the possibly set-up build-in one.
Reimplemented from ControlLaw.
Definition at line 251 of file real_time_algorithm.cpp.
|
virtual |
Returns length of the control horizon (for the case a predictive control law is used).
Reimplemented from ControlLaw.
Definition at line 442 of file real_time_algorithm.cpp.
|
virtual |
Returns length of the prediction horizon (for the case a predictive control law is used).
Reimplemented from ControlLaw.
Definition at line 436 of file real_time_algorithm.cpp.
|
virtual |
Returns number of parameters.
Reimplemented from ControlLaw.
Definition at line 418 of file real_time_algorithm.cpp.
|
virtual |
Returns number of controls.
Reimplemented from ControlLaw.
Definition at line 413 of file real_time_algorithm.cpp.
|
virtual |
Returns number of (estimated) disturbances.
Reimplemented from ControlLaw.
Definition at line 423 of file real_time_algorithm.cpp.
|
virtual |
Returns number of (estimated) differential states.
Reimplemented from ControlLaw.
Definition at line 403 of file real_time_algorithm.cpp.
|
virtual |
Returns number of (estimated) algebraic states.
Reimplemented from ControlLaw.
Definition at line 408 of file real_time_algorithm.cpp.
|
virtual |
Returns number of process outputs.
Reimplemented from ControlLaw.
Definition at line 429 of file real_time_algorithm.cpp.
|
virtual |
Initializes the (internal) optimization algorithm part of the RealTimeAlgorithm.
Definition at line 169 of file real_time_algorithm.cpp.
|
virtual |
Initializes the control law with given start values and performs a number of consistency checks.
[in] | _startTime | Start time. |
[in] | _x | Initial value for differential states. |
[in] | _p | Initial value for parameters. |
[in] | _yRef | Initial value for reference trajectory. |
Implements ControlLaw.
Definition at line 183 of file real_time_algorithm.cpp.
|
virtual |
Initializes algebraic states of the control law.
@param[in] _xa_init Initial value for algebraic states.
Reimplemented from ControlLaw.
Definition at line 140 of file real_time_algorithm.cpp.
|
virtual |
Initializes algebraic states of the control law from data file.
@param[in] fileName Name of file containing initial value for algebraic states.
Reimplemented from ControlLaw.
Definition at line 147 of file real_time_algorithm.cpp.
|
virtual |
Initializes controls of the control law.
@param[in] _u_init Initial value for controls.
Reimplemented from ControlLaw.
Definition at line 154 of file real_time_algorithm.cpp.
|
virtual |
Initializes controls of the control law from data file.
@param[in] fileName Name of file containing initial value for controls.
Reimplemented from ControlLaw.
Definition at line 161 of file real_time_algorithm.cpp.
|
protectedvirtual |
(not yet documented).
@param[in] . .
Implements OptimizationAlgorithmBase.
Definition at line 587 of file real_time_algorithm.cpp.
|
protectedvirtual |
(not yet documented).
@param[in] . .
Implements OptimizationAlgorithmBase.
Definition at line 603 of file real_time_algorithm.cpp.
|
virtual |
Returns whether the control law is based on dynamic optimization or a static one.
Implements ControlLaw.
Definition at line 449 of file real_time_algorithm.cpp.
|
virtual |
Returns whether the control law is working in real-time mode.
Reimplemented from ControlLaw.
Definition at line 464 of file real_time_algorithm.cpp.
|
virtual |
Returns whether the control law is a static one or based on dynamic optimization.
Implements ControlLaw.
Definition at line 455 of file real_time_algorithm.cpp.
RealTimeAlgorithm & RealTimeAlgorithm::operator= | ( | const RealTimeAlgorithm & | rhs | ) |
Assignment operator (deep copy).
@param[in] rhs Right-hand side object.
Definition at line 111 of file real_time_algorithm.cpp.
|
protected |
(not yet documented).
@param[in] . .
Definition at line 618 of file real_time_algorithm.cpp.
|
protected |
(not yet documented).
@param[in] . .
Definition at line 648 of file real_time_algorithm.cpp.
|
virtual |
Performs next preparation step of the control law based on given inputs.
@param[in] nextTime Time at next step. @param[in] _yRef Piece of reference trajectory for next step (required for hotstarting).
Reimplemented from ControlLaw.
Definition at line 318 of file real_time_algorithm.cpp.
|
virtual |
Assigns new reference trajectory for the next real-time step.
@param[in] ref Current piece of new reference trajectory. \return SUCCESSFUL_RETURN, \n RET_REFERENCE_SHIFTING_WORKS_FOR_LSQ_TERMS_ONLY, \n RET_MEMBER_NOT_INITIALISED
Definition at line 391 of file real_time_algorithm.cpp.
|
protectedvirtual |
Sets-up default logging information.
Reimplemented from Logging.
Definition at line 539 of file real_time_algorithm.cpp.
|
protectedvirtual |
Sets-up default options.
Reimplemented from Options.
Definition at line 484 of file real_time_algorithm.cpp.
|
virtual |
Shifts the data for preparating the next real-time step.
\return RET_NOT_YET_IMPLEMENTED
Reimplemented from ControlLaw.
Definition at line 379 of file real_time_algorithm.cpp.
|
virtual |
(not yet documented).
@param[in] . .
Definition at line 331 of file real_time_algorithm.cpp.
|
virtual |
Performs next step of the control law based on given inputs.
@param[in] currentTime Current time. @param[in] _x Most recent value for differential states. @param[in] _p Most recent value for parameters. @param[in] _yRef Current piece of reference trajectory or piece of reference trajectory for next step (required for hotstarting).
Implements ControlLaw.
Definition at line 235 of file real_time_algorithm.cpp.
|
protected |
Deep copy of the most recent parameter.
Definition at line 398 of file real_time_algorithm.hpp.
|
protected |
Deep copy of the most recent reference.
Definition at line 400 of file real_time_algorithm.hpp.
|
protected |
Deep copy of the most recent initial value of differential states.
Definition at line 397 of file real_time_algorithm.hpp.