DESIGN OF COST FUNCTIONS FOR THE REAL TIME CONTROL OF MICROGRIDS