Heterogeneous network, which is a key technology of fifth generation(5G) mobile communication system, can effectively solve the spectrum resource shortage in the communication system. However, with densified deployment of base stations (BSs) and growth of user quantity and communication data size, the system energy consumption of BSs has imposed enormous economic pressure on network operators. As a result, energy consumption decreases and cost of communication system becomes a problem that requires urgent solutions. Renewable energy power generation devices of BSs have provided an opportunity for solving this problem with the development of smart power grids. However, the production rate of renewable energy sources presents intense volatility because of the influence of weather factors. This condition brings new challenges to the energy allocation of communication system. Therefore, an energy sharing link between BSs was established in a heterogeneous wireless network, and the distance between macro-BS and micro-BS was taken as an index. The energy consumption-based energy and user joint allocation method and energy cost-based energy and user joint allocation method were proposed. The two multi-objective optimization problems were converted into two convex optimization problems, and the optimal allocation strategies were solved using convex optimization toolbox. Simulation results indicate that the energy consumption-based allocation method takes energy consumption as the optimization objective and makes the shared link transmit energy sources as few as possible. This way reduces energy consumptions of the link and the system. Starting from the economic angle, the energy cost-based allocation method considers the influence of energy price, coordinates energy allocation between BSs based on energy cost using the shared link, and optimizes energy allocation among BSs at each time slot. Therefore, the method can reduce the energy cost of the system by a large margin. INDEX TERMS 5G, energy sharing, green communication, energy allocation, user allocation, convex optimization. I. INTRODUCTION In recent years, the energy consumption of information and communication technology (ICT) has become an economic issue for operators and a major challenge for sustainable development. The energy consumption of the ICT industry accounts for approximately 3% of global annual energy consumption, and this figure is growing at an annular rate of 15%-20% [1]. With the rapid development of wireless communication technology and Internet of Things (IoT) technology [2], the quantity of equipment connected to wireless communication base stations (BSs) will present exponential The associate editor coordinating the review of this manuscript and approving it for publication was Jun Wu. growth in the future. By 2020, the demand for high-speed data traffic, such as high-quality wireless video streaming, social networking services, and IoT communication, will grow by 1,000 times [3]. If effective measures are not taken, then mobile communication ...