In this paper, an advanced real-time energy management system is proposed in order to optimize micro-grid performance in a real-time operation. The proposed strategy of the management system capitalizes on the power of binary particle swarm optimization algorithm to minimize the energy cost and carbon dioxide and pollutant emissions while maximizing the power of the available renewable energy resources. Advanced real-time interface libraries are used to run the optimization code. The simulation results are considered for three different scenarios considering the complexity of the proposed problem. The proposed management system along with its control system is experimentally tested to validate the simulation results obtained from the optimization algorithm. The experimental results highlight the effectiveness of the proposed management system for micro-grids operation.