# File kernel/src/modelingTools/RelayNSL.hpp¶

Go to the source code of this file

formalization of the Relay nonsmooth law

class RelayNSL : public NonSmoothLaw
#include <RelayNSL.hpp>

Relay NonSmoothLaw.

This class formalizes the Relay nonsmooth law i.e.

\begin{array}{l} -y \in \mathcal{N}_{[lb,ub]}(\lambda), \end{array}

where $$lb$$ is the lower bound and $$ub$$ is the upper bound of the Relay law.

In this default case, the lower bound is set to $$lb=-1$$ and the upper bound ub is set to $$ub=1$$. We get the well-known form of the RelayNSL as the multivalued sign function, i.e.

\begin{array}{l} y \in -\mathcal{N}_{[-1,1]}(\lambda)\quad \Longleftrightarrow \quad\lambda \in -\mbox{sgn} (y) \end{array}
where the multi-valued sign function is defined as

\mbox{sgn} (y) = \left\{ \begin{array}{lcl} 1 &\quad& y >0 \\ \,[-1,1] &\quad& y =0 \\ -1 &\quad& y <0 \\ \end{array}\right.

Public Functions

RelayNSL(unsigned int size, double lb = -1.0, double ub = 1.0)

constructor with the value of the RelayNSL attributes

Parameters
• size: size of the NonSmoothLaw

• lb: lower endpoint of the interval, default value is -1.0

• ub: upper endpoint of the interval, default value is 1.0

~RelayNSL()
ACCEPT_STD_VISITORS()

visitors hook

void display() const

print the data to the screen

bool isVerified() const

check the ns law to see if it is verified

Return

true if the NS Law is verified, false otherwise

double lb() const

to get lb

Return

the value of lb

void setLb(double lb)

to set the lower bound

Parameters
• lb: the new lower bound

void setUb(double ub)

to set ub

Parameters
• ub: the new upper bound

double ub() const

to get ub

Return

the value of ub

Private Functions

RelayNSL()

default constructor

ACCEPT_SERIALIZATION(RelayNSL)

serialization hooks

Private Members

double _lb

represent the lower bound of the Relay

double _ub

represent the upper bound of the Relay