Added IF functions to determin ON/OFF cycle based on Setpoint.