Allows to run closed-loop simulations of dynamic systems. More...
#include <simulation_environment.hpp>
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.
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.
[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. |
Definition at line 66 of file simulation_environment.cpp.
Copy constructor (deep copy).
[in] | rhs | Right-hand side object. |
Definition at line 95 of file simulation_environment.cpp.
SimulationEnvironment::~SimulationEnvironment | ( | ) | [virtual] |
Destructor.
Definition at line 120 of file simulation_environment.cpp.
double SimulationEnvironment::determineComputationalDelay | ( | double | controllerRuntime | ) | const [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.
returnValue SimulationEnvironment::getFeedbackControl | ( | Curve & | _feedbackControl | ) | const [inline] |
Returns feedback control signals of the controller over the whole simulation.
[out] | _feedbackControl | Feedback control signals of the controller. |
returnValue SimulationEnvironment::getFeedbackControl | ( | VariablesGrid & | _sampledFeedbackControl | ) | [inline] |
Returns feedback control signals of the controller over the whole simulation.
[out] | _sampledFeedbackControl | Feedback control signals of the controller. |
returnValue SimulationEnvironment::getFeedbackParameter | ( | Curve & | _feedbackParameter | ) | const [inline] |
Returns feedback parameter signals of the controller over the whole simulation.
[out] | _feedbackParameter | Feedback parameter signals of the controller. |
returnValue SimulationEnvironment::getFeedbackParameter | ( | VariablesGrid & | _sampledFeedbackParameter | ) | [inline] |
Returns feedback parameter signals of the controller over the whole simulation.
[out] | _sampledFeedbackParameter | Feedback parameter signals of the controller. |
uint SimulationEnvironment::getNP | ( | ) | const [inline] |
Returns number of feedback parameters.
uint SimulationEnvironment::getNU | ( | ) | const [inline] |
Returns number of feedback controls.
uint SimulationEnvironment::getNumSteps | ( | ) | const [inline] |
Returns current number of simulation steps.
uint SimulationEnvironment::getNY | ( | ) | const [inline] |
Returns number of process outputs.
returnValue SimulationEnvironment::getProcessAlgebraicStates | ( | VariablesGrid & | _algStates | ) | [inline] |
Returns algebraic states of the process over the whole simulation.
[out] | _algStates | Algebraic states of the process. |
returnValue SimulationEnvironment::getProcessDifferentialStates | ( | VariablesGrid & | _diffStates | ) | [inline] |
Returns differential states of the process over the whole simulation.
[out] | _diffStates | Differential states of the process. |
returnValue SimulationEnvironment::getProcessIntermediateStates | ( | VariablesGrid & | _interStates | ) | [inline] |
Returns intermediate states of the process over the whole simulation.
[out] | _interStates | Intermediate states of the process. |
returnValue SimulationEnvironment::getProcessOutput | ( | Curve & | _processOutput | ) | const [inline] |
Returns continuous output of the process.
[out] | _processOutput | Continuous output of the process. |
returnValue SimulationEnvironment::getSampledProcessOutput | ( | VariablesGrid & | _sampledProcessOutput | ) | [inline] |
Returns output of the process at sampling instants.
[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.
[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.
[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).
[in] | rhs | Right-hand side object. |
Definition at line 125 of file simulation_environment.cpp.
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.
[in] | _controller | New controller block. |
Definition at line 176 of file simulation_environment.cpp.
returnValue SimulationEnvironment::setProcess | ( | Process & | _process | ) |
Assigns new process block to be used for simulation.
[in] | _process | New process block. |
Definition at line 158 of file simulation_environment.cpp.
returnValue SimulationEnvironment::setupLogging | ( | ) | [protected, virtual] |
Sets-up default logging information.
Reimplemented from Logging.
Definition at line 497 of file simulation_environment.cpp.
returnValue SimulationEnvironment::setupOptions | ( | ) | [protected, virtual] |
Sets-up default options.
Reimplemented from Options.
Definition at line 487 of file simulation_environment.cpp.
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.
[in] | intermediateTime | Intermediate time. |
Definition at line 455 of file simulation_environment.cpp.
Controller* SimulationEnvironment::controller [protected] |
Pointer to Controller used for controlling the dynamic system.
Definition at line 359 of file simulation_environment.hpp.
double SimulationEnvironment::endTime [protected] |
End time of the simulation.
Definition at line 356 of file simulation_environment.hpp.
Curve SimulationEnvironment::feedbackControl [protected] |
Curve storing control signals from the Controller during the whole simulation.
Definition at line 364 of file simulation_environment.hpp.
Curve SimulationEnvironment::feedbackParameter [protected] |
Curve storing parameter signals from the Controller during the whole simulation.
Definition at line 365 of file simulation_environment.hpp.
uint SimulationEnvironment::nSteps [protected] |
Number of simulation steps (loops) that have been performed.
Definition at line 367 of file simulation_environment.hpp.
Process* SimulationEnvironment::process [protected] |
Pointer to Process used for simulating the dynamic system.
Definition at line 358 of file simulation_environment.hpp.
Curve SimulationEnvironment::processOutput [protected] |
Curve storing output of the Process during the whole simulation.
Definition at line 363 of file simulation_environment.hpp.
Clock for managing the simulation time.
Definition at line 361 of file simulation_environment.hpp.
double SimulationEnvironment::startTime [protected] |
Start time of the simulation.
Definition at line 355 of file simulation_environment.hpp.