114 } qFIS_DeFuzzState_t;
122 float min, max, value;
149 float res, x, y, data[ 4 ];
156 typedef float (*qFIS_MF_Fcn_t)(
const qFIS_IO_Base_t *
const in,
const float *p,
const size_t n );
174 #define FIS_RULE_ITEM_SIZE 1
176 #if ( FIS_RULE_ITEM_SIZE == 1 )
198 #define FIS_RULES_MIN_VALUE INT8_MIN
220 #define FIS_RULES_MIN_VALUE INT16_MIN
224 typedef int qFIS_Tag_t;
225 typedef float (*qFIS_DeFuzz_Fcn_t)(
qFIS_Output_t *
const o,
const qFIS_DeFuzzState_t stage );
233 typedef struct _qFIS_s
239 float (*andOp)(
const float a,
const float b );
240 float (*orOp)(
const float a,
const float b );
241 float (*implicate)(
const float a,
const float b );
242 float (*aggregate)(
const float a,
const float b );
243 size_t (*inferenceState)(
struct _qFIS_s *
const f,
size_t i );
244 size_t (*aggregationState)(
struct _qFIS_s *
const f,
size_t i );
245 qFIS_DeFuzz_Fcn_t deFuzz;
250 size_t nInputs, nOutputs;
251 size_t nMFInputs, nMFOutputs;
253 size_t nRules, ruleCount;
261 #define _QFIS_RULES_END ( FIS_RULES_MIN_VALUE + 1 )
262 #define _QFIS_AND ( FIS_RULES_MIN_VALUE + 2 )
263 #define _QFIS_OR ( FIS_RULES_MIN_VALUE + 3 )
264 #define _QFIS_THEN ( FIS_RULES_MIN_VALUE + 4 )
266 #define _QFIS_IF_STATEMENT ,
267 #define _QFIS_AND_STATEMENT +1),_QFIS_AND,
268 #define _QFIS_OR_STATEMENT +1),_QFIS_OR,
269 #define _QFIS_THEN_STATEMENT +1),_QFIS_THEN,
270 #define _QFIS_IS_STATEMENT ,(
271 #define _QFIS_IS_NOT_STATEMENT ,-(
272 #define _QFIS_END_STATEMENT +1)
295 #define QFIS_RULES_BEGIN ( FIS_RULES_MIN_VALUE )
315 #define QFIS_RULES_END ,_QFIS_RULES_END
318 #define IF _QFIS_IF_STATEMENT
320 #define AND _QFIS_AND_STATEMENT
322 #define OR _QFIS_OR_STATEMENT
324 #define THEN _QFIS_THEN_STATEMENT
326 #define IS _QFIS_IS_STATEMENT
328 #define IS_NOT _QFIS_IS_NOT_STATEMENT
330 #define END _QFIS_END_STATEMENT
443 const qFIS_Tag_t t );
476 qFIS_MF_Fcn_t custom_mf,
int16_t qFIS_Rules_t
Type definition to instantiate a set of fuzzy rules.
Definition qfis.h:219
qFIS_Type_t
An enum with the inference system types supported by qFIS.
Definition qfis.h:103
int qFIS_StoreAggregatedRegion(qFIS_Output_t *const o, const qFIS_Tag_t t, float *x, float *y, const size_t n)
Set location to store the aggregated region for supplied FIS output.
Definition qfis.c:376
float qFIS_GetOutput(const qFIS_Output_t *const v, const qFIS_Tag_t t)
Get the de-fuzzified crisp value from the the output with the specified tag.
Definition qfis.c:323
int qFIS_Inference(qFIS_t *const f)
Perform the inference process on the requested FIS object.
Definition qfis.c:859
qFIS_ParamValue_t
An enum with the supported parameter values.
Definition qfis.h:81
qFIS_MF_Name_t
An enum with all the possible values to specify a membership function.
Definition qfis.h:29
int qFIS_DeFuzzify(qFIS_t *const f)
Perform the de-Fuzzification operation to compute the crisp outputs.
Definition qfis.c:792
int qFIS_SetDeFuzzMethod(qFIS_t *const f, qFIS_DeFuzz_Method_t m)
Change the default de-Fuzzification method of the FIS instance.
Definition qfis.c:191
int qFIS_InputSetup(qFIS_Input_t *const v, const qFIS_Tag_t t, const float min, const float max)
Setup the input with the specified tag and set limits for it.
Definition qfis.c:269
qFIS_Parameter_t
An enum with the allowed parameters that can be set on a FIS instance.
Definition qfis.h:92
int qFIS_Setup(qFIS_t *const f, const qFIS_Type_t t, qFIS_Input_t *const inputs, const size_t ni, qFIS_Output_t *const outputs, const size_t no, qFIS_MF_t *const mf_inputs, const size_t nmi, qFIS_MF_t *const mf_outputs, const size_t nmo, const qFIS_Rules_t *const r, float *wi, const size_t n)
Setup and initialize the FIS instance.
Definition qfis.c:217
int qFIS_SetMF(qFIS_MF_t *const m, const qFIS_Tag_t io, const qFIS_Tag_t mf, const qFIS_MF_Name_t s, qFIS_MF_Fcn_t custom_mf, const float *cp, const float h)
Set the IO tag and points for the specified membership function.
Definition qfis.c:336
int qFIS_SetRuleWeights(qFIS_t *const f, float *rWeights)
Set weights to the rules of the inference system.
Definition qfis.c:846
int qFIS_SetInput(qFIS_Input_t *const v, const qFIS_Tag_t t, const float value)
Set a crisp value of the input with the specified tag.
Definition qfis.c:309
int qFIS_OutputSetup(qFIS_Output_t *const v, const qFIS_Tag_t t, const float min, const float max)
Setup the output with the specified tag and set limits for it.
Definition qfis.c:285
qFIS_DeFuzz_Method_t
An enum with all the possible de-Fuzzyfication methods.
Definition qfis.h:65
int qFIS_SetParameter(qFIS_t *const f, const qFIS_Parameter_t p, const qFIS_ParamValue_t x)
Set parameters of the FIS instance.
Definition qfis.c:137
int qFIS_Fuzzify(qFIS_t *const f)
Perform the fuzzification operation over the crisp inputs on the requested FIS object.
Definition qfis.c:426
@ Sugeno
Definition qfis.h:105
@ Tsukamoto
Definition qfis.h:106
@ Mamdani
Definition qfis.h:104
@ qFIS_SUM
Definition qfis.h:86
@ qFIS_PROD
Definition qfis.h:83
@ qFIS_MIN
Definition qfis.h:82
@ qFIS_MAX
Definition qfis.h:84
@ qFIS_PROBOR
Definition qfis.h:85
@ tsigmf
Definition qfis.h:54
@ zmf
Definition qfis.h:41
@ linsmf
Definition qfis.h:45
@ smf
Definition qfis.h:40
@ sigmf
Definition qfis.h:36
@ constantmf
Definition qfis.h:49
@ pimf
Definition qfis.h:39
@ linearmf
Definition qfis.h:50
@ tconcavemf
Definition qfis.h:53
@ gauss2mf
Definition qfis.h:35
@ linzmf
Definition qfis.h:46
@ singletonmf
Definition qfis.h:42
@ custommf
Definition qfis.h:30
@ tsmf
Definition qfis.h:55
@ rectmf
Definition qfis.h:47
@ trapmf
Definition qfis.h:32
@ tlinzmf
Definition qfis.h:52
@ trimf
Definition qfis.h:31
@ concavemf
Definition qfis.h:43
@ psigmf
Definition qfis.h:38
@ gbellmf
Definition qfis.h:33
@ spikemf
Definition qfis.h:44
@ tlinsmf
Definition qfis.h:51
@ cosmf
Definition qfis.h:48
@ gaussmf
Definition qfis.h:34
@ tzmf
Definition qfis.h:56
@ dsigmf
Definition qfis.h:37
@ qFIS_EvalPoints
Definition qfis.h:97
@ qFIS_OR
Definition qfis.h:96
@ qFIS_Implication
Definition qfis.h:93
@ qFIS_Aggregation
Definition qfis.h:94
@ qFIS_AND
Definition qfis.h:95
@ wtsum
Definition qfis.h:72
@ lom
Definition qfis.h:69
@ bisector
Definition qfis.h:67
@ centroid
Definition qfis.h:66
@ wtaver
Definition qfis.h:71
@ mom
Definition qfis.h:68
@ som
Definition qfis.h:70
A FIS Membership Function.
Definition qfis.h:165
A FIS Output object.
Definition qfis.h:144
A FIS(Fuzzy Inference System) object.
Definition qfis.h:234