module ThermostatModule {
  var heater_state: boolean;
  var hysteresis_high: real;
  var hysteresis_low: real;

  input temp: real;

  output heatOn: boolean;
  output heatOff: boolean;

  init {
    heater_state = false;
    heatOn = false;
    heatOff = false;

  }
  next {
    if (!heater_state && (temp < hysteresis_low)) {
      heatOn' = true;
      heatOff' = false;
      heater_state' = true;
    } else {
      if (heater_state && (temp > hysteresis_high)) {
        heatOn' = false;
        heatOff' = true;
        heater_state' = false;
      } else {
        heatOn' = false;
        heatOff' = false;
      }
    }

  }
}
