# An Optimal Online Resource Allocation Algorithm for Energy Harvesting Body Area Networks
## 1 Introduction  
According to the sixth national census report, the trend of population aging is aggravating year by year. People over 60 years of age account for 13.26% of the total population. People over 65 years of age account for 8.87% of the total population [1]. The aging of the population has brought us a series of related questions [2]. It is expected that about half of the medical resources will be used to solve the health problems of the elderly in future, which will be a serious challenge for the allocation of limited current medical resources. Chronic diseases have been a threat to human survival [3]. Heart disease, malignancy, cerebrovascular disease, chronic respiratory disease, influenza and diabetes are the deadliest cause of death [4, 5]. Traditional medical care is that the doctor test and treat patient through the medical equipment in hospital. This requires that patients lie in the bed and connect a large number of lines, which not only greatly limits the patient's range of activities but also cannot complete the early diagnosis and remote health-care [6, 7, 8]. Moreover, more and more wireless networks are used. Electronic devices are also becoming smaller and smaller [9]. In such conditions, BANs have developed. Body area networks have gained momentum as a means of monitoring people's behavior, which are networks attached to the human body [10]. BAN is composed of some small and mobile sensors with communication capability, whose design problem is often addressed through mathematical optimization techniques (e.g., [7, 11, 12, 13]). By implanting these sensors into the human body or wearing them on the human body, they form a local area network. These sensors detect thepatient's physiological signals in real time [14; 15]. In addition, they can collect and transmit patient's physiological signals at home and at random [16]. Therefore, researchers are paying more and more attention to the use of BANs. In a BAN, each patient wears sensors on the body or embeds special sensors in the body that can continuously monitor the various physiological signals of the body and transmit it to the personal device wirelessly. Then, the information can be transmitted through the external network to the medical system. By analyzing and dealing with the collected data, the physiological signals of the human body are diagnosed, and the early diagnosis is completed, thus ensuring the safety of human life. However, the BANs are facing great challenges. One of the most serious challenges is the energy efficiency [17]. How to supply a sensor is related to how to provide a lasting service for BANs. At present, most of the sensors in BANs are configured with batteries, but the battery capacity is very limited [18; 19; 20]. Considering the friendliness to patients, we cannot replace the battery frequently [21]. More importantly, some physiological signal sensors, such as implanted blood pressure sensors, implanted PH sensors, they are implanted into the human body, so we cannot replace the battery. In this condition, energy harvesting technology is developed [22]. Energy harvesting technology is very important to prolong sensor's lifetime in BANs [23]. Many implanted sensors require a long lifetime. For example, a pacemaker or a glucose monitor would require a lifetime lasting more than five years [2]. By using energy harvesting technology, sensors harvest energy from the renewable sources in the area of interest [24]. In fact, the sensor in BANs is equipped with energy harvesting modules [25], which provide a time-independent amount of energy with respect to the batteries. The sensor harvest energy to collect data and transmit it. In this paper, we investigate the energy efficiency in BAN that consists of a number of medical sensors, by jointly considering the data buffers and energy buffers' management. The sensor collects data and saves in its data buffers, and so does the energy.