  We develop an algorithm for synthesizing a spatial pattern of
charging/discharging operations of in-vehicle batteries for provision of
Ancillary Service (AS) in power distribution grids. The algorithm is based on
the ODE (Ordinary Differential Equation) model of distribution voltage that has
been recently introduced. In this paper, firstly, we derive analytical
solutions of the ODE model for a single straight-line feeder through a partial
linearization, thereby providing a physical insight to the impact of spatial EV
charging/discharging to the distribution voltage. Second, based on the
analytical solutions, we propose an algorithm for determining the values of
charging/discharging power (active and reactive) by in-vehicle batteries in the
single feeder grid, so that the power demanded as AS (e.g. a regulation signal
to distribution system operator for primary frequency control reserve) is
provided by EVs, and the deviation of distribution voltage from a nominal value
is reduced in the grid. Effectiveness of the algorithm is established with
numerical simulations on the single feeder grid and on a realistic feeder grid
with multiple bifurcations.
