Due to climate change, energy crisis and environmental concern, microgrid including distributed generations become popular in the electric energy industry, since the microgrid can improve the benefits of energy while providing reliable power supply. In order to further maximize economic benefits by improving the utilization rate of renewable energy, this paper builds an optimal dispatching model to optimize grid configuration, in which the electricity price is taken as the main reference element. The effectiveness of particle swarm optimization is illustrated with the power curves of optimal economic operation of microgrid.