Abstract:Simulation technology plays an irreplaceable role in the development of relay protection. C source code can be embedded in the simulation model by the interface technology of custom modules in PSCAD. This can realize closed-loop simulation at source code level for digital relays. To solve the problem of low efficiency in the implementation of C source code level simulation, the method in this paper has improved the calling interface and the data interface. The realization process and effects are explained by an instance. The calling interface is implemented by calling a Fortran function in the Script of custom components. This makes debugging the C source code much simpler. The data interface is realized directly by the input and output ports of custom components, and this will avoid the use of complex public arrays. The proposed method can be used to verify the source code embedded in an actual protective relay flexibly and simply. It is particularly suitable in the transition stage between studying principles and developing a device, because developers can validate the source code independently of a physical device. This will greatly improve the efficiency. This work is supported by Key Research and Development Program of Hunan Province (No. 2016GK1003) “Research and Application of Key Technology of Vanadium Flow Battery Energy Storage System”.