Centralized Control of Dispersed Generators Providing Ancillary Services in Distribution Networks Part I: Theoretical Aspects