  Phase balancing is essential to safe power system operation. We consider a
substation connected to multiple phases, each with single-phase loads,
generation, and energy storage. A representative of the substation operates the
system and aims to minimize the cost of all phases and to balance loads among
phases. We first consider ideal energy storage with lossless charging and
discharging, and propose both centralized and distributed real-time algorithms
taking into account system uncertainty. The proposed algorithm does not require
any system statistics and asymptotically achieves the minimum system cost with
large energy storage. We then extend the algorithm to accommodate more
realistic non-ideal energy storage that has imperfect charging and discharging.
The performance of the proposed algorithm is evaluated through extensive
simulation and compared with that of a benchmark greedy algorithm. Simulation
shows that our algorithm leads to strong performance over a wide range of
storage characteristics.
