  Digital twins have become popular for their ability to monitor and optimize a
process or a machine, ideally through its complete life cycle using simulations
and sensor data. In this paper, we focus on the challenge of accurate and
real-time simulations for digital twins in the context of electrical machines.
To build such a digital twin involves not only computational models for the
electromagnetic aspects, but also mechanical and thermal effects need to be
taken into account. We address mathematical tools that can be employed to carry
out the required simulations based on physical laws as well as surrogate or
data-driven models. One of those tools is a model hierarchy of very fine to
very coarse models as well as reduced order models for obtaining real-time
simulations. The required software tools to carry out simulations in the
digital twin are also discussed. The simulation models are implemented in a
pipeline that allows for the automatic modeling of new machines and the
automatic configuration of new digital twins. Finally, the overall implemented
digital twin is tested and implemented in a physical demonstrator.
