ACADO Toolkit
1.2.0beta
Toolkit for Automatic Control and Dynamic Optimization
|
Allows to run closed-loop simulations of dynamic systems. More...
#include <simulation_environment.hpp>
Public Member Functions | |
SimulationEnvironment () | |
Default constructor. | |
SimulationEnvironment (double _startTime, double _endTime, Process &_process, Controller &_controller) | |
Constructor which takes the name of the block and the sampling time. | |
SimulationEnvironment (const SimulationEnvironment &rhs) | |
Copy constructor (deep copy). | |
virtual | ~SimulationEnvironment () |
Destructor. | |
SimulationEnvironment & | operator= (const SimulationEnvironment &rhs) |
Assignment Operator (deep copy). | |
returnValue | setProcess (Process &_process) |
Assigns new process block to be used for simulation. | |
returnValue | setController (Controller &_controller) |
Assigns new controller block to be used for simulation. | |
returnValue | initializeAlgebraicStates (const VariablesGrid &_xa_init) |
Initializes algebraic states of the process. | |
returnValue | initializeAlgebraicStates (const char *fileName) |
Initializes algebraic states of the process from data file. | |
returnValue | init (const Vector &x0_, const Vector &p_=emptyConstVector) |
Initializes the simulation with given start values and performs a number of consistency checks. | |
returnValue | step () |
Performs next step of the simulation. | |
returnValue | step (double intermediateTime) |
Performs next steps of the simulation until given intermediate time. | |
returnValue | run () |
Runs the complete simulation. | |
uint | getNY () const |
Returns number of process outputs. | |
uint | getNU () const |
Returns number of feedback controls. | |
uint | getNP () const |
Returns number of feedback parameters. | |
uint | getNumSteps () const |
Returns current number of simulation steps. | |
returnValue | getProcessOutput (Curve &_processOutput) const |
Returns continuous output of the process. | |
returnValue | getSampledProcessOutput (VariablesGrid &_sampledProcessOutput) |
Returns output of the process at sampling instants. | |
returnValue | getProcessDifferentialStates (VariablesGrid &_diffStates) |
Returns differential states of the process over the whole simulation. | |
returnValue | getProcessAlgebraicStates (VariablesGrid &_algStates) |
Returns algebraic states of the process over the whole simulation. | |
returnValue | getProcessIntermediateStates (VariablesGrid &_interStates) |
Returns intermediate states of the process over the whole simulation. | |
returnValue | getFeedbackControl (Curve &_feedbackControl) const |
Returns feedback control signals of the controller over the whole simulation. | |
returnValue | getFeedbackControl (VariablesGrid &_sampledFeedbackControl) |
Returns feedback control signals of the controller over the whole simulation. | |
returnValue | getFeedbackParameter (Curve &_feedbackParameter) const |
Returns feedback parameter signals of the controller over the whole simulation. | |
returnValue | getFeedbackParameter (VariablesGrid &_sampledFeedbackParameter) |
Returns feedback parameter signals of the controller over the whole simulation. | |
BooleanType | isDefined () const |
Returns whether the block has been defined (i.e. | |
BlockName | getName () const |
Returns name of the block. | |
double | getSamplingTime () const |
Returns sampling time of the block. | |
returnValue | setName (BlockName _name) |
Assigns new name to the block. | |
returnValue | setSamplingTime (double _samplingTime) |
Assigns new sampling time to the block. | |
virtual int | operator<< (PlotWindow &_window) |
Adds a window to the plot collection. | |
virtual int | operator<< (LogRecord &_record) |
Adds a record to the log collection. | |
virtual int | addPlotWindow (PlotWindow &_window) |
Adds a window to the plot collection. | |
returnValue | addOptionsList () |
Adds an additional OptionsList to internal array. | |
returnValue | get (OptionsName name, int &value) const |
Returns value of an existing option item of integer type. | |
returnValue | get (OptionsName name, double &value) const |
Returns value of an existing option item of double type. | |
returnValue | get (uint idx, OptionsName name, int &value) const |
Returns value of an existing option item of integer type within the option list of given index. | |
returnValue | get (uint idx, OptionsName name, double &value) const |
Returns value of an existing option item of double type within the option list of given index. | |
returnValue | set (OptionsName name, int value) |
Sets value of an existing option item of integer type to a given value. | |
returnValue | set (OptionsName name, double value) |
Sets value of an existing option item of double type to a given value. | |
returnValue | set (uint idx, OptionsName name, int value) |
Sets value of an existing option item of integer type within the option list of given index to a given value. | |
returnValue | set (uint idx, OptionsName name, double value) |
Sets value of an existing option item of double type within the option list of given index to a given value. | |
returnValue | setOptions (const Options &arg) |
Assigns a given Options object to this object. | |
returnValue | setOptions (uint idx, const Options &arg) |
Assigns the option list with given index of a given Options object to option list with given index of this object. | |
Options | getOptions (uint idx) const |
Returns an Options object containing exactly the option list with given index. | |
uint | getNumOptionsLists () const |
Returns total number of option lists. | |
returnValue | printOptionsList () const |
Prints a list of all available options of all option lists. | |
returnValue | printOptionsList (uint idx) const |
Prints a list of all available options of option list with given index. | |
int | addLogRecord (LogRecord &record) |
Adds a record to the log collection. | |
returnValue | getLogRecord (uint idx, LogRecord &_record) const |
Returns the record with given index from the log collection. | |
returnValue | getLogRecord (LogRecord &_record) const |
Returns the record with certain index from the log collection. | |
returnValue | updateLogRecord (LogRecord &_record) const |
Updates all items with the record given as argument. | |
returnValue | getAll (LogName _name, MatrixVariablesGrid &values) const |
Gets all numerical values at all time instants of the item with given name. | |
returnValue | getFirst (LogName _name, Matrix &firstValue) const |
Gets numerical value at first time instant of the item with given name. | |
returnValue | getFirst (LogName _name, VariablesGrid &firstValue) const |
Gets numerical value at first time instant of the item with given name (converts internally used Matrix into VariablesGrid). | |
returnValue | getLast (LogName _name, Matrix &lastValue) const |
Gets numerical value at last time instant of the item with given name. | |
returnValue | getLast (LogName _name, VariablesGrid &lastValue) const |
Gets numerical value at last time instant of the item with given name (converts internally used Matrix into VariablesGrid). | |
uint | getNumLogRecords () const |
Returns number of records contained in the log collection. | |
returnValue | printLoggingInfo () const |
Prints information on all records and their items on screen. | |
returnValue | printNumDoubles () const |
returnValue | getPlotWindow (uint idx, PlotWindow &_window) const |
Returns the window with given index from the plot collection. | |
returnValue | getPlotWindow (PlotWindow &_window) const |
Returns the window with certain index from the plot collection. | |
virtual returnValue | plot (PlotFrequency _frequency=PLOT_IN_ANY_CASE) |
Plots all windows of the plot collection, each one into a new figure. | |
virtual returnValue | replot (PlotFrequency _frequency=PLOT_IN_ANY_CASE) |
Plots all windows of the plot collection, each one into the corresponding existing figure, if possible. | |
uint | getNumPlotWindows () const |
Returns number of windows contained in the plot collection. | |
Protected Member Functions | |
virtual returnValue | setupOptions () |
Sets-up default options. | |
virtual returnValue | setupLogging () |
Sets-up default logging information. | |
double | determineComputationalDelay (double controllerRuntime) const |
Returns computational delay used for simulation based on the actual real controller runtime and the options set by the user. | |
virtual returnValue | getPlotDataFromMemberLoggings (PlotWindow &_window) const |
Copies all collected logging information required to plot a given window. | |
BlockStatus | getStatus () const |
Gets current status of user interface. | |
returnValue | setStatus (BlockStatus _status) |
Sets status of user interface. | |
returnValue | clearOptionsList () |
Clears all option lists from array. | |
BooleanType | haveOptionsChanged () const |
Determines whether options of at least one option list have been modified. | |
BooleanType | haveOptionsChanged (uint idx) const |
Determines whether options of option list with given index have been modified. | |
returnValue | declareOptionsUnchanged () |
Declares all options of all option lists to be unchanged. | |
returnValue | declareOptionsUnchanged (uint idx) |
Declares all options of option list with given index to be unchanged. | |
returnValue | addOption (OptionsName name, int value) |
Add an option item with a given integer default value to the all option lists. | |
returnValue | addOption (OptionsName name, double value) |
Add an option item with a given double default value to the all option lists. | |
returnValue | addOption (uint idx, OptionsName name, int value) |
Add an option item with a given integer default value to option list with given index. | |
returnValue | addOption (uint idx, OptionsName name, double value) |
Add an option item with a given double default value to option list with given index. | |
Protected Attributes | |
double | startTime |
Start time of the simulation. | |
double | endTime |
End time of the simulation. | |
Process * | process |
Pointer to Process used for simulating the dynamic system. | |
Controller * | controller |
Pointer to Controller used for controlling the dynamic system. | |
SimulationClock | simulationClock |
Clock for managing the simulation time. | |
Curve | processOutput |
Curve storing output of the Process during the whole simulation. | |
Curve | feedbackControl |
Curve storing control signals from the Controller during the whole simulation. | |
Curve | feedbackParameter |
Curve storing parameter signals from the Controller during the whole simulation. | |
uint | nSteps |
Number of simulation steps (loops) that have been performed. | |
BlockName | name |
Name of the block, see documentation of BlockName for details. | |
double | samplingTime |
Sampling time of the block. | |
RealClock | realClock |
Clock for real time measurements to be optionally used in derived classes. | |
BlockStatus | status |
Current status of the user interface, see documentation of BlockStatus for details. | |
OptionsList ** | optionsList |
Array consisting of OptionsLists. | |
uint | nOptionsList |
Total number of OptionsLists. | |
LogCollection | logCollection |
Log collection containing a singly-linked list of log records. | |
int | logIdx |
Index of a certain log record to be optionally used within derived classes. | |
PlotCollection | plotCollection |
Plot collection containing a singly-linked list of plot windows. |
The class Simulation Environment is designed to run closed-loop simulations of dynamic systems.
In a standard setup the Simulation Environment consists of a Process and a Controller that are connected by signals. These two main members can be specified within the constructor or set afterwards by using the methods "setController" and "setProcess" , respectively.
A simulation has to be initialized by providing the initial value of the differential states of the dynamic system to be simulated. Afterwards, the simulation can be run at once or stepped until a given intermediate time.
References BS_NOT_INITIALIZED, controller, endTime, nSteps, process, UserInteraction::setStatus(), setupLogging(), setupOptions(), and startTime.
SimulationEnvironment::SimulationEnvironment | ( | double | _startTime, |
double | _endTime, | ||
Process & | _process, | ||
Controller & | _controller | ||
) |
[in] | _startTime | Start time of the simulation. |
[in] | _endTime | End time of the simulation. |
[in] | _process | Process used for simulating the dynamic system. |
[in] | _controller | Controller used for controlling the dynamic system. |
References BS_NOT_INITIALIZED, BT_TRUE, controller, endTime, SimulationBlock::isDefined(), nSteps, process, UserInteraction::setStatus(), setupLogging(), setupOptions(), and startTime.
[in] | rhs | Right-hand side object. |
References controller, endTime, feedbackControl, feedbackParameter, nSteps, process, processOutput, simulationClock, and startTime.
SimulationEnvironment::~SimulationEnvironment | ( | ) | [virtual] |
int Logging::addLogRecord | ( | LogRecord & | record | ) | [inherited] |
[in] | record | Record to be added. |
References LogCollection::addLogRecord(), and Logging::logCollection.
Referenced by AlgorithmicBase::addLogRecord(), UserInteraction::addPlotWindow(), Logging::operator<<(), IntegrationAlgorithm::setupLogging(), Controller::setupLogging(), and Process::setupLogging().
returnValue Options::addOption | ( | OptionsName | name, |
int | value | ||
) | [protected, inherited] |
[in] | name | Name of new option item. |
[in] | value | Default value of new option. |
References OptionsList::add(), Options::getNumOptionsLists(), Options::optionsList, SUCCESSFUL_RETURN, and uint.
Referenced by AlgorithmicBase::addOption(), OptimizationAlgorithm::setupOptions(), ExportModule::setupOptions(), MultiObjectiveAlgorithm::setupOptions(), RealTimeAlgorithm::setupOptions(), setupOptions(), IntegrationAlgorithm::setupOptions(), Controller::setupOptions(), and Process::setupOptions().
returnValue Options::addOption | ( | OptionsName | name, |
double | value | ||
) | [protected, inherited] |
[in] | name | Name of new option item. |
[in] | value | Default value of new option. |
References OptionsList::add(), Options::getNumOptionsLists(), Options::optionsList, SUCCESSFUL_RETURN, and uint.
returnValue Options::addOption | ( | uint | idx, |
OptionsName | name, | ||
int | value | ||
) | [protected, inherited] |
[in] | idx | Index of option list. |
[in] | name | Name of new option item. |
[in] | value | Default value of new option. |
References ACADOERROR, OptionsList::add(), Options::getNumOptionsLists(), Options::optionsList, and RET_INDEX_OUT_OF_BOUNDS.
returnValue Options::addOption | ( | uint | idx, |
OptionsName | name, | ||
double | value | ||
) | [protected, inherited] |
[in] | idx | Index of option list. |
[in] | name | Name of new option item. |
[in] | value | Default value of new option. |
References ACADOERROR, OptionsList::add(), Options::getNumOptionsLists(), Options::optionsList, and RET_INDEX_OUT_OF_BOUNDS.
returnValue Options::addOptionsList | ( | ) | [inherited] |
References Options::nOptionsList, Options::optionsList, and SUCCESSFUL_RETURN.
Referenced by AlgorithmicBase::addOptionsList().
int UserInteraction::addPlotWindow | ( | PlotWindow & | _window | ) | [virtual, inherited] |
This function is overloaded here in order to add the plotDataRecord required to plot the window to the log collection.
[in] | _window | Window to be added. |
Reimplemented from Plotting.
References Logging::addLogRecord(), PlotWindow::getPlotDataRecord(), and PlotWindow::setPlotDataRecord().
Referenced by UserInteraction::operator<<().
returnValue Options::clearOptionsList | ( | ) | [protected, inherited] |
References Options::getNumOptionsLists(), Options::optionsList, SUCCESSFUL_RETURN, and uint.
Referenced by Options::operator=(), and Options::~Options().
returnValue Options::declareOptionsUnchanged | ( | ) | [protected, inherited] |
References OptionsList::declareOptionsUnchanged(), Options::getNumOptionsLists(), Options::optionsList, SUCCESSFUL_RETURN, and uint.
Referenced by OptimizationAlgorithm::init(), and RealTimeAlgorithm::init().
returnValue Options::declareOptionsUnchanged | ( | uint | idx | ) | [protected, inherited] |
[in] | idx | Index of option list. |
References ACADOERROR, OptionsList::declareOptionsUnchanged(), Options::getNumOptionsLists(), Options::optionsList, and RET_INDEX_OUT_OF_BOUNDS.
double SimulationEnvironment::determineComputationalDelay | ( | double | controllerRuntime | ) | const [protected] |
[in] | controllerRuntime | Real controller runtime. |
References acadoMax(), ACADOWARNING, BT_TRUE, COMPUTATIONAL_DELAY_FACTOR, COMPUTATIONAL_DELAY_OFFSET, RET_COMPUTATIONAL_DELAY_NOT_SUPPORTED, and SIMULATE_COMPUTATIONAL_DELAY.
Referenced by step().
returnValue Options::get | ( | OptionsName | name, |
int & | value | ||
) | const [inherited] |
[in] | name | Name of option item. |
[out] | value | Value of option. |
References OptionsList::get(), and Options::optionsList.
Referenced by createDiagonallyImplicitRKExport(), createImplicitRungeKuttaExport(), AlgorithmicBase::get(), ExplicitRungeKuttaExport::getCode(), ExplicitRungeKuttaExport::getFunctionDeclarations(), ExplicitRungeKuttaExport::setDifferentialEquation(), ExportHouseholderQR::setup(), ExportGaussElim::setup(), ImplicitRungeKuttaExport::setup(), and OptimizationAlgorithmBase::setupDynamicDiscretization().
returnValue Options::get | ( | OptionsName | name, |
double & | value | ||
) | const [inherited] |
[in] | name | Name of option item. |
[out] | value | Value of option. |
References OptionsList::get(), and Options::optionsList.
returnValue Options::get | ( | uint | idx, |
OptionsName | name, | ||
int & | value | ||
) | const [inherited] |
[in] | idx | Index of option list. |
[in] | name | Name of option item. |
[out] | value | Value of option. |
References ACADOERROR, OptionsList::get(), Options::getNumOptionsLists(), Options::optionsList, and RET_INDEX_OUT_OF_BOUNDS.
returnValue Options::get | ( | uint | idx, |
OptionsName | name, | ||
double & | value | ||
) | const [inherited] |
[in] | idx | Index of option list. |
[in] | name | Name of option item. |
[out] | value | Value of option. |
References ACADOERROR, OptionsList::get(), Options::getNumOptionsLists(), Options::optionsList, and RET_INDEX_OUT_OF_BOUNDS.
BEGIN_NAMESPACE_ACADO returnValue Logging::getAll | ( | LogName | _name, |
MatrixVariablesGrid & | values | ||
) | const [inline, inherited] |
If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | values | All numerical values at all time instants of given item. |
References ACADOERROR, BT_TRUE, LogCollection::getAll(), LogCollection::hasNonEmptyItem(), Logging::logCollection, and RET_LOG_ENTRY_DOESNT_EXIST.
Referenced by AlgorithmicBase::getAll(), getProcessAlgebraicStates(), getProcessDifferentialStates(), and getProcessIntermediateStates().
returnValue SimulationEnvironment::getFeedbackControl | ( | Curve & | _feedbackControl | ) | const [inline] |
[out] | _feedbackControl | Feedback control signals of the controller. |
References feedbackControl, and SUCCESSFUL_RETURN.
returnValue SimulationEnvironment::getFeedbackControl | ( | VariablesGrid & | _sampledFeedbackControl | ) | [inline] |
[out] | _sampledFeedbackControl | Feedback control signals of the controller. |
References ACADOERROR, BT_TRUE, Curve::discretize(), endTime, feedbackControl, getNumSteps(), Curve::isEmpty(), RET_MEMBER_NOT_INITIALISED, MatrixVariablesGrid::setType(), startTime, SUCCESSFUL_RETURN, and VT_CONTROL.
returnValue SimulationEnvironment::getFeedbackParameter | ( | Curve & | _feedbackParameter | ) | const [inline] |
[out] | _feedbackParameter | Feedback parameter signals of the controller. |
References feedbackParameter, and SUCCESSFUL_RETURN.
returnValue SimulationEnvironment::getFeedbackParameter | ( | VariablesGrid & | _sampledFeedbackParameter | ) | [inline] |
[out] | _sampledFeedbackParameter | Feedback parameter signals of the controller. |
References Curve::discretize(), endTime, EPS, feedbackParameter, getNumSteps(), MatrixVariablesGrid::setType(), startTime, SUCCESSFUL_RETURN, and VT_PARAMETER.
returnValue Logging::getFirst | ( | LogName | _name, |
Matrix & | firstValue | ||
) | const [inline, inherited] |
If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | firstValue | Numerical value at first time instant of given item. |
References ACADOERROR, BT_TRUE, LogCollection::getFirst(), LogCollection::hasNonEmptyItem(), Logging::logCollection, and RET_LOG_ENTRY_DOESNT_EXIST.
Referenced by AlgorithmicBase::getFirst().
returnValue Logging::getFirst | ( | LogName | _name, |
VariablesGrid & | firstValue | ||
) | const [inline, inherited] |
If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | firstValue | Numerical value at first time instant of given item. |
References ACADOERROR, BT_TRUE, LogCollection::getFirst(), LogCollection::hasNonEmptyItem(), Logging::logCollection, and RET_LOG_ENTRY_DOESNT_EXIST.
returnValue Logging::getLast | ( | LogName | _name, |
Matrix & | lastValue | ||
) | const [inline, inherited] |
If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | lastValue | Numerical value at last time instant of given item. |
References ACADOERROR, BT_TRUE, LogCollection::getLast(), LogCollection::hasNonEmptyItem(), Logging::logCollection, and RET_LOG_ENTRY_DOESNT_EXIST.
Referenced by AlgorithmicBase::getLast().
returnValue Logging::getLast | ( | LogName | _name, |
VariablesGrid & | lastValue | ||
) | const [inline, inherited] |
If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | lastValue | Numerical value at last time instant of given item. |
References ACADOERROR, BT_TRUE, LogCollection::getLast(), LogCollection::hasNonEmptyItem(), Logging::logCollection, and RET_LOG_ENTRY_DOESNT_EXIST.
returnValue Logging::getLogRecord | ( | uint | idx, |
LogRecord & | _record | ||
) | const [inherited] |
[in] | idx | Index of desired record. |
[out] | _record | Desired record. |
References ACADOERROR, Logging::getNumLogRecords(), Logging::logCollection, RET_INDEX_OUT_OF_BOUNDS, and SUCCESSFUL_RETURN.
Referenced by Logging::getLogRecord().
returnValue Logging::getLogRecord | ( | LogRecord & | _record | ) | const [inherited] |
This index is not provided when calling the function, but rather obtained by using the alias index of the record. If the record is no alias record, the error RET_INDEX_OUT_OF_BOUNDS is thrown.
[out] | _record | Desired record. |
References LogRecord::getAliasIdx(), and Logging::getLogRecord().
BlockName SimulationBlock::getName | ( | ) | const [inline, inherited] |
References SimulationBlock::name.
uint SimulationEnvironment::getNP | ( | ) | const [inline] |
References controller, and Controller::getNP().
uint SimulationEnvironment::getNU | ( | ) | const [inline] |
References controller, and Controller::getNU().
uint Logging::getNumLogRecords | ( | ) | const [inherited] |
References LogCollection::getNumLogRecords(), and Logging::logCollection.
Referenced by Logging::getLogRecord().
BEGIN_NAMESPACE_ACADO uint Options::getNumOptionsLists | ( | ) | const [inline, inherited] |
References Options::nOptionsList.
Referenced by Options::addOption(), Options::clearOptionsList(), Options::declareOptionsUnchanged(), Options::get(), Options::getOptions(), Options::haveOptionsChanged(), Options::printOptionsList(), Options::set(), and Options::setOptions().
uint Plotting::getNumPlotWindows | ( | ) | const [inline, inherited] |
References PlotCollection::getNumPlotWindows(), and Plotting::plotCollection.
Referenced by Plotting::getPlotWindow().
uint SimulationEnvironment::getNumSteps | ( | ) | const [inline] |
References nSteps.
Referenced by getFeedbackControl(), and getFeedbackParameter().
BEGIN_NAMESPACE_ACADO uint SimulationEnvironment::getNY | ( | ) | const [inline] |
References Process::getNY(), and process.
Options Options::getOptions | ( | uint | idx | ) | const [inherited] |
[in] | idx | Index of option list. |
References ACADOERROR, Options::getNumOptionsLists(), Options::Options(), Options::optionsList, and RET_INDEX_OUT_OF_BOUNDS.
Referenced by AlgorithmicBase::getOptions().
returnValue UserInteraction::getPlotDataFromMemberLoggings | ( | PlotWindow & | _window | ) | const [protected, virtual, inherited] |
This function is overloaded within the UserInterface class to syncronize the logging information collected elsewhere within the algorithm with the one stored within the given window for plotting.
[in] | _window | Window to be plotted. |
Reimplemented from Plotting.
References PlotWindow::getPlotDataRecord(), PlotWindow::setPlotDataRecord(), SUCCESSFUL_RETURN, and Logging::updateLogRecord().
returnValue Plotting::getPlotWindow | ( | uint | idx, |
PlotWindow & | _window | ||
) | const [inline, inherited] |
[in] | idx | Index of desired window. |
[out] | _window | Desired window. |
References ACADOERROR, Plotting::getNumPlotWindows(), Plotting::getPlotDataFromMemberLoggings(), Plotting::plotCollection, and RET_INDEX_OUT_OF_BOUNDS.
Referenced by Plotting::getPlotWindow(), Plotting::plot(), and Plotting::replot().
returnValue Plotting::getPlotWindow | ( | PlotWindow & | _window | ) | const [inline, inherited] |
This index is not provided when calling the function, but rather obtained by using the alias index of the window. If the window is no alias window, the error RET_INDEX_OUT_OF_BOUNDS is thrown.
[out] | _window | Desired window. |
References PlotWindow::getAliasIdx(), and Plotting::getPlotWindow().
returnValue SimulationEnvironment::getProcessAlgebraicStates | ( | VariablesGrid & | _algStates | ) | [inline] |
[out] | _algStates | Algebraic states of the process. |
References ACADOERROR, VariablesGrid::appendTimes(), Logging::getAll(), MatrixVariablesGrid::getMatrix(), Grid::getNumPoints(), VariablesGrid::init(), LOG_ALGEBRAIC_STATES, process, RET_MEMBER_NOT_INITIALISED, MatrixVariablesGrid::setType(), SUCCESSFUL_RETURN, and VT_ALGEBRAIC_STATE.
returnValue SimulationEnvironment::getProcessDifferentialStates | ( | VariablesGrid & | _diffStates | ) | [inline] |
[out] | _diffStates | Differential states of the process. |
References ACADOERROR, VariablesGrid::appendTimes(), Logging::getAll(), MatrixVariablesGrid::getMatrix(), Grid::getNumPoints(), VariablesGrid::init(), LOG_DIFFERENTIAL_STATES, process, RET_MEMBER_NOT_INITIALISED, MatrixVariablesGrid::setType(), SUCCESSFUL_RETURN, and VT_DIFFERENTIAL_STATE.
returnValue SimulationEnvironment::getProcessIntermediateStates | ( | VariablesGrid & | _interStates | ) | [inline] |
[out] | _interStates | Intermediate states of the process. |
References ACADOERROR, VariablesGrid::appendTimes(), Logging::getAll(), MatrixVariablesGrid::getMatrix(), Grid::getNumPoints(), VariablesGrid::init(), LOG_INTERMEDIATE_STATES, process, RET_MEMBER_NOT_INITIALISED, MatrixVariablesGrid::setType(), SUCCESSFUL_RETURN, and VT_INTERMEDIATE_STATE.
returnValue SimulationEnvironment::getProcessOutput | ( | Curve & | _processOutput | ) | const [inline] |
[out] | _processOutput | Continuous output of the process. |
References processOutput, and SUCCESSFUL_RETURN.
returnValue SimulationEnvironment::getSampledProcessOutput | ( | VariablesGrid & | _sampledProcessOutput | ) | [inline] |
[out] | _sampledProcessOutput | Sampled output of the process. |
References Matrix::appendRows(), LogRecord::getAll(), MatrixVariablesGrid::getMatrix(), Grid::getNumPoints(), LOG_PROCESS_OUTPUT, process, MatrixVariablesGrid::setType(), SUCCESSFUL_RETURN, uint, Logging::updateLogRecord(), and VT_OUTPUT.
double SimulationBlock::getSamplingTime | ( | ) | const [inline, inherited] |
References SimulationBlock::samplingTime.
Referenced by PIDcontroller::determineControlAction(), Controller::getSamplingTimeControlLaw(), Controller::getSamplingTimeEstimator(), Process::init(), RealTimeAlgorithm::shift(), RealTimeAlgorithm::step(), and Controller::step().
BlockStatus UserInteraction::getStatus | ( | ) | const [protected, inherited] |
References UserInteraction::status.
Referenced by RealTimeAlgorithm::feedbackStep(), OptimizationAlgorithm::init(), RealTimeAlgorithm::init(), RealTimeAlgorithm::performFeedbackStep(), RealTimeAlgorithm::performPreparationStep(), OCPexport::printDimensionsQP(), Process::run(), setController(), Controller::setEstimator(), RealTimeAlgorithm::setReference(), Controller::setReferenceTrajectory(), OCPexport::setup(), OptimizationAlgorithm::solve(), RealTimeAlgorithm::solve(), LinearStateFeedback::step(), FeedforwardLaw::step(), PIDcontroller::step(), Sensor::step(), step(), Controller::step(), Process::step(), and Actuator::step().
BooleanType Options::haveOptionsChanged | ( | ) | const [protected, inherited] |
References BT_FALSE, BT_TRUE, Options::getNumOptionsLists(), Options::optionsList, and uint.
Referenced by AlgorithmicBase::haveOptionsChanged(), OptimizationAlgorithm::init(), RealTimeAlgorithm::init(), and OptimizationAlgorithm::solve().
BooleanType Options::haveOptionsChanged | ( | uint | idx | ) | const [protected, inherited] |
[in] | idx | Index of option list. |
References ACADOERROR, BT_FALSE, Options::getNumOptionsLists(), OptionsList::haveOptionsChanged(), Options::optionsList, and RET_INDEX_OUT_OF_BOUNDS.
returnValue SimulationEnvironment::init | ( | const Vector & | x0_, |
const Vector & | p_ = emptyConstVector |
||
) |
[in] | x0_ | Initial value for differential states. |
[in] | p_ | Initial value for parameters. |
References ACADOERROR, acadoPrintf(), Curve::add(), BS_READY, controller, EPS, feedbackControl, feedbackParameter, getNP(), Controller::getNP(), Process::getNP(), getNU(), Controller::getNU(), Process::getNU(), getNY(), Controller::getNY(), Process::getNY(), Controller::getP(), Controller::getU(), VariablesGrid::getVector(), Process::getY(), HIGH, Clock::init(), Controller::init(), Process::init(), PRINTLEVEL, process, processOutput, RET_BLOCK_DIMENSION_MISMATCH, RET_ENVIRONMENT_INIT_FAILED, RET_NO_CONTROLLER_SPECIFIED, RET_NO_PROCESS_SPECIFIED, UserInteraction::setStatus(), simulationClock, startTime, and SUCCESSFUL_RETURN.
returnValue SimulationEnvironment::initializeAlgebraicStates | ( | const VariablesGrid & | _xa_init | ) |
[in] | _xa_init | Initial value for algebraic states. |
References controller, VariablesGrid::getVector(), Controller::initializeAlgebraicStates(), Process::initializeAlgebraicStates(), process, and SUCCESSFUL_RETURN.
Referenced by initializeAlgebraicStates().
returnValue SimulationEnvironment::initializeAlgebraicStates | ( | const char * | fileName | ) |
[in] | fileName | Name of file containing initial value for algebraic states. |
References ACADOERROR, BT_TRUE, initializeAlgebraicStates(), Grid::isEmpty(), and RET_FILE_CAN_NOT_BE_OPENED.
BEGIN_NAMESPACE_ACADO BooleanType SimulationBlock::isDefined | ( | ) | const [inline, inherited] |
setup properly).
References BS_UNDEFINED, BT_FALSE, BT_TRUE, and UserInteraction::status.
Referenced by Controller::Controller(), Process::setActuator(), Controller::setControlLaw(), setController(), Controller::setEstimator(), setProcess(), Process::setSensor(), and SimulationEnvironment().
int UserInteraction::operator<< | ( | PlotWindow & | _window | ) | [virtual, inherited] |
This function is overloaded here in order to add the plotDataRecord required to plot the window to the log collection.
[in] | _window | Window to be added. |
Reimplemented from Plotting.
References UserInteraction::addPlotWindow().
Referenced by UserInteraction::operator<<().
int UserInteraction::operator<< | ( | LogRecord & | _record | ) | [virtual, inherited] |
[in] | record | Record to be added. |
Reimplemented from Logging.
References UserInteraction::operator<<().
SimulationEnvironment & SimulationEnvironment::operator= | ( | const SimulationEnvironment & | rhs | ) |
[in] | rhs | Right-hand side object. |
References controller, endTime, feedbackControl, feedbackParameter, nSteps, process, processOutput, simulationClock, and startTime.
returnValue Plotting::plot | ( | PlotFrequency | _frequency = PLOT_IN_ANY_CASE | ) | [virtual, inherited] |
[in] | _frequency | Frequency determining at which time instants the window is to be plotted. |
References ACADOERROR, PlotCollection::first, PlotWindow::getNext(), Plotting::getPlotWindow(), PlotWindow::plot(), PLOT_NEVER, Plotting::plotCollection, RET_PLOTTING_FAILED, and SUCCESSFUL_RETURN.
Referenced by IntegrationAlgorithm::evaluate(), and AlgorithmicBase::plot().
returnValue Logging::printLoggingInfo | ( | ) | const [inherited] |
References LogCollection::getNumLogRecords(), Logging::logCollection, SUCCESSFUL_RETURN, and uint.
returnValue Logging::printNumDoubles | ( | ) | const [inherited] |
References LogCollection::getNumDoubles(), Logging::logCollection, and SUCCESSFUL_RETURN.
returnValue Options::printOptionsList | ( | ) | const [inherited] |
References Options::getNumOptionsLists(), Options::optionsList, OptionsList::printOptionsList(), SUCCESSFUL_RETURN, and uint.
returnValue Options::printOptionsList | ( | uint | idx | ) | const [inherited] |
[in] | idx | Index of option list. |
References ACADOERROR, Options::getNumOptionsLists(), Options::optionsList, OptionsList::printOptionsList(), and RET_INDEX_OUT_OF_BOUNDS.
returnValue Plotting::replot | ( | PlotFrequency | _frequency = PLOT_IN_ANY_CASE | ) | [virtual, inherited] |
[in] | _frequency | Frequency determining at which time instants the window is to be plotted. |
Reimplemented in Process.
References ACADOERROR, PlotCollection::first, PlotWindow::getNext(), Plotting::getPlotWindow(), PLOT_NEVER, Plotting::plotCollection, PlotWindow::replot(), RET_PLOTTING_FAILED, and SUCCESSFUL_RETURN.
Referenced by AlgorithmicBase::replot(), and RealTimeAlgorithm::solve().
returnValue Options::set | ( | OptionsName | name, |
int | value | ||
) | [inherited] |
[in] | name | Name of option item. |
[in] | value | New value of option. |
References Options::optionsList, and OptionsList::set().
Referenced by AlgorithmicBase::set().
returnValue Options::set | ( | OptionsName | name, |
double | value | ||
) | [inherited] |
[in] | name | Name of option item. |
[in] | value | New value of option. |
References Options::optionsList, and OptionsList::set().
returnValue Options::set | ( | uint | idx, |
OptionsName | name, | ||
int | value | ||
) | [inherited] |
[in] | idx | Index of option list. |
[in] | name | Name of option item. |
[in] | value | New value of option. |
References ACADOERROR, Options::getNumOptionsLists(), Options::optionsList, RET_INDEX_OUT_OF_BOUNDS, and OptionsList::set().
returnValue Options::set | ( | uint | idx, |
OptionsName | name, | ||
double | value | ||
) | [inherited] |
[in] | idx | Index of option list. |
[in] | name | Name of option item. |
[in] | value | New value of option. |
References ACADOERROR, Options::getNumOptionsLists(), Options::optionsList, RET_INDEX_OUT_OF_BOUNDS, and OptionsList::set().
returnValue SimulationEnvironment::setController | ( | Controller & | _controller | ) |
[in] | _controller | New controller block. |
References BS_NOT_INITIALIZED, BT_TRUE, controller, UserInteraction::getStatus(), SimulationBlock::isDefined(), UserInteraction::setStatus(), and SUCCESSFUL_RETURN.
returnValue SimulationBlock::setName | ( | BlockName | _name | ) | [inline, inherited] |
[in] | _name | New name. |
References SimulationBlock::name, and SUCCESSFUL_RETURN.
Referenced by SimulationBlock::operator=(), and SimulationBlock::SimulationBlock().
returnValue Options::setOptions | ( | const Options & | arg | ) | [inherited] |
[in] | arg | New Options object to be assigned. |
References Options::operator=(), and SUCCESSFUL_RETURN.
Referenced by AlgorithmicBase::setOptions().
returnValue Options::setOptions | ( | uint | idx, |
const Options & | arg | ||
) | [inherited] |
[in] | idx | Index of option list. |
[in] | arg | Options object containing the option list to be assigned. |
References ACADOERROR, Options::getNumOptionsLists(), Options::optionsList, RET_INDEX_OUT_OF_BOUNDS, and SUCCESSFUL_RETURN.
returnValue SimulationEnvironment::setProcess | ( | Process & | _process | ) |
[in] | _process | New process block. |
References BS_NOT_INITIALIZED, BT_TRUE, SimulationBlock::isDefined(), process, UserInteraction::setStatus(), and SUCCESSFUL_RETURN.
returnValue SimulationBlock::setSamplingTime | ( | double | _samplingTime | ) | [inline, inherited] |
[in] | _samplingTime | New sampling time. |
References ACADOERROR, acadoIsGreater(), BT_TRUE, RET_INVALID_ARGUMENTS, SimulationBlock::samplingTime, and SUCCESSFUL_RETURN.
Referenced by SimulationBlock::operator=(), and SimulationBlock::SimulationBlock().
returnValue UserInteraction::setStatus | ( | BlockStatus | _status | ) | [protected, inherited] |
[in] | _status | New status of user interface |
References UserInteraction::status, and SUCCESSFUL_RETURN.
Referenced by Controller::Controller(), DynamicEstimator::DynamicEstimator(), Estimator::Estimator(), FeedforwardLaw::FeedforwardLaw(), KalmanFilter::init(), Estimator::init(), OptimizationAlgorithm::init(), DynamicEstimator::init(), LinearStateFeedback::init(), FeedforwardLaw::init(), RealTimeAlgorithm::init(), TransferDevice::init(), PIDcontroller::init(), init(), Controller::init(), Process::init(), Process::initializeStartValues(), IntegrationAlgorithm::IntegrationAlgorithm(), KalmanFilter::KalmanFilter(), LinearStateFeedback::LinearStateFeedback(), OCPexport::OCPexport(), UserInteraction::operator=(), OptimizationAlgorithm::OptimizationAlgorithm(), RealTimeAlgorithm::performFeedbackStep(), RealTimeAlgorithm::performPreparationStep(), PIDcontroller::PIDcontroller(), Process::Process(), RealTimeAlgorithm::RealTimeAlgorithm(), Process::setActuator(), Controller::setControlLaw(), setController(), Process::setDynamicSystem(), Controller::setEstimator(), setProcess(), Process::setProcessDisturbance(), Controller::setReferenceTrajectory(), Process::setSensor(), OCPexport::setup(), SIMexport::setup(), SIMexport::SIMexport(), SimulationEnvironment(), MultiObjectiveAlgorithm::solve(), MultiObjectiveAlgorithm::solveSingleObjective(), TransferDevice::TransferDevice(), and UserInteraction::UserInteraction().
returnValue SimulationEnvironment::setupLogging | ( | ) | [protected, virtual] |
Reimplemented from Logging.
References SUCCESSFUL_RETURN.
Referenced by SimulationEnvironment().
returnValue SimulationEnvironment::setupOptions | ( | ) | [protected, virtual] |
Reimplemented from Options.
References Options::addOption(), COMPUTATIONAL_DELAY_FACTOR, COMPUTATIONAL_DELAY_OFFSET, defaultComputationalDelayFactor, defaultComputationalDelayOffset, defaultPrintlevel, defaultSimulateComputationalDelay, PRINTLEVEL, SIMULATE_COMPUTATIONAL_DELAY, and SUCCESSFUL_RETURN.
Referenced by SimulationEnvironment().
References ACADOERROR, acadoIsEqual(), acadoPrintf(), Curve::add(), BS_READY, BT_TRUE, controller, determineComputationalDelay(), endTime, EPS, Curve::evaluate(), fabs(), feedbackControl, feedbackParameter, Controller::getNextSamplingInstant(), getNP(), getNU(), getNY(), Controller::getP(), Controller::getPreviousRealRuntime(), UserInteraction::getStatus(), Clock::getTime(), Controller::getU(), Process::getY(), HIGH, IM_CONSTANT, IM_LINEAR, Clock::init(), nSteps, VectorspaceElement::print(), returnValue::print(), PRINTLEVEL, process, processOutput, RET_BLOCK_NOT_READY, RET_COMPUTATIONAL_DELAY_TOO_BIG, RET_ENVIRONMENT_STEP_FAILED, Grid::setTime(), VariablesGrid::setVector(), simulationClock, Controller::step(), Process::step(), SUCCESSFUL_RETURN, VT_CONTROL, and VT_PARAMETER.
returnValue SimulationEnvironment::step | ( | double | intermediateTime | ) |
[in] | intermediateTime | Intermediate time. |
References ACADOERROR, endTime, Clock::getTime(), RET_INVALID_ARGUMENTS, simulationClock, startTime, step(), and SUCCESSFUL_RETURN.
returnValue Logging::updateLogRecord | ( | LogRecord & | _record | ) | const [inherited] |
In doing so, it is checked for each item whether it is contained within one of of the records of the collection; and if so, the numerical values are copied into the argument record.
[in,out] | _record | Record to be updated |
References Logging::logCollection, and LogCollection::updateLogRecord().
Referenced by UserInteraction::getPlotDataFromMemberLoggings(), and getSampledProcessOutput().
Controller* SimulationEnvironment::controller [protected] |
Referenced by getNP(), getNU(), init(), initializeAlgebraicStates(), operator=(), setController(), SimulationEnvironment(), and step().
double SimulationEnvironment::endTime [protected] |
Referenced by getFeedbackControl(), getFeedbackParameter(), operator=(), run(), SimulationEnvironment(), and step().
Curve SimulationEnvironment::feedbackControl [protected] |
Referenced by getFeedbackControl(), init(), operator=(), SimulationEnvironment(), and step().
Curve SimulationEnvironment::feedbackParameter [protected] |
Referenced by getFeedbackParameter(), init(), operator=(), SimulationEnvironment(), and step().
LogCollection Logging::logCollection [protected, inherited] |
Referenced by Logging::addLogRecord(), Logging::getAll(), Logging::getFirst(), Logging::getLast(), Logging::getLogRecord(), Logging::getNumLogRecords(), Logging::Logging(), Controller::obtainEstimates(), Logging::operator=(), Controller::preparationStep(), Logging::printLoggingInfo(), AlgorithmicBase::printLogRecord(), Logging::printNumDoubles(), AlgorithmicBase::setAll(), AlgorithmicBase::setLast(), Process::simulate(), Controller::step(), Process::step(), and Logging::updateLogRecord().
int Logging::logIdx [protected, inherited] |
Referenced by Logging::Logging(), Logging::operator=(), and IntegrationAlgorithm::setupLogging().
BlockName SimulationBlock::name [protected, inherited] |
uint Options::nOptionsList [protected, inherited] |
Referenced by Options::addOptionsList(), Options::getNumOptionsLists(), Options::operator=(), and Options::Options().
uint SimulationEnvironment::nSteps [protected] |
Referenced by getNumSteps(), operator=(), SimulationEnvironment(), and step().
OptionsList** Options::optionsList [protected, inherited] |
Referenced by Options::addOption(), Options::addOptionsList(), Options::clearOptionsList(), Options::declareOptionsUnchanged(), Options::get(), Options::getOptions(), Options::haveOptionsChanged(), Options::operator=(), Options::Options(), Options::printOptionsList(), Options::set(), and Options::setOptions().
PlotCollection Plotting::plotCollection [protected, inherited] |
Process* SimulationEnvironment::process [protected] |
Curve SimulationEnvironment::processOutput [protected] |
Referenced by getProcessOutput(), init(), operator=(), SimulationEnvironment(), and step().
RealClock SimulationBlock::realClock [protected, inherited] |
double SimulationBlock::samplingTime [protected, inherited] |
Referenced by init(), operator=(), SimulationEnvironment(), and step().
double SimulationEnvironment::startTime [protected] |
Referenced by getFeedbackControl(), getFeedbackParameter(), init(), operator=(), SimulationEnvironment(), and step().
BlockStatus UserInteraction::status [protected, inherited] |