This paper presents the modeling, control and evaluation in a real-time simulation (RTS) of a three-phase multilevel inverter based on the modular multilevel converter (MMC) topology. The developed model for MMC includes four decoupled state variables per phase, which are instrumental for the control design, namely injected (output) current, circulating current, total energy, and energy balance between arms. Based on this model, a control scheme is proposed with the aim to regulate and balance the total energy on each converter's phase, regulate the circulating currents, and inject a three-phase current synchronized with the grid voltage. As part of the control process, the proposed controller generates the reference for a modulation scheme to obtain the switching sequence for each converter's cell, which, in this case, is the phase-shifted carrier-based pulse-width modulation (PSC-PWM). As it was already reported in the literature, this particular modulation guarantees self (natural) balance of all capacitor voltages, i.e., they converge to the same steady-state average value without the need of any external balancing controller.INDEX TERMS Modular multilevel converter, phase-shifted carrier-based pulse-width modulation, realtime simulation. I. NOMENCLATURE jth phase, j ∈ {1, 2, 3} k iD energy balance loop -integral gain k pD energy balance loop -proportional gain k iT energy regulation loop -integral gain