siconos.control.sensor#
Module documentation
- class siconos.control.sensor.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.sensor.Sensor(*args, **kwargs)[source]#
Bases:
object
Sensor Base Class
Abstract class, interface to user-defined sensors.
A Sensor is dedicated to data capture. It gives an interface for User who can implement its own Sensor to clearly define which data he needs to save.
A Sensor handles a TimeDiscretisation, which defines the set of all instants where the sensor must operate (i.e. each times where capture() function will be called). An Event, inserted into the EventsManager of the Simulation, is linked to this TimeDiscretisation.
Moreover, a Sensor is identified thanks to an id and a type (a number associated to the derived class type indeed).
Construction
To build a Sensor it is necessary to use the factory. Inputs are a number which identify the derived class type and a TimeDiscretisation:
Get the registry SensorFactory::Registry& regSensor(SensorFactory::Registry::get()) ; Build a Sensor of type "myType" with t as a TimeDiscretisation. regSensor.instantiate(myType, t);
The best way is to use the controlManager:
cm a ControlManager cm->addSensor(myType,t); or if cm has already been initialized: cm->addAndRecordSensor(myType,t)
The data are saved in a DataSet object named data, a map which associate to each Event another map. This second map links a std::string, used to identify the data, and a SiconosVector. As an example consider the case where you need to save the state vector x of a DynamicalSystem, then you can define a Data object, with “myDS_X” as an id and yourDS->x() as the SiconosVector. For myEvent being an Event where you need to save data, you get: (data[myEvent])[“myDS_X”] = model->nonSmoothDynamicalSystem()->dynamicalSystem()->x()
See users’ manual for details on how to define its own Sensor.
- getDS()[source]#
get the DynamicalSystem linked to this Sensor
- Return type:
DynamicalSystem
- Returns:
SP::DynamicalSystem
- setTimeDiscretisation(td)[source]#
This is derived in child classes if they need to copy the TimeDiscretisation associated with this Sensor
- Parameters:
td (
TimeDiscretisation
) – the TimeDiscretisation for this Sensor
- class siconos.control.sensor.ControlSensor(*args)[source]#
Bases:
Sensor
Generic control Sensor to get the output of the system
Overload 1: Default constructor
Overload 2: Simple Constructor
- Parameters:
Overload 3: Simple Constructor
- Parameters:
type (int) – the type of the Sensor
ds (
DynamicalSystem
) – the SP::DynamicalSystem it observesdelay – the delay between the measurement and the avaibility of the data
- initialize(nsds)[source]#
initialize sensor data.
- Parameters:
nsds (
NonSmoothDynamicalSystem
) – the Model
- class siconos.control.sensor.LinearSensor(*args)[source]#
Bases:
ControlSensor
A generic linear sensor, to capture the output y defined as y = Cx + Du
Overload 1: Constructor for the SensorFactory
- Parameters:
ds (
DynamicalSystem
) – the SP::DynamicalSystem it observes
Overload 2: Constructor with the full set of data
- Parameters:
ds (
DynamicalSystem
) – the SP::DynamicalSystem it observes.C (
SimpleMatrix
) – a SP::SiconosMatrix.D (
SimpleMatrix
, optional) – a SP::SiconosMatrix (optional).
Overload 3: Constructor with the full set of data
- Parameters:
ds (
DynamicalSystem
) – the SP::DynamicalSystem it observes.C (
SimpleMatrix
) – a SP::SiconosMatrix.D – a SP::SiconosMatrix (optional).
- initialize(nsds)[source]#
initialize sensor data :type nsds:
NonSmoothDynamicalSystem
:param nsds: current nonsmooth dynamical system