Real-time state of charge estimation in thermal storage vessels applied to a smart polygeneration grid