  This paper considers the power allocation of a single-link wireless
communication with joint energy harvesting and grid power supply. We formulate
the problem as minimizing the grid power consumption with random energy and
data arrival, and analyze the structure of the optimal power allocation policy
in some special cases. For the case that all the packets are arrived before
transmission, it is a dual problem of throughput maximization, and the optimal
solution is found by the two-stage water filling (WF) policy, which allocates
the harvested energy in the first stage, and then allocates the power grid
energy in the second stage. For the random data arrival case, we first assume
grid energy or harvested energy supply only, and then combine the results to
obtain the optimal structure of the coexisting system. Specifically, the
reverse multi-stage WF policy is proposed to achieve the optimal power
allocation when the battery capacity is infinite. Finally, some heuristic
online schemes are proposed, of which the performance is evaluated by numerical
simulations.
