In view of the problem of harmonic interference in DC bus and the aperiodic characteristics of DC side current and voltage waveform in DC distribution system, based on the in-depth study of the factors affecting the metering accuracy of traditional electric energy metering algorithm, this paper deeply analyzes the influence of a large number of harmonics in DC electric energy on the measurement results, and puts forward an improvement scheme for DC electric energy metering algorithm. The complex Newton Cotes algorithm and Romberg quadrature method are introduced into the electric energy measurement of DC distribution network. The high-order integration method is used to integrate the power to achieve high-precision electric energy measurement without increasing the measurement amount of the measurement algorithm. Compared with the traditional electric energy metering method, the algorithm proposed in this paper has simple structure and higher metering accuracy, which is suitable for the accurate measurement of electric energy in DC distribution system.