Skip to main content
. 2018 Mar 15;18(3):865. doi: 10.3390/s18030865
Algorithm 1 Energy saving algorithm
1: procedure energySaving(period)
2:   if timeperiod == Academic ∧ presence == Yes then
3:     tmpnow = tmpdesiredtmpindoor
4:     if roomtype == Private then
5:        if ((Tback − 60 min × tmpnow ≤ time) ∧ timebackPeriod > 60 min) ∨ (Tback ≤ time + 30 min ∧ timebackPeriod > 60 min) then
6:          if tmpnow > 0 then
7:             while proxTback − 60 min × tmpnow do
8:                thermostattmp + 1                        ▷ Increased temperature
9:          else if tmpnow < 0 then
10:            while proxTback − 60 min × tmpnow do
11:               thermostattmp − 1                        ▷ Decrease temperature
12:        else if roomtype == Common then
13.          if timeperiodDay ƒ = Night then
14:            n = timenow
15:            if timeperiodDay == Morning then
16:                while timeperiodDay = Morning do
17:                  thermostatstmp = i=7ntmpindoori
18:                  if tmpdesired = thermostatstmp then
19:                    break loop
20:           else if timeperiodDay == Afternoon then
21:                while timeperiodDay = Afternoon do
22:                  thermostatstmp = i=15ntmpindoori
23:                  if tmpdesired = thermostatstmp then
24:                    break loop
25:           else if timeperiodDay == Evening then
26:                while timeperiodDay = Evening do
27:                  thermostatstmp = i=21ntmpindoori
28:                  if tmpdesired = thermostatstmp then
29:                    break loop
30:           else
31:            thermostatsstatus = Off
32:        else if timeperiod == NonAcademic ∧ timeperiod 10 days then
33:          thermostatsstatus = Off
34:        thermostatsstatus = Off
35:   else
36:        thermostatsstatus = On