The invention discloses a method for calculating a transient energy function of a renewable energy power system, and belongs to the field of transient stability analysis of power systems. The method comprises the steps of firstly, establishing a mathematical model of a to-be-analyzed power system, eliminating intermediate nodes, and only reserving renewable energy equipment nodes, synchronous generator nodes and power load nodes; representing the transient process of the renewable energy equipment by a second-order phase-locked loop equation, representing the transient process of the synchronous generator equipment by a second-order swing equation, respectively listing and writing energy functions of all renewable energy equipment, the synchronous generator equipment, the power network andall power loads, and adding all the energy functions to obtain a transient energy function of the power system. Compared with the prior art, the method considers the transient energy function of thepower system when the renewable energy equipment and the synchronous generator are connected to the power grid at the same time, can analyze the transient stability of the system including the synchronous generator equipment and the renewable energy equipment, and expands the application range of the energy function direct method.