GRID AWARE REAL TIME DISPATCH OF MICROGRID WITH GENERALIZED ENERGY