6#ifndef LIBA_PID_FUZZY_H
7#define LIBA_PID_FUZZY_H
34#if defined(__cplusplus)
42#define a_pid_fuzzy_init(ctx) a_pid_fuzzy_zero(ctx)
77#define A_PID_FUZZY_BFUZZ(n) (sizeof(unsigned int) * (n) * 2 + sizeof(a_float) * (n) * (2 + (n)))
134#if defined(__cplusplus)
166#if defined(__cplusplus)
168 A_INLINE
void set_opr(
unsigned int opr_)
173 A_INLINE
void set_bfuzz(
void *ptr,
a_size num)
177 A_INLINE
void set_rule(
unsigned int nrule_,
a_float const *me_,
a_float const *mec_,
#define a_float
Definition a.h:785
void a_pid_fuzzy_set_rule(a_pid_fuzzy *ctx, unsigned int nrule, double const *me, double const *mec, double const *mkp, double const *mki, double const *mkd)
set rule base for fuzzy PID controller
void a_pid_fuzzy_set_opr(a_pid_fuzzy *ctx, unsigned int opr)
set fuzzy relational operator for fuzzy PID controller
void a_pid_fuzzy_zero(a_pid_fuzzy *ctx)
zeroing for fuzzy PID controller
void * a_pid_fuzzy_bfuzz(a_pid_fuzzy const *ctx)
get memory block for fuzzy PID controller
void a_pid_fuzzy_set_bfuzz(a_pid_fuzzy *ctx, void *ptr, size_t num)
set memory block for fuzzy PID controller
double a_pid_fuzzy_inc(a_pid_fuzzy *ctx, double set, double fdb)
calculate for incremental fuzzy PID controller
double a_pid_fuzzy_run(a_pid_fuzzy *ctx, double set, double fdb)
calculate for fuzzy PID controller
#define a_pid_fuzzy_init(ctx)
initialize for fuzzy PID controller
Definition pid_fuzzy.h:42
double a_pid_fuzzy_pos(a_pid_fuzzy *ctx, double set, double fdb)
calculate for positional fuzzy PID controller
void a_pid_fuzzy_set_kpid(a_pid_fuzzy *ctx, double kp, double ki, double kd)
set proportional integral derivative constant for fuzzy PID controller
double(*)(double, double) a_pid_fuzzy_opr(unsigned int opr)
get fuzzy relational operator for fuzzy PID controller
Definition pid_fuzzy.h:49
@ A_PID_FUZZY_CAP
min(a,b)
Definition pid_fuzzy.h:26
@ A_PID_FUZZY_CAP_BOUNDED
max(a+b-1,0)
Definition pid_fuzzy.h:28
@ A_PID_FUZZY_CUP_ALGEBRA
a+b-a*b
Definition pid_fuzzy.h:30
@ A_PID_FUZZY_CUP
max(a,b)
Definition pid_fuzzy.h:29
@ A_PID_FUZZY_CUP_BOUNDED
min(a+b,1)
Definition pid_fuzzy.h:31
@ A_PID_FUZZY_EQU
sqrt(a,b)*sqrt(1-(1-a)*(1-b))
Definition pid_fuzzy.h:25
@ A_PID_FUZZY_CAP_ALGEBRA
a*b
Definition pid_fuzzy.h:27
#define a_size
Definition a.h:610
proportional integral derivative controller
instance structure for fuzzy PID controller
Definition pid_fuzzy.h:146
a_pid pid
instance structure for PID controller
Definition pid_fuzzy.h:147
double * val
the memory block for membership value and membership outer product of e and ec, >= (2+N)N
Definition pid_fuzzy.h:156
double(* opr)(double, double)
fuzzy relational operator
Definition pid_fuzzy.h:158
double const * mkd
points to Kd's rule base, which must be a square matrix
Definition pid_fuzzy.h:153
double const * mec
points to ec's membership function parameter table
Definition pid_fuzzy.h:150
double ki
base integral constant
Definition pid_fuzzy.h:161
double const * me
points to e's membership function parameter table
Definition pid_fuzzy.h:149
double const * mki
points to Ki's rule base, which must be a square matrix
Definition pid_fuzzy.h:152
double const * mkp
points to Kp's rule base, which must be a square matrix
Definition pid_fuzzy.h:151
unsigned int nfuzz
maximum number triggered by the rule
Definition pid_fuzzy.h:165
unsigned int nrule
number of order in the square matrix
Definition pid_fuzzy.h:164
double kp
base proportional constant
Definition pid_fuzzy.h:160
unsigned int * idx
the memory block for membership index, >= 2N
Definition pid_fuzzy.h:155
double kd
base derivative constant
Definition pid_fuzzy.h:162
instance structure for PID controller
Definition pid.h:106