File control/src/Controller/Actuator.hpp

Go to the source code of this file

General interface to define an actuator.

class Actuator
#include <>

Actuators Base Class.

Abstract class, interface to user-defined actuators.

An Actuator is dedicated to act on parameters of the Model (especially z param. in DynamicalSystem) according to some specific values recorded thanks to sensors. It gives an interface for User who can implement its own Actuator. clearly define which data he needs to save.

An Actuator handles a TimeDiscretisation, which defines the set of all instants where the Actuator must operate (i.e. each times where actuate() function will be called). An Event, inserted into the EventsManager of the Simulation, is linked to this TimeDiscretisation.

Moreover, an Actuator is identified thanks to an id and a type (a number associated to the derived class type indeed).


To build an Actuator it is necessary to use the factory. Inputs are a number which identify the derived class type and a TimeDiscretisation:

// Get the registry
ActuatorFactory::Registry& regActuator(ActuatorFactory::Registry::get()) ;
// Build an Actuator of type "myType" with t as a TimeDiscretisation.
regActuator.instantiate(myType, t);

The best way is to use the controlManager:

// cm a ControlManager
// or if cm has already been initialized:

Subclassed by CommonSMC, PID

Public Functions

Actuator(unsigned int type, SP::ControlSensor sensor)

General Constructor.

Actuator(unsigned int type, SP::ControlSensor sensor, SP::SimpleMatrix B)

General Constructor with dynamics affine in control.

virtual ~Actuator()


inline void setId(const std::string &newId)

set id of the Actuator


newId – the new id.

inline const std::string getId() const

get id of the Actuator


a std::string

inline unsigned int getType() const

get the type of the Actuator (ie class name)


an integer

inline const SiconosVector &u() const

Get the control value.


current control value u

void setSizeu(unsigned size)

Set the control size.


size – dimension of the control input u

inline void setB(SP::SimpleMatrix B)

Set the B matrix.


B – the new B matrix

inline void setg(const std::string &g)

Set the name of the plugin for computing g.


g – the name of the plugin to compute g

void addSensorPtr(SP::ControlSensor newSensor)

add a Sensor in the actuator.


newSensor – a Sensor that will be connected to the Actuator

inline virtual void setTimeDiscretisation(const TimeDiscretisation &td)

This is derived in child classes if they need to copy the TimeDiscretisation associated with this Actuator.


td – the TimeDiscretisation for this Actuator

virtual void initialize(const NonSmoothDynamicalSystem &nsds, const Simulation &s)

initialize actuator data.

  • nsds – the NonSmoothDynamicalSystem

  • s – the simulation

virtual void actuate() = 0

capture data when the ActuatorEvent is processed

virtual void display() const

display the data of the Actuator on the standard output

virtual SP::NonSmoothDynamicalSystem getInternalNSDS() const

get the NSDS used in the Controller, if there is one


“NULL” shared_ptr if there is no internal simulation, otherwise it returns the Model hoding the simulation

Protected Functions


default constructor

Protected Attributes

unsigned int _type

type of the Actuator

std::string _id

id of the Actuator

SP::SiconosVector _u

Control variable.

SP::SimpleMatrix _B

B Matrix.

std::string _plugingName

name of the plugin for g (nonlinear affine in control system)

std::string _pluginJacgxName

name of the plugin to compute \( \nabla_x g \) for the nonlinear case

SP::ControlSensor _sensor

ControlSensor feeding the Controller.

Private Functions