Prediction of core losses in switched reluctance motors using finite element method and rainflow algorithm