Electric power systems include discrete control elements like line switches, but are commonly modelled as continuous dynamic systems in the engineering literature. In the present paper, we combine computer science methods and engineering models in a novel approach to model power systems as Flat Hybrid Automata. These models include the discrete control elements and the respective continuous dynamics of the system. Based on this system representation, we show how controlled line switching can be implemented in an elegant and electrotechnically meaningful way, taking advantage of new possibilities offered by power electronics. To this end, we demonstrate how to compute smooth trajectories that allow for line switching without discontinuities in the system states for an academic AC microgrid example.