A self-sensing approach to the energy-saving operation of electromagnetic locking devices