General time-varying state-space control model and its application for transient beam loading compensation