![]() |
Documentation
Tools for embedded systems
|
API for the qFIS Fuzzy Inference System Engine. More...
Data Structures | |
| struct | qFIS_Input_t |
| A FIS Input object. More... | |
| struct | qFIS_Output_t |
| A FIS Output object. More... | |
| struct | qFIS_MF_t |
| A FIS Membership Function. More... | |
| struct | qFIS_t |
| A FIS(Fuzzy Inference System) object. More... | |
Macros | |
| #define | FIS_RULE_ITEM_SIZE |
| #define | FIS_RULES_MIN_VALUE |
| #define | QFIS_RULES_BEGIN |
| Start a Fuzzy rule set. The QFIS_RULES_BEGIN statement is used to declare the starting point of a FIS rule set. It should be placed at the start of the rules enumeration. QFIS_RULES_END declare the end of the FIS rule set. | |
| #define | QFIS_RULES_END |
| Ends a Fuzzy rule set. The QFIS_RULES_END statement is used to finalize the declaration of a FIS rule set. It should be placed at the end of the rules enumeration. QFIS_RULES_BEGIN declare the start point of the FIS rule set. | |
| #define | IF |
| Rule statement to begin a rule sentence. | |
| #define | AND |
| Rule statement to represent the AND connector. | |
| #define | OR |
| Rule statement to represent the OR connector. | |
| #define | THEN |
| Rule statement to represent the implication. | |
| #define | IS |
| Rule statement to represent a premise. | |
| #define | IS_NOT |
| Rule statement to represent a negated premise. | |
| #define | END |
| Rule statement to end a rule sentence. | |
Typedefs | |
| typedef int16_t | qFIS_Rules_t |
| Type definition to instantiate a set of fuzzy rules. | |
Enumerations | |
| enum | qFIS_MF_Name_t { custommf , trimf , trapmf , gbellmf , gaussmf , gauss2mf , sigmf , dsigmf , psigmf , pimf , smf , zmf , singletonmf , concavemf , spikemf , linsmf , linzmf , rectmf , cosmf , constantmf , linearmf , tlinsmf , tlinzmf , tconcavemf , tsigmf , tsmf , tzmf } |
| An enum with all the possible values to specify a membership function. More... | |
| enum | qFIS_DeFuzz_Method_t { centroid , bisector , mom , lom , som , wtaver , wtsum } |
| An enum with all the possible de-Fuzzyfication methods. More... | |
| enum | qFIS_ParamValue_t { qFIS_MIN , qFIS_PROD , qFIS_MAX , qFIS_PROBOR , qFIS_SUM } |
| An enum with the supported parameter values. More... | |
| enum | qFIS_Parameter_t { qFIS_Implication , qFIS_Aggregation , qFIS_AND , qFIS_OR , qFIS_EvalPoints } |
| An enum with the allowed parameters that can be set on a FIS instance. More... | |
| enum | qFIS_Type_t { Mamdani , Sugeno , Tsukamoto } |
| An enum with the inference system types supported by qFIS. More... | |
Functions | |
| int | qFIS_SetParameter (qFIS_t *const f, const qFIS_Parameter_t p, const qFIS_ParamValue_t x) |
| Set parameters of the FIS instance. | |
| int | qFIS_SetDeFuzzMethod (qFIS_t *const f, qFIS_DeFuzz_Method_t m) |
| Change the default de-Fuzzification method of the FIS instance. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| int | qFIS_Fuzzify (qFIS_t *const f) |
| Perform the fuzzification operation over the crisp inputs on the requested FIS object. | |
| int | qFIS_Inference (qFIS_t *const f) |
| Perform the inference process on the requested FIS object. | |
| int | qFIS_DeFuzzify (qFIS_t *const f) |
| Perform the de-Fuzzification operation to compute the crisp outputs. | |
| int | qFIS_SetRuleWeights (qFIS_t *const f, float *rWeights) |
| Set weights to the rules of the inference system. | |
API for the qFIS Fuzzy Inference System Engine.
For a brief description of this module, please read Fuzzy Inference System Engine
| #define QFIS_RULES_BEGIN |
Start a Fuzzy rule set. The QFIS_RULES_BEGIN statement is used to declare the starting point of a FIS rule set. It should be placed at the start of the rules enumeration. QFIS_RULES_END declare the end of the FIS rule set.
| #define QFIS_RULES_END |
Ends a Fuzzy rule set. The QFIS_RULES_END statement is used to finalize the declaration of a FIS rule set. It should be placed at the end of the rules enumeration. QFIS_RULES_BEGIN declare the start point of the FIS rule set.
| typedef int16_t qFIS_Rules_t |
Type definition to instantiate a set of fuzzy rules.
Rules are defined by combining I/O and membership function tags with the following statements:
QFIS_RULES_BEGIN, IF, IS, IS_NOT, AND, OR, THEN, END and QFIS_RULES_END
Example:
| enum qFIS_DeFuzz_Method_t |
An enum with all the possible de-Fuzzyfication methods.
| Enumerator | |
|---|---|
| centroid | Center of gravity of the fuzzy set along the x-axis [ Only for Mamdani FIS ] |
| bisector | Vertical line that divides the fuzzy set into two sub-regions of equal area [ Only for Mamdani FIS ] |
| mom | Middle of Maximum [ Only for Mamdani FIS ] |
| lom | Largest of Maximum [ Only for Mamdani FIS ] |
| som | Smallest of Maximum [ Only for Mamdani FIS ] |
| wtaver | Weighted average of all rule outputs [ Only for Sugeno and Tsukamoto FIS ] |
| wtsum | Weighted sum of all rule outputs [ Only for Sugeno FIS ] |
| enum qFIS_MF_Name_t |
An enum with all the possible values to specify a membership function.
| Enumerator | |
|---|---|
| custommf | Custom user-defined Membership function |
| trimf | Triangular Membership function f(a,b,c) |
| trapmf | Trapezoidal Membership function f(a,b,c,d) |
| gbellmf | Generalized bell-shaped Membership function f(a,b,c) |
| gaussmf | Gaussian Membership function f(s,c) |
| gauss2mf | Gaussian combination Membership function f(s1,c1,s2,c2) |
| sigmf | Sigmoidal Membership function f(a,c) |
| dsigmf | Difference between two sigmoidal Membership functions f(a1,c1,a2,c2) |
| psigmf | Product of two sigmoidal membership functions f(a1,c1,a2,c2) |
| pimf | Pi-shaped membership function f(a,b,c,d) |
| smf | S-shaped membership function f(a,b) |
| zmf | Z-shaped membership function f(a,b) |
| singletonmf | Singleton Membership Function f(a) |
| concavemf | Concave Membership Function f(i,e) |
| spikemf | Spike Membership Function f(w,c) |
| linsmf | Linear s-shaped saturation membership function f(a,b) |
| linzmf | Linear z-shaped saturation membership function f(a,b) |
| rectmf | Rectangle Membership Function f(s,e) |
| cosmf | Cosine Membership Function f(c,w) |
| constantmf | Constant membership function f(a) [Only for Sugeno FIS ] |
| linearmf | Linear membership function f(...) [Only for Sugeno FIS ] |
| tlinsmf | Tsukamoto s-shaped saturation membership function f(a,b) [Only for Tsukamoto FIS ] |
| tlinzmf | Tsukamoto linzmf membership function f(a,b) [ Only for Tsukamoto FIS ] |
| tconcavemf | Tsukamoto z-shaped saturation membership function f(i,e) [Only for Tsukamoto FIS ] |
| tsigmf | Tsukamoto Sigmoid membership function f(a,c) [ Only for Tsukamoto FIS ] |
| tsmf | Tsukamoto S-Shape membership function f(a,b) [ Only for Tsukamoto FIS ] |
| tzmf | Tsukamoto Z-Shape membership function f(a,b) [ Only for Tsukamoto FIS ] |
| enum qFIS_Parameter_t |
An enum with the allowed parameters that can be set on a FIS instance.
| Enumerator | |
|---|---|
| qFIS_Implication | Only qFIS_MIN and qFIS_PROD supported |
| qFIS_Aggregation | Only qFIS_MAX, qFIS_PROBOR and qFIS_SUM supported |
| qFIS_AND | Only qFIS_MIN and qFIS_PROD supported |
| qFIS_OR | Only qFIS_MAX and qFIS_PROBOR supported |
| qFIS_EvalPoints | The number of points for de-fuzzification |
| enum qFIS_ParamValue_t |
| enum qFIS_Type_t |
An enum with the inference system types supported by qFIS.
| int qFIS_DeFuzzify | ( | qFIS_t *const | f | ) |
Perform the de-Fuzzification operation to compute the crisp outputs.
| [in] | f | A pointer to the Fuzzy Inference System instance. |
| int qFIS_Fuzzify | ( | qFIS_t *const | f | ) |
Perform the fuzzification operation over the crisp inputs on the requested FIS object.
| [in] | f | A pointer to the Fuzzy Inference System instance. |
| 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.
| [in] | v | An array with the FIS inputs as a qFIS_Output_t array. |
| [in] | t | The output tag |
| int qFIS_Inference | ( | qFIS_t *const | f | ) |
Perform the inference process on the requested FIS object.
| [in] | f | A pointer to the Fuzzy Inference System instance. |
| 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.
| [in] | v | An array with the FIS inputs as a qFIS_Input_t array. |
| [in] | t | The input tag |
| [in] | min | Minimum allowed value for this input |
| [in] | max | Max allowed value for this input |
| 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.
| [in] | v | An array with the FIS outputs as a qFIS_Output_t array. |
| [in] | t | The output tag |
| [in] | min | Minimum allowed value for this output |
| [in] | max | Max allowed value for this output |
| int qFIS_SetDeFuzzMethod | ( | qFIS_t *const | f, |
| qFIS_DeFuzz_Method_t | m ) |
Change the default de-Fuzzification method of the FIS instance.
| [in] | f | A pointer to the Fuzzy Inference System instance. |
| [in] | m | The de-fuzzification method: use one of the following : centroid, bisector, mom, lom, som, wtaver, wtsum |
| 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.
| [in] | v | An array with the FIS inputs as a qFIS_Input_t array. |
| [in] | t | The input tag |
| [in] | value | The crisp value to set |
| 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.
| [in] | m | An array with the required membership functions as qFIS_MF_t objects. |
| [in] | io | The I/O tag related with this membership function |
| [in] | mf | The user-defined tag for this membership function |
| [in] | s | The wanted shape/form for this membership function, can be one of the following: trimf, trapmf, gbellmf, gaussmf, gauss2mf, sigmf, dsigmf, psigmf, pimf, smf, zmf, singletonmf, concavemf, spikemf, linsmf, linzmf, rectmf, cosmf. |
| [in] | custom_mf | Custom user-defined membership function. To ignore pass NULL as argument. |
| [in] | cp | Points or coefficients of the membership function. |
| [in] | h | Height of the membership function. |
| int qFIS_SetParameter | ( | qFIS_t *const | f, |
| const qFIS_Parameter_t | p, | ||
| const qFIS_ParamValue_t | x ) |
Set parameters of the FIS instance.
| [in] | f | A pointer to the Fuzzy Inference System instance. |
| [in] | p | The requested parameter to change/set. |
| [in] | x | The value of the parameter to set. |
| int qFIS_SetRuleWeights | ( | qFIS_t *const | f, |
| float * | rWeights ) |
Set weights to the rules of the inference system.
| [in] | f | A pointer to the Fuzzy Inference System instance. |
| [in] | rWeights | An array with the values of every rule weight; |
| 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.
| [in] | f | A pointer to the Fuzzy Inference System instance. |
| [in] | t | Type of inference Mamdani, Sugeno or Tsukamoto. |
| [in] | inputs | An array with all the system inputs as qFIS_Input_t objects. |
| [in] | ni | The number of bytes used by inputs. Use the sizeof operator. |
| [in] | outputs | An array with all the system outputs as qFIS_Output_t objects. |
| [in] | no | The number of bytes used by outputs. Use the sizeof operator. |
| [in] | mf_inputs | An array with all the membership functions related to the inputs. This should be an array of qFIS_MF_t objects. |
| [in] | nmi | The number of bytes used by mf_inputs. Use the sizeof operator. |
| [in] | mf_outputs | An array with all the membership functions related to the outputs. This should be an array of qFIS_MF_t objects. |
| [in] | nmo | The number of bytes used by mf_outputs. Use the sizeof operator. |
| [in] | r | The rules set. |
| [in] | wi | An array of size n were the rule strengths will be stored. |
| [in] | n | Number of rules |
| 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.
| [in] | o | An array of type qFIS_Output_t with the FIS outputs. |
| [in] | t | The output tag |
| [in] | x | Array where the x-axis points of the aggregated output will be stored |
| [in] | y | Array where the y-axis points of the aggregated output will be stored |
| [in] | n | Number of elements in x or y. |