Optimal control strategy of a DC micro grid