3 @brief single neuron proportional integral derivative controller
8 x_d=e(k)-2e(k-1)+e(k-2)
11 \omega_{p}(k)=\omega_{p}(k-1)+\eta_{p}e(k)u(k)x_{p}(k)\\
12 \omega_{i}(k)=\omega_{i}(k-1)+\eta_{i}e(k)u(k)x_{i}(k)\\
13 \omega_{d}(k)=\omega_{d}(k-1)+\eta_{d}e(k)u(k)x_{d}(k)
16 u(k)=u(k-1)+K\frac{w_{p}(k)x_{p}(k)+w_{i}(k)x_{i}(k)+w_{d}(k)x_{d}(k)}
17 {|\omega_{p}(k)|+|\omega_{i}(k)|+|\omega_{d}(k)|}
21 #ifndef LIBA_PID_NEURO_H
22 #define LIBA_PID_NEURO_H
28 @addtogroup A_PID_NEURO single neuron proportional integral derivative controller
32 typedef struct a_pid_neuro a_pid_neuro
;
34 #if defined(__cplusplus)
36 #endif /* __cplusplus */
39 @brief initialize for single neuron PID controller
40 @param[in,out] ctx points to an instance of single neuron PID controller
42 #define a_pid_neuro_init(ctx) a_pid_neuro_zero(ctx)
45 @brief set proportional integral derivative constant for single neuron PID controller
46 @param[in,out] ctx points to an instance of single neuron PID controller
47 @param[in] k proportional output coefficient
48 @param[in] kp proportional learning constant
49 @param[in] ki integral learning constant
50 @param[in] kd derivative learning constant
52 A_EXTERN
void a_pid_neuro_kpid(a_pid_neuro
*ctx
, a_float k
, a_float kp
, a_float ki
, a_float kd
);
55 @brief set proportional integral derivative weight for single neuron PID controller
56 @param[in,out] ctx points to an instance of single neuron PID controller
57 @param[in] wp proportional weight
58 @param[in] wi integral weight
59 @param[in] wd derivative lweight
61 A_EXTERN
void a_pid_neuro_wpid(a_pid_neuro
*ctx
, a_float wp
, a_float wi
, a_float wd
);
64 @brief calculate for single neuron PID controller
65 @param[in,out] ctx points to an instance of single neuron PID controller
66 @param[in] set setpoint value
67 @param[in] fdb feedback value
68 @return setpoint value
70 A_EXTERN a_float
a_pid_neuro_run(a_pid_neuro
*ctx
, a_float set
, a_float fdb
);
73 @brief calculate for incremental single neuron PID controller
74 @param[in,out] ctx points to an instance of single neuron PID controller
75 @param[in] set setpoint value
76 @param[in] fdb feedback value
79 A_EXTERN a_float
a_pid_neuro_inc(a_pid_neuro
*ctx
, a_float set
, a_float fdb
);
82 @brief zeroing for single neuron PID controller
83 @param[in,out] ctx points to an instance of single neuron PID controller
85 A_EXTERN
void a_pid_neuro_zero(a_pid_neuro
*ctx
);
87 #if defined(__cplusplus)
91 typedef struct a_pid_neuro pid_neuro
;
93 #endif /* __cplusplus */
96 @brief instance structure for single neuron PID controller
100 a_pid pid
; //!< instance structure for PID controller
101 a_float k
; //!< proportional output coefficient
102 a_float wp
; //!< proportional weight
103 a_float wi
; //!< integral weight
104 a_float wd
; //!< derivative weight
105 a_float ec
; //!< error change
106 #if defined(__cplusplus)
107 A_INLINE
void init() { a_pid_neuro_init(this); }
108 A_INLINE
void kpid(a_float _k
, a_float kp
, a_float ki
, a_float kd
)
110 a_pid_neuro_kpid(this, _k
, kp
, ki
, kd
);
112 A_INLINE
void wpid(a_float _wp
, a_float _wi
, a_float _wd
)
114 a_pid_neuro_wpid(this, _wp
, _wi
, _wd
);
116 A_INLINE a_float
run(a_float set
, a_float fdb
)
118 return a_pid_neuro_run(this, set
, fdb
);
120 A_INLINE a_float
inc(a_float set
, a_float fdb
)
122 return a_pid_neuro_inc(this, set
, fdb
);
124 A_INLINE
void zero() { a_pid_neuro_zero(this); }
125 #endif /* __cplusplus */
128 /*! @} A_PID_NEURO */
130 #endif /* a/pid_neuro.h */