Occupancy-based demand response and thermal comfort optimization in microgrids with renewable energy sources and energy storage