This paper describes a method for time-domain electromagnetic modeling for a±50 Mvar static compensator(STATCOM) using a 21-level cascaded converter. The real-time digital simulation algorithm based on the time average method is also presented. Based on digital signal processors(DSPs) and field programmable logic gates(FPGAs), a real-time digital simulator is designed and implemented for the±50 Mvar STATCOM system. By comparing with the simulation results from PSCAD/EMTDC, the real-time digital simulation results are verified. The designed real-time digital simulator has been used to test the actual controller when commissioning the±50 Mvar STATCOM in Shanghai Xijiao Substation.