Class PID#
Defined in Program listing for file control/src/Controller/PID.hpp
-
class PID : public Actuator#
Public Functions
-
PID(SP::ControlSensor sensor, SP::SimpleMatrix B = std::shared_ptr<SimpleMatrix>())#
Constructor.
- Parameters:
sensor – the ControlSensor feeding the Actuator
B – the B matrix
-
virtual ~PID()#
destructor
-
virtual void initialize(const NonSmoothDynamicalSystem &nsds, const Simulation &s)#
initialize actuator data.
- Parameters:
nsds – a NonSmoothDynamicalSystem
s – the simulation
-
virtual void actuate()#
Compute the new control law at each event Here we are using the following formula: \( u_k = u_{k-1} + c_1 e_k + c_2 e_{k-1} + c_3 e_{k-2} \) , where.
\[\begin{split} c_1 &= K_P - \frac{K_D}{\Delta t} + K_I \Delta t \\ c_2 &= -1 - \frac{2K_D}{\Delta t} \\ c_3 &= \frac{K_D}{\Delta t} \end{split}\]
-
inline void setRef(double reference)#
Set the value of _ref to reference.
- Parameters:
reference – the new value
-
virtual void setTimeDiscretisation(const TimeDiscretisation &td)#
Get the timestep from the TimeDiscretisation associated with this PID controller.
- Parameters:
td – the TimeDiscretisation for this Actuator
-
PID(SP::ControlSensor sensor, SP::SimpleMatrix B = std::shared_ptr<SimpleMatrix>())#