Active flicker compensation in medium-voltage lines using multilevel converters