The high complexity of modern power systems forces engineers to design, implement, and test different equipment, precisely. The real-time simulator is one of the best tools for a researcher to test and verify complex power systems in the laboratories. Based on this issue, they can study power system control methods as well as the effects of various models in the partially simulated system. This paper presents a low-cost and versatile power system simulator that is applicable for a wide range of real-time hardware in the loop (RT-HIL) simulations of power systems. To implement the proposed closed-loop simulator, all the essential parts of a power plant, including generator, turbine-governor, excitation system (automatic voltage regulator (AVR), and power system stabilizer (PSS)), grid interconnection and loads are implemented in MATLAB/Simulink environment. To achieve fast and reliable measurement functions, dedicated programs are developed in the LabVIEW real-time and related FPGA programming environments. The data transfer between the MATLAB/Simulink model and LABVIEW and its real-time hardware (PXIe-8133) is accomplished by building a *.dll file as an inbuilt function. A HIL simulation of the excitation system is implemented using a real excitation cabinet to test system capability and also investigate system reaction against disturbances. The performance of the proposed simulator is investigated under various scenarios such as excitation voltage set-point change, the step response of automatic voltage regulator, network three-phase fault, torque step, and step load changes. The close correspondence between HIL and MATLAB/Simulink simulations reveals the validity of the implemented model for the excitation system as well as the effectiveness, flexibility, versatility, applicability, and usefulness of the offline/online closed-loop simulator for power system modeling and development.