Design and installation of mains fail and generator control systems