Hi all,
I've just started working with Take and that's why my question is on
beginner level. I wanted to create thermostat case logic. It is the
example from Negnevitzky's book. More information about that can be
found here:
https://ai.ia.agh.edu.pl/wiki/hekate:hekate_case_thermostat.
I want to ask, if my Take implementation is correct. I'm using simple
types: String, Integer. I need it for my master thesis, so I'd
thankfull for any feedback ;-)
My rules:
// thermostat rules
@@dc:creator=Lukasz Lysik
@@dc:date=22/02/2009
var String operation,season,today,day
var Integer month, hour
@take.compilerhint.slots=month,day,hour,setting
@take.compilerhint.method=thermostat_setting
query thermostat_setting[in,in,in,out]
os01: if season_name[month,season] and today_is[day,today] and
operation_name[today,hour,operation] and operation == "nbizhrs" and
season == "summer" then thermostat_setting[month,day,hour,27]
os02: if season_name[month,season] and today_is[day,today] and
operation_name[today,hour,operation] and operation == "bizhrs" and
season == "summer" then thermostat_setting[month,day,hour,24]
os03: if season_name[month,season] and today_is[day,today] and
operation_name[today,hour,operation] and operation == "nbizhrs" and
season == "spring" then thermostat_setting[month,day,hour,15]
os04: if season_name[month,season] and today_is[day,today] and
operation_name[today,hour,operation] and operation == "bizhrs" and
season == "spring" then thermostat_setting[month,day,hour,20]
os05: if season_name[month,season] and today_is[day,today] and
operation_name[today,hour,operation] and operation == "bizhrs" and
season == "winter" then thermostat_setting[month,day,hour,18]
os06: if season_name[month,season] and today_is[day,today] and
operation_name[today,hour,operation] and operation == "nbizhrs" and
season == "winter" then thermostat_setting[month,day,hour,14]
os07: if season_name[month,season] and today_is[day,today] and
operation_name[today,hour,operation] and operation == "nbizhrs" and
season == "fall" then thermostat_setting[month,day,hour,16]
os08: if season_name[month,season] and today_is[day,today] and
operation_name[today,hour,operation] and operation == "bizhrs" and
season == "fall" then thermostat_setting[month,day,hour,20]
ms01: if month == 1 then season_name[month,"winter"]
ms02: if month == 2 then season_name[month,"winter"]
ms03: if month == 3 then season_name[month,"spring"]
ms04: if month == 4 then season_name[month,"spring"]
ms05: if month == 5 then season_name[month,"spring"]
ms06: if month == 6 then season_name[month,"summer"]
ms07: if month == 7 then season_name[month,"summer"]
ms08: if month == 8 then season_name[month,"summer"]
ms09: if month == 9 then season_name[month,"fall"]
ms10: if month == 10 then season_name[month,"fall"]
ms11: if month == 11 then season_name[month,"fall"]
ms12: if month == 12 then season_name[month,"winter"]
dt01: today_is["mon","workday"]
dt02: today_is["tue","workday"]
dt03: today_is["wed","workday"]
dt04: today_is["thu","workday"]
dt05: today_is["fri","workday"]
dt06: today_is["sat","weekend"]
dt07: today_is["sun","weekend"]
th01: if today == "workday" and hour > 17 then operation_name
[today,hour,"nbizhrs"]
th02: if today == "weekend" then operation_name[today,hour,"nbizhrs"]
th03: if today == "workday" and hour < 9 then operation_name
[today,hour,"nbizhrs"]
th04: if today == "workday" and hour >= 9 and hour <= 17 then
operation_name[today,hour,"bizhrs"]
Thank you,
Lukasz