There are problems such as low scalability and low convergence accuracy in the economic dispatch of smart grids. To address these situations, this study considers various constraints such as supply-demand balance constraints, climb constraints, and capacity constraints based on the unified consensus algorithm of multi-agent systems. By using Lagrange duality theory and internal penalty function method, the optimization of smart grid economic dispatch is transformed into an unconstrained optimization problem, and a distributed second-order consistency algorithm is proposed to solve the model problem. IEEE6 bus system testing showed that the generator cost of the distributed second-order consistency algorithm in the first, second, and third time periods was 2.2475 million yuan, 5.8236 million yuan, and 3.7932 million yuan, respectively. Compared to the first-order consistency algorithm, the generator cost during the corresponding time period has increased by 10.23%, 11.36%, and 13.36%. The actual total output has reached supply-demand balance in a short period of time with the changes in renewable energy, while maintaining supply-demand balance during the scheduling process. The actual total output during low, peak, and off peak periods was 99MW, 147MW, and 120MW, respectively. This study uses distributed second-order consistency algorithm to solve the economic dispatch model of smart grid to achieve higher convergence accuracy and speed. The study is limited by the assumption that the cost functions of each power generation unit are quadratic convex cost functions under ideal conditions. This economic dispatch model may not accurately reflect practical applications.