Calculates the control inputs of the Process based on the Process outputs. More...
#include <controller.hpp>
Calculates the control inputs of the Process based on the Process outputs.
The class Controller is one of the two main building-blocks within the SimulationEnvironment and complements the Process. It contains an online control law (e.g. a DynamicFeedbackLaw comprising a RealTimeAlgorithm) for obtaining the control inputs of the Process.
A state/parameter estimator as well as a ReferenceTrajectory can optionally be used to provide estimated quantities and a reference values to the control law. The reference trajectory can either be specified beforehand as member of the Controller or, alternatively, provided at each step in order to allow for reference trajectories that can be adapted online.
Definition at line 71 of file controller.hpp.
Default constructor.
Definition at line 45 of file controller.cpp.
Controller::Controller | ( | ControlLaw & | _controlLaw, |
Estimator & | _estimator, | ||
ReferenceTrajectory & | _referenceTrajectory = emptyReferenceTrajectory |
||
) |
Constructor which takes a control law, an estimator and a reference trajectory for computing the control/parameter signals.
[in] | _controlLaw | Control law to be used for computing the control/parameter signals. |
[in] | _estimator | Estimator for estimating quantities required by the control law based on the process output. |
[in] | _referenceTrajectory | Reference trajectory to be used by the control law. |
Definition at line 60 of file controller.cpp.
Controller::Controller | ( | ControlLaw & | _controlLaw, |
ReferenceTrajectory & | _referenceTrajectory = emptyReferenceTrajectory |
||
) |
Constructor which takes a control law and a reference trajectory for computing the control/parameter signals.
[in] | _controlLaw | Control law to be used for computing the control/parameter signals. |
[in] | _referenceTrajectory | Reference trajectory to be used by the control law. |
Definition at line 92 of file controller.cpp.
Controller::Controller | ( | const Controller & | rhs | ) |
Copy constructor (deep copy).
[in] | rhs | Right-hand side object. |
Definition at line 120 of file controller.cpp.
Controller::~Controller | ( | ) | [virtual] |
Destructor.
Definition at line 141 of file controller.cpp.
returnValue Controller::disable | ( | ) | [inline] |
Disables the controller (i.e. initial values kept and no steps are performed).
returnValue Controller::enable | ( | ) | [inline] |
Enables the controller.
returnValue Controller::feedbackStep | ( | double | currentTime, |
const DVector & | _y, | ||
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [virtual] |
Performs next feedback step of the contoller based on given inputs.
[in] | currentTime | Current time. |
[in] | _y | Most recent process output. |
[in] | _yRef | Current piece of reference trajectory (if not specified during previous preparationStep). |
Definition at line 424 of file controller.cpp.
returnValue Controller::getCurrentReference | ( | double | tStart, |
VariablesGrid & | _yRef | ||
) | const [protected, virtual] |
Returns current piece of the reference trajectory starting at given time.
[in] | tStart | Start time of reference piece. |
[out] | _yRef | Current piece of the reference trajectory. |
Definition at line 573 of file controller.cpp.
double Controller::getNextSamplingInstant | ( | double | currentTime | ) |
Determines next sampling instant of controller based on the sampling times of control law and estimator
[in] | currentTime | Current time. |
Definition at line 518 of file controller.cpp.
uint Controller::getNP | ( | ) | const [inline] |
Returns number of parameter signals computed by the controller.
uint Controller::getNU | ( | ) | const [inline] |
Returns number of control signals computed by the controller.
uint Controller::getNY | ( | ) | const [inline] |
Returns number of process outputs expected by the controller.
returnValue Controller::getP | ( | DVector & | _p | ) | const [inline] |
Returns computed parameter signals.
[out] | _y | Computed parameter signals. |
double Controller::getPreviousRealRuntime | ( | ) | [inline] |
Returns previous real runtime of the controller (e.g. for determining computational delay).
double Controller::getSamplingTimeControlLaw | ( | ) | [inline] |
Returns sampling time of control law.
double Controller::getSamplingTimeEstimator | ( | ) | [inline] |
Returns sampling time of estimator.
returnValue Controller::getU | ( | DVector & | _u | ) | const [inline] |
Returns computed control signals.
[out] | _y | Computed control signals. |
BooleanType Controller::hasDynamicControlLaw | ( | ) | const [inline] |
Returns whether controller comprises a dynamic control law.
BooleanType Controller::hasEstimator | ( | ) | const [inline] |
Returns whether controller comprises an estimator.
BooleanType Controller::hasReferenceTrajectory | ( | ) | const [inline] |
Returns whether controller comprises a build-in reference trajectory.
BooleanType Controller::hasStaticControlLaw | ( | ) | const [inline] |
Returns whether controller comprises a static control law.
returnValue Controller::init | ( | double | startTime = 0.0 , |
const DVector & | _x0 = emptyConstVector , |
||
const DVector & | _p = emptyConstVector , |
||
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [virtual] |
Initializes the controller with given start values and performs a number of consistency checks.
[in] | _startTime | Start time. |
[in] | _x0 | Initial value for differential states. |
[in] | _p | Initial value for parameters. |
[in] | _yRef | Initial value for reference trajectory. |
Definition at line 270 of file controller.cpp.
returnValue Controller::initializeAlgebraicStates | ( | const VariablesGrid & | _xa_init | ) |
Initializes algebraic states of the control law.
[in] | _xa_init | Initial value for algebraic states. |
Definition at line 246 of file controller.cpp.
returnValue Controller::initializeAlgebraicStates | ( | const char * | fileName | ) |
Initializes algebraic states of the control law from data file.
[in] | fileName | Name of file containing initial value for algebraic states. |
Definition at line 256 of file controller.cpp.
returnValue Controller::obtainEstimates | ( | double | currentTime, |
const DVector & | _y, | ||
DVector & | xEst, | ||
DVector & | pEst | ||
) | [virtual] |
Definition at line 383 of file controller.cpp.
Controller & Controller::operator= | ( | const Controller & | rhs | ) |
Assignment operator (deep copy).
[in] | rhs | Right-hand side object. |
Definition at line 154 of file controller.cpp.
returnValue Controller::preparationStep | ( | double | nextTime = 0.0 , |
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [virtual] |
Performs next preparation step of the contoller based on given inputs.
[in] | nextTime | Time at next step. |
[in] | _yRef | Piece of reference trajectory for next step (required for hotstarting). |
Definition at line 474 of file controller.cpp.
returnValue Controller::setControlLaw | ( | ControlLaw & | _controlLaw | ) |
Assigns new control law to be used for computing control/parameter signals.
[in] | _controlLaw | New control law. |
Definition at line 192 of file controller.cpp.
returnValue Controller::setEstimator | ( | Estimator & | _estimator | ) |
Assigns new estimator for estimating quantities required by the control law based on the process output.
[in] | _estimator | New estimator. |
Definition at line 209 of file controller.cpp.
returnValue Controller::setReferenceTrajectory | ( | ReferenceTrajectory & | _referenceTrajectory | ) |
Assigns new reference trajectory to be used by the control law.
[in] | _referenceTrajectory | New reference trajectory. |
Definition at line 227 of file controller.cpp.
returnValue Controller::setupLogging | ( | ) | [protected, virtual] |
Sets-up default logging information.
Reimplemented from Logging.
Definition at line 558 of file controller.cpp.
returnValue Controller::setupOptions | ( | ) | [protected, virtual] |
Sets-up default options.
Reimplemented from Options.
Definition at line 550 of file controller.cpp.
returnValue Controller::step | ( | double | currentTime, |
const DVector & | _y, | ||
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [virtual] |
Performs next step of the contoller based on given inputs.
[in] | currentTime | Current time. |
[in] | _y | Most recent process output. |
[in] | _yRef | Current piece of reference trajectory or piece of reference trajectory for next step (required for hotstarting). |
Definition at line 338 of file controller.cpp.
returnValue Controller::step | ( | double | currentTime, |
uint | dim, | ||
const double *const | _y, | ||
const VariablesGrid & | _yRef = emptyConstVariablesGrid |
||
) | [virtual] |
Performs next step of the contoller based on given inputs.
[in] | currentTime | Current time. |
[in] | dim | Dimension of process output. |
[in] | _y | Most recent process output. |
[in] | _yRef | Current piece of reference trajectory or piece of reference trajectory for next step (required for hotstarting). |
Definition at line 371 of file controller.cpp.
ControlLaw* Controller::controlLaw [protected] |
Control law (usually including a dynamic optimizer) to be used for computing the control/parameter signals.
Definition at line 424 of file controller.hpp.
RealClock Controller::controlLawClock [protected] |
Clock required to determine runtime of control law.
Definition at line 430 of file controller.hpp.
Estimator* Controller::estimator [protected] |
Estimator for estimating quantities required by the control law based on the process output.
Definition at line 425 of file controller.hpp.
BooleanType Controller::isEnabled [protected] |
Flag indicating whether controller is enabled or not.
Definition at line 428 of file controller.hpp.
ReferenceTrajectory* Controller::referenceTrajectory [protected] |
Reference trajectory to be used by the control law.
Definition at line 426 of file controller.hpp.