The finite-element analysis for the simulation of magnetic fields in electrical machines leads to an index-1 differential-algebraic equation (DAE) (as opposed to a conventional ordinary differential equation), because the electrical conductivity can be zero in certain regions. First, we construct a DAE-compatible time integration scheme which is energy-balanced, meaning that in a linear system, the input stored and lost powers sum exactly to zero. Second, we use a method based on the energy balance to compute torque. We show that the energy balance method approaches the virtual work principle applied at remeshing layer, as the time step is refined. A similar result also holds if the rotation of the rotor is implemented by Nitsche's method, which is an instance of the so-called mortar methods.