Optimization And Energy Management Of A Microgrid Based On Frequency Communications