Multi-state techno-economic model for optimal dispatch of grid connected hydrogen electrolysis systems operating under dynamic conditions