The Scientific World Journal / 2014 / Article / Alg 4

Research Article

An Evaluation and Implementation of Rule-Based Home Energy Management System Using the Rete Algorithm

Algorithm 4

An example of rule in Ruby.
rule:entrance_light,
ElecAppliance,:ea,
 m.location ENTRANCE_LOCATION,
 m.type LIGHT_APPLIANCE_TYPE,
 m.status OFF_STATUS ,
SensorData,:s,
 m.id ID_FOR_TV_ON_LIVING_ROOM,
 m.type WATT_SENSOR_TYPE,
 m.value > 1 do ∣context∣
 set_status(context :ea .ip, # IP of the tap
  context :ea .socket_id, “ON”)
 context :ea .status = ON_STATUS
 modify context :ea
end

You are browsing a BETA version of Hindawi.com. Click here to switch back to the original design.