GoFuzzy
Share
Test fuzzy logic inference systems directly in your browser
Definition
// This line defines an input variable that the fuzzy system will use, // in this case, "temperature". DEFINE temperature ( // This defines a "fuzzy set" or a state named "hot" for the temperature variable. // The "hotness" is 0 at 20 degrees and increases linearly to 100% at 30 degrees. TERM hot LINEAR (20, 30), // This defines a "fuzzy set" or a state named "ok" for the temperature variable. // The "okayness" is 0 at 15 degrees and less, is 100% between 18 and 21 degrees and decreases after. TERM ok TRAPEZOID (15, 18, 21, 25), // This defines another fuzzy set named "cold". // The "coldness" is 100% at 0 degrees and decreases linearly to 0% at 16 degrees. TERM cold LINEAR (16, 0) ); // This defines the output variable for our system, // which is the air conditioner's mode. DEFINE ac_mode ( // This defines a possible output state for the AC, in this case, "heating". // It varies between 0 and 100, 100 indicating full heating power. TERM heating LINEAR (0, 100), // This defines a other possible output state for the AC, "stopped" // It varies between -50 and 50, 0 indicating a fully stopped AC. TERM stopped TRIANGULAR (-50, 0, 50), // This defines the other possible output state for the AC, "cooling". // It varies between 0 and -100, -100 indicating full cooling power. TERM cooling LINEAR (0, -100) ); // This is a fuzzy rule that connects an input to an output. // It states that if the temperature is considered "hot", // then the AC mode should be set to "cooling". IF temperature IS hot THEN ac_mode IS cooling; IF temperature IS ok THEN ac_mode IS stopped; IF temperature IS cold THEN ac_mode IS heating;
Inputs
{ "temperature": 20 }
Execute
Results