module main {
    type state_t = enum { ON, OFF };

    var temp : int;
    var heatState : state_t;
    var time : int;

    init {
        temp = 15; // Initial temperature can be set to any value for simulation purposes
        heatState = if (temp <= 20) then ON else OFF;
        time = 0;
    }

    next {
        time' = time + 30; // System reacts every 30 seconds

        if (heatState == ON) {
            if (time >= 30 && temp > 20) {
                heatState' = OFF;
                time' = 0; // Reset time after state change
            }
        } else if (heatState == OFF) {
            if (time >= 120 && temp <= 20) {
                heatState' = ON;
                time' = 0; // Reset time after state change
            }
        }

        // Temp can be updated here based on external factors, for simulation purposes we assume it's constant
    }

    control {
        v = simulate 10;
        print_trace;
    }
}
