A real-time EMS able to manage uncertainties in the forecasting data. Integration of the economical aspects and system operator requirements. A two-frame algorithm. Application and validation on University of Genoa Smart Polygeneration Microgrid (SPM).