User-interface to formulate and solve model predictive control problems. More...
#include <real_time_algorithm.hpp>
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.
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).
[in] | rhs | Right-hand side object. |
Definition at line 91 of file real_time_algorithm.cpp.
RealTimeAlgorithm::~RealTimeAlgorithm | ( | ) | [virtual] |
Destructor.
Definition at line 104 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::allocateNlpSolver | ( | Objective * | F, |
DynamicDiscretization * | G, | ||
Constraint * | H | ||
) | [protected, virtual] |
(not yet documented).
[in] | . | . |
Implements OptimizationAlgorithmBase.
Definition at line 576 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::clear | ( | ) | [protected] |
Frees memory of all members of the real time parameters.
Reimplemented from OptimizationAlgorithmBase.
Definition at line 551 of file real_time_algorithm.cpp.
ControlLaw * RealTimeAlgorithm::clone | ( | ) | const [virtual] |
Clone constructor (deep copy).
Implements ControlLaw.
Definition at line 133 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::feedbackStep | ( | double | currentTime, |
const DVector & | _x, | ||
const DVector & | _p = emptyConstVector , |
||
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [virtual] |
Performs next feedback step of the control law based on given inputs.
[in] | currentTime | Current time. |
[in] | _x | Most recent value for differential states. |
[in] | _p | Most recent value for parameters. |
[in] | _yRef | Current piece of reference trajectory (if not specified during previous preparationStep). |
Definition at line 251 of file real_time_algorithm.cpp.
double RealTimeAlgorithm::getLengthControlHorizon | ( | ) | const [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.
double RealTimeAlgorithm::getLengthPredictionHorizon | ( | ) | const [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.
uint RealTimeAlgorithm::getNP | ( | ) | const [virtual] |
Returns number of parameters.
Reimplemented from ControlLaw.
Definition at line 418 of file real_time_algorithm.cpp.
uint RealTimeAlgorithm::getNU | ( | ) | const [virtual] |
Returns number of controls.
Reimplemented from ControlLaw.
Definition at line 413 of file real_time_algorithm.cpp.
uint RealTimeAlgorithm::getNW | ( | ) | const [virtual] |
Returns number of (estimated) disturbances.
Reimplemented from ControlLaw.
Definition at line 423 of file real_time_algorithm.cpp.
uint RealTimeAlgorithm::getNX | ( | ) | const [virtual] |
Returns number of (estimated) differential states.
Reimplemented from ControlLaw.
Definition at line 403 of file real_time_algorithm.cpp.
uint RealTimeAlgorithm::getNXA | ( | ) | const [virtual] |
Returns number of (estimated) algebraic states.
Reimplemented from ControlLaw.
Definition at line 408 of file real_time_algorithm.cpp.
uint RealTimeAlgorithm::getNY | ( | ) | const [virtual] |
Returns number of process outputs.
Reimplemented from ControlLaw.
Definition at line 429 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::init | ( | ) | [virtual] |
Initializes the (internal) optimization algorithm part of the RealTimeAlgorithm.
Definition at line 169 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::init | ( | double | startTime, |
const DVector & | _x = emptyConstVector , |
||
const DVector & | _p = emptyConstVector , |
||
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [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. |
Definition at line 183 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::initializeAlgebraicStates | ( | const VariablesGrid & | _xa_init | ) | [virtual] |
Initializes algebraic states of the control law.
[in] | _xa_init | Initial value for algebraic states. |
Reimplemented from ControlLaw.
Definition at line 140 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::initializeAlgebraicStates | ( | const char * | fileName | ) | [virtual] |
Initializes algebraic states of the control law from data file.
[in] | fileName | Name of file containing initial value for algebraic states. |
Reimplemented from ControlLaw.
Definition at line 147 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::initializeControls | ( | const VariablesGrid & | _u_init | ) | [virtual] |
Initializes controls of the control law.
[in] | _u_init | Initial value for controls. |
Reimplemented from ControlLaw.
Definition at line 154 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::initializeControls | ( | const char * | fileName | ) | [virtual] |
Initializes controls of the control law from data file.
[in] | fileName | Name of file containing initial value for controls. |
Reimplemented from ControlLaw.
Definition at line 161 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::initializeNlpSolver | ( | const OCPiterate & | userInit | ) | [protected, virtual] |
(not yet documented).
[in] | . | . |
Implements OptimizationAlgorithmBase.
Definition at line 587 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::initializeObjective | ( | Objective * | F | ) | [protected, virtual] |
(not yet documented).
[in] | . | . |
Implements OptimizationAlgorithmBase.
Definition at line 603 of file real_time_algorithm.cpp.
BooleanType RealTimeAlgorithm::isDynamic | ( | ) | const [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.
BooleanType RealTimeAlgorithm::isInRealTimeMode | ( | ) | const [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.
BooleanType RealTimeAlgorithm::isStatic | ( | ) | const [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).
[in] | rhs | Right-hand side object. |
Definition at line 111 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::performFeedbackStep | ( | double | currentTime, |
const DVector & | _x, | ||
const DVector & | _p = emptyConstVector |
||
) | [protected] |
(not yet documented).
[in] | . | . |
Definition at line 618 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::performPreparationStep | ( | const VariablesGrid & | _yRef = emptyConstVariablesGrid , |
BooleanType | isLastIteration = BT_TRUE |
||
) | [protected] |
(not yet documented).
[in] | . | . |
Definition at line 648 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::preparationStep | ( | double | nextTime = 0.0 , |
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [virtual] |
Performs next preparation step of the control law based on given inputs.
[in] | nextTime | Time at next step. |
[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.
returnValue RealTimeAlgorithm::setReference | ( | const VariablesGrid & | ref | ) | [virtual] |
Assigns new reference trajectory for the next real-time step.
[in] | ref | Current piece of new reference trajectory. |
Definition at line 391 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::setupLogging | ( | ) | [protected, virtual] |
Sets-up default logging information.
Reimplemented from Logging.
Definition at line 539 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::setupOptions | ( | ) | [protected, virtual] |
Sets-up default options.
Reimplemented from Options.
Definition at line 484 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::shift | ( | double | timeShift = -1.0 | ) | [virtual] |
Shifts the data for preparating the next real-time step.
Reimplemented from ControlLaw.
Definition at line 379 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::solve | ( | double | startTime, |
const DVector & | _x, | ||
const DVector & | _p = emptyConstVector , |
||
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [virtual] |
(not yet documented).
[in] | . | . |
Definition at line 331 of file real_time_algorithm.cpp.
returnValue RealTimeAlgorithm::step | ( | double | currentTime, |
const DVector & | _x, | ||
const DVector & | _p = emptyConstVector , |
||
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [virtual] |
Performs next step of the control law based on given inputs.
[in] | currentTime | Current time. |
[in] | _x | Most recent value for differential states. |
[in] | _p | Most recent value for parameters. |
[in] | _yRef | Current piece of reference trajectory or piece of reference trajectory for next step (required for hotstarting). |
Definition at line 235 of file real_time_algorithm.cpp.
DVector* RealTimeAlgorithm::p0 [protected] |
Deep copy of the most recent parameter.
Definition at line 398 of file real_time_algorithm.hpp.
VariablesGrid* RealTimeAlgorithm::reference [protected] |
Deep copy of the most recent reference.
Definition at line 400 of file real_time_algorithm.hpp.
DVector* RealTimeAlgorithm::x0 [protected] |
Deep copy of the most recent initial value of differential states.
Definition at line 397 of file real_time_algorithm.hpp.