Allows to run closed-loop simulations of dynamic systems. More...
#include <simulation_environment.hpp>
Protected Attributes | |
Controller * | controller |
double | endTime |
Curve | feedbackControl |
Curve | feedbackParameter |
uint | nSteps |
Process * | process |
Curve | processOutput |
SimulationClock | simulationClock |
double | startTime |
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 |
Allows to run closed-loop simulations of dynamic systems.
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.
Definition at line 72 of file simulation_environment.hpp.
BEGIN_NAMESPACE_ACADO SimulationEnvironment::SimulationEnvironment | ( | ) |
Default constructor.
Definition at line 49 of file simulation_environment.cpp.
SimulationEnvironment::SimulationEnvironment | ( | double | _startTime, |
double | _endTime, | ||
Process & | _process, | ||
Controller & | _controller | ||
) |
Constructor which takes the name of the block and the sampling time.
@param[in] _startTime Start time of the simulation. @param[in] _endTime End time of the simulation. @param[in] _process Process used for simulating the dynamic system. @param[in] _controller Controller used for controlling the dynamic system. \note Only pointers to Process and Controller are stored!
Definition at line 66 of file simulation_environment.cpp.
SimulationEnvironment::SimulationEnvironment | ( | const SimulationEnvironment & | rhs | ) |
Copy constructor (deep copy).
@param[in] rhs Right-hand side object.
Definition at line 95 of file simulation_environment.cpp.
|
virtual |
Destructor.
Definition at line 120 of file simulation_environment.cpp.
|
protected |
Returns computational delay used for simulation based on the actual real controller runtime and the options set by the user.
[in] | controllerRuntime | Real controller runtime. |
Definition at line 509 of file simulation_environment.cpp.
|
inline |
Returns feedback control signals of the controller over the whole simulation.
@param[out] _feedbackControl Feedback control signals of the controller.
|
inline |
Returns feedback control signals of the controller over the whole simulation.
@param[out] _sampledFeedbackControl Feedback control signals of the controller.
|
inline |
Returns feedback parameter signals of the controller over the whole simulation.
@param[out] _feedbackParameter Feedback parameter signals of the controller.
|
inline |
Returns feedback parameter signals of the controller over the whole simulation.
@param[out] _sampledFeedbackParameter Feedback parameter signals of the controller.
|
inline |
Returns number of feedback parameters.
\return Number of feedback parameters
|
inline |
Returns number of feedback controls.
\return Number of feedback controls
|
inline |
Returns current number of simulation steps.
\return Current number of simulation steps
|
inline |
Returns number of process outputs.
\return Number of process outputs
|
inline |
Returns algebraic states of the process over the whole simulation.
@param[out] _algStates Algebraic states of the process.
|
inline |
Returns differential states of the process over the whole simulation.
@param[out] _diffStates Differential states of the process.
|
inline |
Returns intermediate states of the process over the whole simulation.
@param[out] _interStates Intermediate states of the process.
|
inline |
Returns continuous output of the process.
@param[out] _processOutput Continuous output of the process.
|
inline |
Returns output of the process at sampling instants.
@param[out] _sampledProcessOutput Sampled output of the process.
returnValue SimulationEnvironment::init | ( | const DVector & | x0_, |
const DVector & | p_ = emptyConstVector |
||
) |
Initializes the simulation with given start values and performs a number of consistency checks.
[in] | x0_ | Initial value for differential states. |
[in] | p_ | Initial value for parameters. |
Definition at line 220 of file simulation_environment.cpp.
returnValue SimulationEnvironment::initializeAlgebraicStates | ( | const VariablesGrid & | _xa_init | ) |
Initializes algebraic states of the process.
@param[in] _xa_init Initial value for algebraic states.
Definition at line 195 of file simulation_environment.cpp.
returnValue SimulationEnvironment::initializeAlgebraicStates | ( | const char * | fileName | ) |
Initializes algebraic states of the process from data file.
@param[in] fileName Name of file containing initial value for algebraic states.
Definition at line 207 of file simulation_environment.cpp.
SimulationEnvironment & SimulationEnvironment::operator= | ( | const SimulationEnvironment & | rhs | ) |
Assignment Operator (deep copy).
@param[in] rhs Right-hand side object.
Definition at line 125 of file simulation_environment.cpp.
returnValue SimulationEnvironment::run | ( | ) |
Runs the complete simulation.
Definition at line 477 of file simulation_environment.cpp.
returnValue SimulationEnvironment::setController | ( | Controller & | _controller | ) |
Assigns new controller block to be used for simulation.
@param[in] _controller New controller block. \note Only a pointer is stored!
Definition at line 176 of file simulation_environment.cpp.
returnValue SimulationEnvironment::setProcess | ( | Process & | _process | ) |
Assigns new process block to be used for simulation.
@param[in] _process New process block. \note Only a pointer is stored!
Definition at line 158 of file simulation_environment.cpp.
|
protectedvirtual |
Sets-up default logging information.
Reimplemented from Logging.
Definition at line 497 of file simulation_environment.cpp.
|
protectedvirtual |
Sets-up default options.
Reimplemented from Options.
Definition at line 487 of file simulation_environment.cpp.
returnValue SimulationEnvironment::step | ( | ) |
Performs next step of the simulation.
Definition at line 304 of file simulation_environment.cpp.
returnValue SimulationEnvironment::step | ( | double | intermediateTime | ) |
Performs next steps of the simulation until given intermediate time.
@param[in] intermediateTime Intermediate time.
Definition at line 455 of file simulation_environment.cpp.
|
protected |
Pointer to Controller used for controlling the dynamic system.
Definition at line 359 of file simulation_environment.hpp.
|
protected |
End time of the simulation.
Definition at line 356 of file simulation_environment.hpp.
|
protected |
Curve storing control signals from the Controller during the whole simulation.
Definition at line 364 of file simulation_environment.hpp.
|
protected |
Curve storing parameter signals from the Controller during the whole simulation.
Definition at line 365 of file simulation_environment.hpp.
|
protected |
Number of simulation steps (loops) that have been performed.
Definition at line 367 of file simulation_environment.hpp.
|
protected |
Pointer to Process used for simulating the dynamic system.
Definition at line 358 of file simulation_environment.hpp.
|
protected |
Curve storing output of the Process during the whole simulation.
Definition at line 363 of file simulation_environment.hpp.
|
protected |
Clock for managing the simulation time.
Definition at line 361 of file simulation_environment.hpp.
|
protected |
Start time of the simulation.
Definition at line 355 of file simulation_environment.hpp.