Euler-Lagrange optimization of electric drives with DTM method