Analysis of model for control of thermal energy in buildings