Generator controller