Optimization of Thermal Storage Based on Load Graph