udah bisa looo

Dependencies:   mbed

Committer:
Yolandataniaa
Date:
Thu Feb 27 13:10:57 2020 +0000
Revision:
1:0122c72f6e1b
Parent:
0:aa8e05bc0533
tangan kanan kamis 27 feb

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Yolandataniaa 0:aa8e05bc0533 1 /*
Yolandataniaa 0:aa8e05bc0533 2 * Author : Dagozilla ITB
Yolandataniaa 0:aa8e05bc0533 3 * Developer : Dagozilla ITB
Yolandataniaa 0:aa8e05bc0533 4 * Reference : https://www.scilab.org/discrete-time-pid-controller-implementation
Yolandataniaa 0:aa8e05bc0533 5 */
Yolandataniaa 0:aa8e05bc0533 6
Yolandataniaa 0:aa8e05bc0533 7 #ifndef PID_H
Yolandataniaa 0:aa8e05bc0533 8 #define PID_H
Yolandataniaa 0:aa8e05bc0533 9
Yolandataniaa 0:aa8e05bc0533 10 #include "mbed.h"
Yolandataniaa 0:aa8e05bc0533 11
Yolandataniaa 0:aa8e05bc0533 12 class PID{
Yolandataniaa 0:aa8e05bc0533 13 public :
Yolandataniaa 0:aa8e05bc0533 14 typedef enum Mode{
Yolandataniaa 0:aa8e05bc0533 15 PI_MODE,
Yolandataniaa 0:aa8e05bc0533 16 PID_MODE
Yolandataniaa 0:aa8e05bc0533 17 }Mode;
Yolandataniaa 0:aa8e05bc0533 18
Yolandataniaa 0:aa8e05bc0533 19 PID(float p , float i , float d , float _N , float _Ts, float FF, Mode _mode) ;
Yolandataniaa 0:aa8e05bc0533 20
Yolandataniaa 0:aa8e05bc0533 21 void setTunings(float p, float i, float d);
Yolandataniaa 0:aa8e05bc0533 22
Yolandataniaa 0:aa8e05bc0533 23 float createpwm( float setpoint , float feedback ) ;
Yolandataniaa 0:aa8e05bc0533 24
Yolandataniaa 0:aa8e05bc0533 25 private :
Yolandataniaa 0:aa8e05bc0533 26 float Kp ;
Yolandataniaa 0:aa8e05bc0533 27 float Kd ;
Yolandataniaa 0:aa8e05bc0533 28 float Ki ;
Yolandataniaa 0:aa8e05bc0533 29 float N ;
Yolandataniaa 0:aa8e05bc0533 30 float Ts ;
Yolandataniaa 0:aa8e05bc0533 31 float a0;
Yolandataniaa 0:aa8e05bc0533 32 float a1;
Yolandataniaa 0:aa8e05bc0533 33 float a2;
Yolandataniaa 0:aa8e05bc0533 34 float b0;
Yolandataniaa 0:aa8e05bc0533 35 float b1;
Yolandataniaa 0:aa8e05bc0533 36 float b2;
Yolandataniaa 0:aa8e05bc0533 37 float ku1;
Yolandataniaa 0:aa8e05bc0533 38 float ku2;
Yolandataniaa 0:aa8e05bc0533 39 float ke0;
Yolandataniaa 0:aa8e05bc0533 40 float ke1;
Yolandataniaa 0:aa8e05bc0533 41 float ke2;
Yolandataniaa 0:aa8e05bc0533 42 float e2;
Yolandataniaa 0:aa8e05bc0533 43 float e1;
Yolandataniaa 0:aa8e05bc0533 44 float e0;
Yolandataniaa 0:aa8e05bc0533 45 float u2;
Yolandataniaa 0:aa8e05bc0533 46 float u1;
Yolandataniaa 0:aa8e05bc0533 47 float u0;
Yolandataniaa 0:aa8e05bc0533 48 float FF;
Yolandataniaa 0:aa8e05bc0533 49 Mode mode;
Yolandataniaa 0:aa8e05bc0533 50 };
Yolandataniaa 0:aa8e05bc0533 51 #endif
Yolandataniaa 0:aa8e05bc0533 52
Yolandataniaa 0:aa8e05bc0533 53