Real-Time HIL Simulation of Grid-Tied Switched-Mode Power Systems