Analysis and modelling of thermostatically-controlled loads