Motor connected to generator
If the exciter coil is connected to an external power supply, then the entire power input to that supply is part of the system losses. The exciter losses are only taken from the mechanical input when there is a separate exciter generator that is driven by the mechanical input. Even then, there may be external power used to control the excitation.

Added information:


  $$P = P_\text{loss, mechanic} + I_0^2 R_0 + P_\text{loss, iron}$$


That is the general equation, but with no output, I = 0, so the second term is zero. The magnetization of the rotor by the exciter is DC, so there is no rotor iron loss caused by excitation. There is only I^2 R loss. Even without stator current, there would be iron loss in the stator due to the rotor field moving through it.

If the rotor excitation is supplied through slip-rings, it would need to be initially supplied from an external source, but would be probably be supplied by the stator once generation is established. However, this is a laboratory test set-up, so there would be not reason to do that.