Simulation of energy storage system with phase change material (PCM)