  The increasing electric vehicle (EV) adoption challenges the energy
management of charging stations (CSs) due to the large number of EVs and the
underlying uncertainties. Moreover, the carbon footprint of CSs is growing
significantly due to the rising charging power demand. This makes it important
for CSs to properly manage their energy usage and ensure their carbon footprint
stay within their carbon emission quotas. This paper proposes a two-stage
online algorithm for this purpose, considering the different time scales of
energy management and carbon trading. In the first stage, the CS characterizes
the real-time aggregate EV power flexibility, in terms of upper and lower
bounds on the total charging power, by a Lyapunov optimization-based online
algorithm. In the second stage, the CS co-optimizes energy management and
carbon trading, with EV charging power chosen within the aggregate flexibility
region provided by the first stage. A generalized battery model is proposed to
capture the dynamic carbon footprint changes and carbon trading. A virtual
carbon queue is designed to develop an online algorithm for the second stage,
which can ensure the carbon footprint of CS be within its carbon emission quota
and its total operation cost is nearly offline optimal. Case studies validate
the effectiveness and advantages of the proposed algorithm.
