General theory of electrical machines