Calculation of transformer core losses with nonlinear loads