The Grounding fault location and protection is a key technology for the DC power system and is important to the normal operation of the power system and the safety of operators. The grounding fault location protection method based on additional grounding resistance is introduced in this paper, and its controller is made. It takes high risk and cost to directly test the controller directly in the DC power system. Therefore, a hardware in loop (HIL) real-time simulation system is established on the real-time simulation platform RT-LAB to verify the function of the controller. The real-time simulation results are compared with those obtained from MATLAB/ simulink off-line simulation, which shows that the grounding fault location and protection method is feasible and effective, and that the controller has successfully implemented its function.