Optimal PWM for the control of multilevel voltage source inverter