module main {
    type state_t = enum { OFF, ON };
    var heaterState : state_t;
    input temp : real;
    output heatOn : boolean;
    output heatOff : boolean;

    // Constants
    const setpoint : real = 20.0;
    const upperLimit : real = 22.0;
    const lowerLimit : real = 18.0;

    // Initialize the state of the heater
    init {
        heaterState = OFF;
        heatOn = false;
        heatOff = false;
    }

    // Define the transitions based on the temperature
    next {
        if (heaterState == OFF && temp <= lowerLimit) {
            heaterState' = ON;
            heatOn' = true;
            heatOff' = false;
        } else if (heaterState == ON && temp >= upperLimit) {
            heaterState' = OFF;
            heatOn' = false;
            heatOff' = true;
        } else {
            heatOn' = false;
            heatOff' = false;
        }
    }
}
