siconos.control.simulation#
Module documentation
- class siconos.control.simulation.nullDeleter(*args, **kwargs)[source]#
Bases:
object
- Using a shared_ptr to hold a pointer to a statically allocated
object use create<type>SPtr(<type> &x) cf http://www.boost.org/doc/
- class siconos.control.simulation.ControlManager(*args)[source]#
Bases:
object
ControlManager Class: tools to provide control in a Simulation (Sensors, Actuators, Observers)
This class is used to handle all the sensors and actuators declared by the user and to schedule them into the simulation.
A ControlManager has: - a list of Sensor - a list of Actuator - a link to an existing Simulation
The usual way to define control over a system is as follows: - declare a ControlManager and associate it with a Simulation - add some sensors and actuators into the ControlManager - initialize the ControlManager (which will result in the recording of all actuators and sensors into the list of events processed during the simulation) - optionally add some new sensor/actuator at any time but with a specific function: addAndRecord(…). A call to this function results in the creation of a Sensor/Actuator and in the insertion of the corresponding event into the simulation eventsManager.
Overload 1: default constructor
Overload 2: Constructor with a Simulation, to which control will be applied.
- Parameters:
sim (
Simulation
) – the Simulation
- linkSensorSimulation(s, td)[source]#
Create associated Event and give the opportunity to get the TimeDiscretisation
- Parameters:
s (Sensor) – a Sensor
td (
TimeDiscretisation
) – a TimeDiscretisation asociated with this Sensor
- linkActuatorSimulation(act, td)[source]#
Create associated Event and give the opportunity to get the TimeDiscretisation
- Parameters:
act (Actuator) – a Sensor
td (
TimeDiscretisation
) – a TimeDiscretisation asociated with this Sensor
- linkObserverSimulation(obs, td)[source]#
Create associated Event and give the opportunity to get the TimeDiscretisation
- Parameters:
obs (Observer) – a Sensor
td (
TimeDiscretisation
) – a TimeDiscretisation asociated with this Sensor
- simulation()[source]#
get the Simulation linked to this ControlManager
- Return type:
Simulation
- Returns:
a SP::Simulation
- getSensors()[source]#
get the list of Sensors associated to this manager.
- Return type:
Sensors
- Returns:
a Sensors object.
- getActuators()[source]#
get the list of Actuators associated to this manager.
- Return type:
Actuators
- Returns:
a Actuators object.
- getObservers()[source]#
get the list of Observers associated to this manager.
- Return type:
Observers
- Returns:
a Observers object.
- addAndRecordSensor(name, td, ds, nsds)[source]#
To build, add, initialize a new Sensor in the Manager and record it in the simulation This function is only useful to add a new Sensor after the initialization of the manager else call addSensor()
- Parameters:
name (int) – the type (int) of the Sensor
td (
TimeDiscretisation
) – the SP::TimeDiscretisation of the Sensords (
DynamicalSystem
) – the DynamicalSystem used in the Sensornsds (
NonSmoothDynamicalSystem
) – the NonSmoothDynamicalSystem
- Return type:
- Returns:
a SP::Sensor to the added Sensor
- addSensorPtr(s, td)[source]#
Add an existing Sensor to the Manager
- Parameters:
s (Sensor) – a SP::Sensor to the Sensor we want to add
td (
TimeDiscretisation
) – the TimeDiscretisation used for the associated Event
- addAndRecordSensorPtr(s, td, nsds)[source]#
To add, initialize an existing Sensor in the manager and record it in the simulation This function is only useful to add a new Sensor after the initialization of the manager else call addSensor()
- Parameters:
s (Sensor) – a SP::Sensor to the Sensor we want to add
td (
TimeDiscretisation
) – the TimeDiscretisation used for the associated Eventnsds (
NonSmoothDynamicalSystem
) – current nonsmooth dynamical system
- addActuator(name, td, sensor)[source]#
To build and add a new Actuator in the Manager
- Parameters:
name (int) – the type of the Actuator
td (
TimeDiscretisation
) – the SP::TimeDiscretisation of the Actuatorsensor (ControlSensor) – the ControlSensor used to feed the Actuator
- Return type:
- Returns:
the added Actuator
- addAndRecordActuator(name, t, sensor, nsds)[source]#
To build, add, initialize a new Actuator in the manager and record it in the simulation This function is only useful to add a new Actuator after the initialization of the manager else call addActuator()
- Parameters:
name (int) – the type of the Actuator
t (
TimeDiscretisation
) – the SP::TimeDiscretisation of the Actuatorsensor (ControlSensor) – the ControlSensor used to feed the Actuator
nsds (
NonSmoothDynamicalSystem
) – the NonSmoothDynamicalSystem
- Return type:
- Returns:
a SP::Actuator to the added Actuator
- addActuatorPtr(act, td)[source]#
Add an existing Actuator to the manager
- Parameters:
act (Actuator) – a SP::Actuator to the Actuator we want to add
td (
TimeDiscretisation
) – the TimeDiscretisation used for the associated Event
- addAndRecordActuatorPtr(act, td, nsds)[source]#
To add, initialize an existing Actuator in the manager and record it in the simulation This function is only useful to add a new Actuator after the initialization of the manager otherwise call addActuator()
- Parameters:
act (Actuator) – a SP::Actuator to the Actuator we want to add
td (
TimeDiscretisation
) – the TimeDiscretisation used for the associated Eventnsds (
NonSmoothDynamicalSystem
) – current nonsmooth dynamical system
- addObserver(name, td, sensor, xHat0)[source]#
To build and add a new Observer in the Manager
- Parameters:
name (int) – the type of the Observer
td (
TimeDiscretisation
) – the SP::TimeDiscretisation of the Observersensor (ControlSensor) – the ControlSensor feeding the Observer
xHat0 (
SiconosVector
) – the initial guess for the state
- Return type:
- Returns:
a SP::ACtuator to the added Observer
- addAndRecordObserver(name, td, sensor, xHat0, nsds)[source]#
To build, add, initialize a new Observer in the manager and record it in the simulation This function is only useful to add a new Observer after the initialization of the manager else call addObserver()
- Parameters:
name (int) – the type of the Observer
td (
TimeDiscretisation
) – the SP::TimeDiscretisation of the Observersensor (ControlSensor) – the ControlSensor feeding the Observer
xHat0 (
SiconosVector
) – the initial guess for the statensds (
NonSmoothDynamicalSystem
) – current nonsmooth dynamical system
- Return type:
- Returns:
the added Observer
- addObserverPtr(obs, td)[source]#
Add an existing Observer to the manager
- Parameters:
obs (Observer) – a SP::Observer to the Observer we want to add
td (
TimeDiscretisation
) – the TimeDiscretisation used for the associated Event
- addAndRecordObserverPtr(obs, td, nsds)[source]#
To add, initialize an existing Observer in the manager and record it in the simulation This function is only useful to add a new Observer after the initialization of the manager otherwise call addObserver()
- Parameters:
obs (Observer) – a SP::Observer to the Observer we want to add
td (
TimeDiscretisation
) – the TimeDiscretisation used for the associated Eventnsds (
NonSmoothDynamicalSystem
) – current nonsmooth dynamical system