In-situ determination of thermal coefficients for electrical machines