Sensors and effectors are merely aliases for method names on Java objects and allow you to call named methods from within rules while the rules are being evaluated by the fuzzy inference engine. Sensors are typically used in assertions and antecedent clauses to unconditionally set or test a variable's current value to some real time value in the external world. Effectors are used in consequent clauses to effect a change in the external world.
Use this statement to declare that certain methods will be available to be called during inferencing from within rules. Any methods named in the Sensors statement can be used in assertions and antecedent clauses of rules. It is up to you to pass in the proper number of arguments to a sensor when it is invoked.
Sensors ( <sensorNames>* )
Sensors() // No sensors available at runtime Sensors(a, b) // Two sensors available at runtime: // method a and method b. // Rules that use the declared sensors: r1: myVar = a() // The result of calling sensor a is // placed into variable myVar. r2: otherVar = b(someVar) // The result of calling sensor b // with argument someVar is placed // into variable otherVar. r3: if myVar = a() then... // myVar is tested against the // value returned by sensor a.
Sensors is an optional statement and may be omitted altogether.
Return to topUse this statement to declare that certain methods will be available to be called during inferencing from within rules. Any methods named in the Effectors statement can be used in consequent clauses of rules. It is up to you to pass in the proper number of arguments to an effector when it is invoked.
Effectors ( <effectorNames>* )
Effectors() // No effectors available at runtime Effectors(a, b) // Two effectors available at runtime: // method a and method b. // Rules that use the declared effectors: r1: if myVar = x then // If the condition is true y = a(); // the result of calling effector a // is placed into variable y. r2: if myVar = x then // If the condition is true y = b(someVar); // the result of calling effector b // with argument someVar is // placed into variable y.
Effectors is an optional statement and may be omitted.
Return to top