00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef PIFFCONTROLLER_H_
00035 #define PIFFCONTROLLER_H_
00036 #include <labust/control/PIDBase.h>
00037 #include <math.h>
00043 void PIFF_modelTune(PIDBase* self,
00044 const PT1Model* const model,
00045 float w, float a=1.5);
00050 void PIFF_tune(PIDBase* self, float w, float a=1.5);
00055 void PIFF_wffStep(PIDBase* self, float Ts, float error, float perror, float ff);
00059 void PIFF_wffIdle(PIDBase* self, float Ts, float error, float perror, float ff);
00063 inline void PIFF_step(PIDBase* self, float Ts)
00064 {
00065 PIFF_wffStep(self, Ts,
00066 self->desired - self->state,
00067 self->b*self->desired - self->state,
00068
00069 (self->model.betaa*fabs(self->state))*self->state);
00070 }
00074 void PIFF_idle(PIDBase* self, float Ts)
00075 {
00076 PIFF_wffIdle(self, Ts,
00077 self->desired - self->state,
00078 self->b*self->desired - self->state,
00079
00080 (self->model.betaa*fabs(self->state))*self->state);
00081 }
00086 inline void PIFF_wStep(PIDBase* self, float Ts, float error, float perror)
00087 {
00088 PIFF_wffStep(self, Ts,
00089 error,
00090 perror,
00091
00092 (self->model.betaa*fabs(self->state))*self->state);
00093 }
00097 void PIFF_wIdle(PIDBase* self, float Ts, float error, float perror)
00098 {
00099 PIFF_wffIdle(self, Ts,
00100 error,
00101 perror,
00102
00103 (self->model.betaa*fabs(self->state))*self->state);
00104 }
00109 inline void PIFF_ffStep(PIDBase* self, float Ts, float ff)
00110 {
00111 PIFF_wffStep(self, Ts,
00112 self->desired - self->state,
00113 self->b*self->desired - self->state,
00114 ff);
00115 }
00119 void PIFF_ffIdle(PIDBase* self, float Ts, float ff)
00120 {
00121 PIFF_wffIdle(self, Ts,
00122 self->desired - self->state,
00123 self->b*self->desired - self->state,
00124 ff);
00125 }
00126
00127
00128 #endif