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

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

General constructor.

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

Constructor for dynamics affine in control.

Parameters
  • 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 void initialize(const NonSmoothDynamicalSystem &nsds, const Simulation &s)

Initialization.

Parameters
  • nsds – current nonsmooth dynamical system

  • s – current simulation setup

void sete(const std::string &plugin)
void seth(const std::string &plugin)
void setJachx(const std::string &plugin)
void setJachlambda(const std::string &plugin)
void setg(const std::string &plugin)
void setJacgx(const std::string &plugin)
void setJacglambda(const std::string &plugin)
void setCsurface(SP::SimpleMatrix Csurface)

Set Csurface.

Parameters

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

void setSaturationMatrix(SP::SimpleMatrix newSat)

Set _D to pointer newPtr.

Parameters

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

inline void setAlpha(double alpha)

Set _alpha.

Parameters

alpha – the new value for _alpha

inline SP::SiconosVector lambda() const

get _lambda

Returns

a pointer to _lambda

inline void setSolver(const int numericsSolverId)

Set the solver.

Parameters

numericsSolverId – the solver for the relay

inline void setPrecision(double newPrecision)

Set the precision.

Parameters

newPrecision – a double

inline 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

Returns

a reference to the LinearOSNS problem

inline SiconosVector &ueq()

get \( u^{eq} \)

Returns

a reference to _ueq

inline SiconosVector &us()

get \( u^{s} \)

Returns

a reference to _us

inline void setTheta(double newTheta)

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

Parameters

newTheta – the new value for _thetaSMC

inline void noUeq(bool b)

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

Parameters

b – disable the use of Ueq if true

inline 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

Parameters

b – disable the computation of the residus

virtual void setTimeDiscretisation(const TimeDiscretisation &td)

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

Parameters

td – the TimeDiscretisation for this Sensor

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

Parameters

ds – the DynamicalSystem to be used in the Controller

inline virtual SP::NonSmoothDynamicalSystem getInternalNSDS() const

get the NSDS used in the SMC

Returns

the NSDS used in the SMC

inline OneStepIntegrator &getInternalOSI() const

get the Integrator used in the SMC

Returns

the Integrator used in the SMC

Protected Functions

inline CommonSMC()
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

unsigned int _indx

index for saving data

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 _pluginJachxName

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

std::string _pluginJachlambdaName

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

std::string _pluginJacglambdaName

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

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

double _alpha

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

SP::FirstOrderR _relationSMC

the Relation for the Controller

SP::Interaction _interactionSMC

Interaction for the control.

SP::SiconosVector _lambda

easy access to lambda

int _numericsSolverId

Relay solver type.

double _precision

Numerical precision expected for the Relay solver.

SP::NonSmoothDynamicalSystem _nsdsSMC

the nsds for the controller

SP::FirstOrderNonLinearDS _DS_SMC

the DynamicalSystem for the controller

SP::TimeDiscretisation _td

the TimeDiscretisation for the controller

SP::TimeStepping _simulationSMC

Simulation for the controller.

SP::OneStepIntegrator _integratorSMC

Integrator for the controller.

double _thetaSMC

Theta for the controller.

SP::LinearOSNS _OSNSPB_SMC

OneStepNsProblem for the controller.

SP::EventsManager _eventsManager

SP::EventsManager of the SMC Simulation.

SP::NonSmoothLaw _nsLawSMC

SP::NonSmoothLaw for computing the control law.

SP::SimpleMatrix _invCB

inverse of CB

SP::SiconosVector _ueq

Store \( u^{eq} \)

SP::SiconosVector _us

Store \( u^s \)

bool _noUeq

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

bool _computeResidus

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

Private Functions

ACCEPT_SERIALIZATION(CommonSMC)