File control/src/Simulation/ControlSimulation.hpp

Go to the source code of this file

Abstract class - General interface for all Control Dynamical Systems.

class ControlSimulation

Subclassed by ControlLsodarSimulation, ControlZOHSimulation

Public Functions

virtual ~ControlSimulation()

destructor

void addActuator(SP::Actuator actuator, const double h)

Add an Actuator.

Parameters
  • actuator: the controller to be added
  • h: sampling period (or timestep) for the Actuator

void addDynamicalSystem(SP::DynamicalSystem ds, const std::string &name = "")

Add a DynamicalSystem.

Parameters
  • ds: the DynamicalSystem to integrate
  • name: of the ds (optional)

void addObserver(SP::Observer observer, const double h)

Add an Observer.

Parameters
  • observer: the observer to be added
  • h: sampling period (or timestep) for the Observer

void addSensor(SP::Sensor sensor, const double h)

Add a Sensor.

Parameters
  • sensor: the sensor to be added
  • h: sampling period (or timestep) for the Sensor

SP::ControlManager CM() const

Return the ControlManager.

Return
the ControlManager

SP::SimpleMatrix data() const

Return the data matrix.

Return
the data matrix

std::string dataLegend() const

get the legend for the matrix

Return
legend as string of space seperated values

double elapsedTime() const

Return the elapsed time computing.

Return
the elapsed time computing

void initialize()

Initialize the ControlSimulation, instantiate all objects.

SP::OneStepIntegrator integrator() const

Return the OneStepIntegrator.

Return
the Integrator

SP::NonSmoothDynamicalSystem model() const

Return the NonSmoothDynamicalSystem.

Return
the NonSmoothDynamicalSystem

virtual void run() = 0

Run the simulation.

void setSaveOnlyMainSimulation(bool v)

Set the value of _saveOnlyMainSimulation.

Parameters
  • v: a boolean

void setTheta(unsigned int newTheta)

Modify the value of theta (for MoreauJeanOSI)

Parameters
  • newTheta: the new value of theta

void silent(bool s = true)

Set the simulation to be silent, e.g.

do not show any progress bar

Parameters
  • s: is true is silent, else display progress bar

SP::Simulation simulation() const

Return the Simulation.

Return
the simulation for the main simulation

void storeData(unsigned indx)

store the simulation data in a row of the matrix

Parameters
  • indx: the current row index

Protected Functions

ControlSimulation()

default constructor

ControlSimulation(double t0, double T, double h)

Constructor with the minimal set of data.

Parameters
  • t0: the starting time \(t_0\)
  • T: the end time T
  • h: the simulation time step

Protected Attributes

SP::ControlManager _CM

the ControlManager

std::string _dataLegend

Legend for the columns in the matrix _dataM.

SP::SimpleMatrix _dataM

Matrix for saving result.

SP::DynamicalSystemsGraph _DSG0

DynamicalSystemsGraph (for convenience)

double _elapsedTime

Time spent computing.

double _h

Simulation step.

SP::InteractionsGraph _IG0

InteractionsGraph (for convenience)

unsigned _N

rough estimation of the number of points to save

unsigned _nDim

Dimension of the state space.

SP::NonSmoothDynamicalSystem _nsds

NonSmoothDynamicalSystem.

SP::OneStepIntegrator _processIntegrator

The integrator.

SP::Simulation _processSimulation

The Simulation.

SP::TimeDiscretisation _processTD

TimeDiscretisation for the simulation.

bool _saveOnlyMainSimulation

Save only the data in the main Simulation.

bool _silent

If true, do not show progress of the simulation.

double _T

End time.

double _t0

Starting time.

double _theta

Theta for MoreauJeanOSI.

Private Functions

ACCEPT_SERIALIZATION(ControlSimulation)

serialization hooks