File control/src/Controller/CommonSMC.hpp

Go to the source code of this file

General interface to define a sliding mode actuator.

class CommonSMC : public Actuator

Subclassed by ExplicitLinearSMC, ExplicitTwisting, LinearSMC, LinearSMCOT2, Twisting

Public Functions

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

General constructor.


CommonSMC(unsigned int type, SP::ControlSensor sensor, SP::SimpleMatrix B, SP::SimpleMatrix D = std11::shared_ptr<SimpleMatrix>())

Constructor for dynamics affine in control.

  • type: the type of the SMC Actuator
  • sensor: the ControlSensor feeding the Actuator
  • B: the matrix multiplying the control input
  • D: the saturation matrix (optional)

virtual void actuate() = 0

Compute the new control law at each event.

virtual SP::NonSmoothDynamicalSystem getInternalNSDS() const

get the NSDS used in the SMC

the NSDS used in the SMC

OneStepIntegrator &getInternalOSI() const

get the Integrator used in the SMC

the Integrator used in the SMC

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


  • nsds: current nonsmooth dynamical system
  • s: current simulation setup

SP::SiconosVector lambda() const

get _lambda

a pointer to _lambda

void noUeq(bool b)

Disable (or enable) the use of the state-continuous control \(u^{eq}\).

  • b: disable the use of Ueq if true

const LinearOSNS &relay()

Get the OneStepNSProblem problem associated with the controller.

This is useful to gain access to the data given to the solver in Numerics

a reference to the LinearOSNS problem

void setAlpha(double alpha)

Set _alpha.

  • alpha: the new value for _alpha

void setComputeResidus(bool b)

Disable (or enable) the computation of the residus on the Newton loop.

This has an incidence only if the Relation is nonlinear

  • b: disable the computation of the residus

void setCsurface(SP::SimpleMatrix Csurface)

Set Csurface.

  • Csurface: a SP::SimpleMatrix containing the new value for _Csurface

void setDS(SP::FirstOrderNonLinearDS ds)

Set the DynamicalSystem used to compute the control law.

This is useful when we have a Nonlinear problem and we need to compute the control law with an approximate model, or when the dynamics are quite different.

  • ds: the DynamicalSystem to be used in the Controller

void sete(const std::string &plugin)
void setg(const std::string &plugin)
void seth(const std::string &plugin)
void setJacglambda(const std::string &plugin)
void setJacgx(const std::string &plugin)
void setJachlambda(const std::string &plugin)
void setJachx(const std::string &plugin)
void setPrecision(double newPrecision)

Set the precision.

  • newPrecision: a double

void setSaturationMatrix(SP::SimpleMatrix newSat)

Set _D to pointer newPtr.

  • newSat: a SP::SimpleMatrix containing the new value for _D

void setSolver(const int numericsSolverId)

Set the solver.

  • numericsSolverId: the solver for the relay

void setTheta(double newTheta)

Set _theta, used in some discretization method for \(u^{eq}\).

  • newTheta: the new value for _thetaSMC

virtual void setTimeDiscretisation(const TimeDiscretisation &td)

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

  • td: the TimeDiscretisation for this Sensor

SiconosVector &ueq()

get \(u^{eq}\)

a reference to _ueq

SiconosVector &us()

get \(u^{s}\)

a reference to _us

Protected Functions


default constructor

void computeUeq()

Compute the equivalent part of the control \(u^{eq}\).

The method used here is to discretize the continuous-time formula using a theta method

Protected Attributes

double _alpha

scalar multiplying Sign; \( u^s = - \alpha Sign \)

bool _computeResidus

If true perform the computation of the residus in the Newton loop if needed.

SP::SimpleMatrix _Csurface

the vector defining the linear contribution of the state to the sliding variable ( \( \sigma = Cx \))

SP::SimpleMatrix _D

matrix describing the influence of \(lambda\) on \(\sigma\)

SP::FirstOrderNonLinearDS _DS_SMC

the DynamicalSystem for the controller

SP::EventsManager _eventsManager

SP::EventsManager of the SMC Simulation.

unsigned int _indx

index for saving data

SP::OneStepIntegrator _integratorSMC

Integrator for the controller.

SP::Interaction _interactionSMC

Interaction for the control.

SP::SimpleMatrix _invCB

inverse of CB

SP::SiconosVector _lambda

easy access to lambda

bool _noUeq

Do not use the state-continuous equivaluent control \(u^{eq}\).

SP::NonSmoothDynamicalSystem _nsdsSMC

the nsds for the controller

SP::NonSmoothLaw _nsLawSMC

SP::NonSmoothLaw for computing the control law.

int _numericsSolverId

Relay solver type.


OneStepNsProblem for the controller.

std::string _plugineName

name of the plugin to add a term to the sliding variable; useful when doing trajectory tracking

std::string _pluginhName

name of the plugin to compute \(y = h(x, ...)\) for the nonlinear case

std::string _pluginJacglambdaName

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

std::string _pluginJachlambdaName

name of the plugin to compute \(\nabla_\lambda h\) for the nonlinear case

std::string _pluginJachxName

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

double _precision

Numerical precision expected for the Relay solver.

SP::FirstOrderR _relationSMC

the Relation for the Controller

SP::TimeStepping _simulationSMC

Simulation for the controller.

SP::TimeDiscretisation _td

the TimeDiscretisation for the controller

double _thetaSMC

Theta for the controller.

SP::SiconosVector _ueq

Store \(u^{eq}\).

SP::SiconosVector _us

Store \(u^s\).

Private Functions


serialization hooks