File control/src/Controller/Actuator.hpp#

Go to the source code of this file

General interface to define an actuator.

class Actuator
#include <Actuator.hpp>

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).

Construction

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
cm->addActuator(myType,t);
// or if cm has already been initialized:
cm->addAndRecordActuator(myType,t)

Subclassed by CommonSMC, PID

Public Functions

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

General Constructor.

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

General Constructor with dynamics affine in control.

Parameters:
virtual ~Actuator()

destructor

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

set id of the Actuator

Parameters:

newId – the new id.

inline const std::string getId() const

get id of the Actuator

Returns:

a std::string

inline unsigned int getType() const

get the type of the Actuator (ie class name)

Returns:

an integer

inline const SiconosVector &u() const

Get the control value.

Returns:

current control value u

void setSizeu(unsigned size)

Set the control size.

Parameters:

size – dimension of the control input u

inline void setB(SP::SimpleMatrix B)

Set the B matrix.

Parameters:

B – the new B matrix

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

Set the name of the plugin for computing g.

Parameters:

g – the name of the plugin to compute g

void addSensorPtr(SP::ControlSensor newSensor)

add a Sensor in the actuator.

Parameters:

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.

Parameters:

td – the TimeDiscretisation for this Actuator

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

initialize actuator data.

Parameters:
  • 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

Returns:

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

Protected Functions

Actuator()#

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

ACCEPT_SERIALIZATION(Actuator)#