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

inline virtual ~ControlSimulation()


void setTheta(unsigned int newTheta)

Modify the value of theta (for MoreauJeanOSI)


newTheta – the new value of theta

void initialize()

Initialize the ControlSimulation, instantiate all objects.

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

Add a DynamicalSystem.

  • ds – the DynamicalSystem to integrate

  • name – of the ds (optional)

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

Add a Sensor.

  • sensor – the sensor to be added

  • h – sampling period (or timestep) for the Sensor

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

Add an Actuator.

  • actuator – the controller to be added

  • h – sampling period (or timestep) for the Actuator

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

Add an Observer.

  • observer – the observer to be added

  • h – sampling period (or timestep) for the Observer

void storeData(unsigned indx)

store the simulation data in a row of the matrix


indx – the current row index

inline SP::Simulation simulation() const

Return the Simulation.


the simulation for the main simulation

inline SP::OneStepIntegrator integrator() const

Return the OneStepIntegrator.


the Integrator

inline SP::NonSmoothDynamicalSystem model() const

Return the NonSmoothDynamicalSystem.


the NonSmoothDynamicalSystem

inline SP::SimpleMatrix data() const

Return the data matrix.


the data matrix

inline std::string dataLegend() const

get the legend for the matrix


legend as string of space seperated values

inline double elapsedTime() const

the elapsed time computing in seconds

inline SP::ControlManager CM() const

Return the ControlManager.


the ControlManager

inline void setSaveOnlyMainSimulation(bool v)

Set the value of _saveOnlyMainSimulation.


v – a boolean

inline void silent(bool s = true)

Set the simulation to be silent, e.g.

do not show any progress bar


s – is true is silent, else display progress bar

virtual void run() = 0

Run the simulation.

Protected Functions

inline ControlSimulation()#

default constructor

ControlSimulation(double t0, double T, double h)#

Constructor with the minimal set of data.

  • t0 – the starting time \( t_0 \)

  • T – the end time T

  • h – the simulation time step

Protected Attributes

double _t0#

Starting time.

double _T#

End time.

double _h#

Simulation step.

double _theta#

Theta for MoreauJeanOSI.

double _elapsedTime#

Time spent computing.

unsigned _N#

rough estimation of the number of points to save

unsigned _nDim#

Dimension of the state space.

bool _saveOnlyMainSimulation#

Save only the data in the main Simulation.

bool _silent#

If true, do not show progress of the simulation.

SP::SimpleMatrix _dataM#

Matrix for saving result.

std::string _dataLegend#

Legend for the columns in the matrix _dataM.

SP::NonSmoothDynamicalSystem _nsds#


SP::TimeDiscretisation _processTD#

TimeDiscretisation for the simulation.

SP::Simulation _processSimulation#

The Simulation.

SP::OneStepIntegrator _processIntegrator#

The integrator.

SP::ControlManager _CM#

the ControlManager

SP::DynamicalSystemsGraph _DSG0#

DynamicalSystemsGraph (for convenience)

SP::InteractionsGraph _IG0#

InteractionsGraph (for convenience)

Private Functions