liba 0.1.15
An algorithm library based on C/C++
 
Loading...
Searching...
No Matches
pid_fuzzy.h
Go to the documentation of this file.
1
5
6#ifndef LIBA_PID_FUZZY_H
7#define LIBA_PID_FUZZY_H
8
9#include "pid.h"
10#include "fuzzy.h"
11
17
18typedef struct a_pid_fuzzy a_pid_fuzzy;
19
23enum
24{
32};
33
34#if defined(__cplusplus)
35extern "C" {
36#endif /* __cplusplus */
37
42#define a_pid_fuzzy_init(ctx) a_pid_fuzzy_zero(ctx)
43
49A_EXTERN a_float (*a_pid_fuzzy_opr(unsigned int opr))(a_float, a_float);
50
56A_EXTERN void a_pid_fuzzy_set_opr(a_pid_fuzzy *ctx, unsigned int opr);
57
63A_EXTERN void *a_pid_fuzzy_bfuzz(a_pid_fuzzy const *ctx);
64
71A_EXTERN void a_pid_fuzzy_set_bfuzz(a_pid_fuzzy *ctx, void *ptr, a_size num);
72
77#define A_PID_FUZZY_BFUZZ(n) (sizeof(unsigned int) * (n) * 2 + sizeof(a_float) * (n) * (2 + (n)))
78
89A_EXTERN void a_pid_fuzzy_set_rule(a_pid_fuzzy *ctx, unsigned int nrule, a_float const *me, a_float const *mec,
90 a_float const *mkp, a_float const *mki, a_float const *mkd);
91
100
109
118
127
132A_EXTERN void a_pid_fuzzy_zero(a_pid_fuzzy *ctx);
133
134#if defined(__cplusplus)
135} /* extern "C" */
136namespace a
137{
138typedef struct a_pid_fuzzy pid_fuzzy;
139} /* namespace a */
140#endif /* __cplusplus */
141
146{
148
149 a_float const *me;
150 a_float const *mec;
151 a_float const *mkp;
152 a_float const *mki;
153 a_float const *mkd;
154
155 unsigned int *idx;
157
159
163
164 unsigned int nrule;
165 unsigned int nfuzz;
166#if defined(__cplusplus)
167 A_INLINE void init() { a_pid_fuzzy_init(this); }
168 A_INLINE void set_opr(unsigned int opr_)
169 {
170 a_pid_fuzzy_set_opr(this, opr_);
171 }
172 A_INLINE void *bfuzz() const { return a_pid_fuzzy_bfuzz(this); }
173 A_INLINE void set_bfuzz(void *ptr, a_size num)
174 {
175 a_pid_fuzzy_set_bfuzz(this, ptr, num);
176 }
177 A_INLINE void set_rule(unsigned int nrule_, a_float const *me_, a_float const *mec_,
178 a_float const *mkp_, a_float const *mki_, a_float const *mkd_)
179 {
180 a_pid_fuzzy_set_rule(this, nrule_, me_, mec_, mkp_, mki_, mkd_);
181 }
182 A_INLINE void set_kpid(a_float kp_, a_float ki_, a_float kd_)
183 {
184 a_pid_fuzzy_set_kpid(this, kp_, ki_, kd_);
185 }
186 A_INLINE a_float run(a_float set, a_float fdb)
187 {
188 return a_pid_fuzzy_run(this, set, fdb);
189 }
190 A_INLINE a_float pos(a_float set, a_float fdb)
191 {
192 return a_pid_fuzzy_pos(this, set, fdb);
193 }
194 A_INLINE a_float inc(a_float set, a_float fdb)
195 {
196 return a_pid_fuzzy_inc(this, set, fdb);
197 }
198 A_INLINE void zero() { a_pid_fuzzy_zero(this); }
199#endif /* __cplusplus */
200};
201
203
204#endif /* a/pid_fuzzy.h */
fuzzy operator
double a_float
compiler built-in floating-point number type
Definition a.h:1003
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_set_bfuzz(a_pid_fuzzy *ctx, void *ptr, a_size num)
set memory block for fuzzy PID controller
void * a_pid_fuzzy_bfuzz(a_pid_fuzzy const *ctx)
get memory block for fuzzy PID controller
a_float a_pid_fuzzy_pos(a_pid_fuzzy *ctx, a_float set, a_float fdb)
calculate for positional fuzzy PID controller
void a_pid_fuzzy_set_kpid(a_pid_fuzzy *ctx, a_float kp, a_float ki, a_float kd)
set proportional integral derivative constant for fuzzy PID controller
#define a_pid_fuzzy_init(ctx)
initialize for fuzzy PID controller
Definition pid_fuzzy.h:42
a_float(*)(a_float, a_float) a_pid_fuzzy_opr(unsigned int opr)
get fuzzy relational operator for fuzzy PID controller
Definition pid_fuzzy.h:49
void a_pid_fuzzy_set_rule(a_pid_fuzzy *ctx, unsigned int nrule, a_float const *me, a_float const *mec, a_float const *mkp, a_float const *mki, a_float const *mkd)
set rule base for fuzzy PID controller
a_float a_pid_fuzzy_run(a_pid_fuzzy *ctx, a_float set, a_float fdb)
calculate for fuzzy PID controller
a_float a_pid_fuzzy_inc(a_pid_fuzzy *ctx, a_float set, a_float fdb)
calculate for incremental fuzzy PID controller
@ A_PID_FUZZY_CAP
Definition pid_fuzzy.h:26
@ A_PID_FUZZY_CAP_BOUNDED
Definition pid_fuzzy.h:28
@ A_PID_FUZZY_CUP_ALGEBRA
Definition pid_fuzzy.h:30
@ A_PID_FUZZY_CUP
Definition pid_fuzzy.h:29
@ A_PID_FUZZY_CUP_BOUNDED
Definition pid_fuzzy.h:31
@ A_PID_FUZZY_EQU
Definition pid_fuzzy.h:25
@ A_PID_FUZZY_CAP_ALGEBRA
Definition pid_fuzzy.h:27
size_t a_size
unsigned integer type returned by the sizeof operator
Definition a.h:823
proportional integral derivative controller
instance structure for fuzzy PID controller
Definition pid_fuzzy.h:146
a_pid pid
Definition pid_fuzzy.h:147
a_float kd
Definition pid_fuzzy.h:162
a_float ki
Definition pid_fuzzy.h:161
a_float kp
Definition pid_fuzzy.h:160
a_float(* opr)(a_float, a_float)
Definition pid_fuzzy.h:158
a_float * val
Definition pid_fuzzy.h:156
a_float const * mec
Definition pid_fuzzy.h:150
a_float const * mki
Definition pid_fuzzy.h:152
a_float const * mkp
Definition pid_fuzzy.h:151
unsigned int nfuzz
Definition pid_fuzzy.h:165
a_float const * mkd
Definition pid_fuzzy.h:153
unsigned int nrule
Definition pid_fuzzy.h:164
a_float const * me
Definition pid_fuzzy.h:149
unsigned int * idx
Definition pid_fuzzy.h:155
instance structure for PID controller
Definition pid.h:106