Optimal Scheduling And Control Of Microgrid Power Flow