# Creating a Rule Base (PID and Fuzzy Logic Toolkit)

LabVIEW 2012 PID and Fuzzy Logic Toolkit Help

Edition Date: June 2012

Part Number: 370401J-01

»View Product Info Download Help (Windows Only)

After create linguistic variables, defining linguistic terms, and creating membership functions, the last step of fuzzy system design is creating a rule base. Rules describe, in words, the relationships between input and output linguistic variables based on their linguistic terms. A rule base is the set of rules for a fuzzy system.

To create a rule, you must specify the antecedents, or IF portions, and consequents, or THEN portions, of the rule. For example, consider the following rule for a vehicle maneuvering fuzzy system:

 IF Vehicle Position x is Left Center AND Vehicle Orientation β is Left Up, THEN Steering Angle φ is Positive Small.

The clauses "Vehicle Position x is Left Center" and "Vehicle Orientation β is Left Up" are the antecedents of this rule. The clause "Steering Angle φ is Positive Small" is the consequent of this rule.

Associate an input linguistic variable with a corresponding linguistic term to form an antecedent. Associate an output linguistic variable with a corresponding linguistic term to form a consequent. The consequent of a rule represents the action you want the fuzzy controller to take if the linguistic terms of the input linguistic variables in the rule are met.

When constructing a rule base, avoid contradictory rules, or rules with the same IF portion but different THEN portions. A consistent rule base is a rule base that has no contradictory rules. Note   The rule base itself the biggest influence on the I/O characteristics of a fuzzy controller. The rule base determines the principal functionality of the controller. Refer to the Using the Mean of Maximum (MoM) Defuzzification Method example to see how changing the rule base can affect the output characteristic of a fuzzy controller.

## Total Possible Rules

The total number N of possible rules for a fuzzy system is defined by the following equation:

N = p1*p2*...*pn

where pn is the number of linguistic terms for the input linguistic variable n.

If each input linguistic variable has the same number of linguistic terms, the total number N of possible rules is defined by the following equation:

N = pm

where p is the number of linguistic terms for each input linguistic variable and m is the number of input linguistic variables. For example, for three input linguistic variables with five linguistic terms each, the total number of possible rules is N = 53 = 125.