module Thermostat {
  var temp: integer;
  var heatOn: boolean;
  var heatOff: boolean;
  var time: integer;

  init {
    heatOn = (temp <= 20);
    time = 0;

  }
  next {
    time' = (time + 1);
    if (heatOn) {
      if (time >= 30) {
        heatOn' = false;
        heatOff' = true;
      }
    }
    if (heatOff) {
      if (time >= 120) {
        heatOff' = false;
        heatOn' = (temp <= 20);
      }
    }

  }
}
