Abstract:Harmonic voltages and currents in electrical systems, when present to a certain degree, represent not only a power quality problem but they are also strongly associated with the electrical system overall losses and they are arguably a source of instability and a safety concern. Mitigating harmonics distortion across the entire system by actively reducing harmonic currents propagation is an effective way of coping with these issues and can be dealt with the injection of a compensating current waveform with an active filter installed at a given bus. This paper shows how, by shaping the compensating current waveform in an optimal way, the overall electrical system harmonic distortion can be optimally reduced in a cost effective manner with a minimum size of the compensating device. The process of shaping this optimal compensating current is shown by how its components are defined by the optimization algorithm using the phase and amplitude of each harmonic as degrees of freedom in the process of finding the optimal waveform. A marine vessel distribution grid is used as representative example to prove the concept.