Controller Design of Stand-Alone or Grid-Connected Inverter to Compensate Harmonics Caused by Nonlinear Load