Modeling and Optimal Control Algorithm Design for HVAC Systems in Energy Efficient Buildings