A key challenge in wireless ad hoc networks is to achieve maximum lifetime for battery-powered mobile devices with dynamic energy efficient algorithms. Recent study in battery technology reveals that the behavior of battery discharging is more complex than we used to think. Battery powered devices might waste a huge amount of energy if we do not carefully schedule and budget their discharging. In this paper, we introduce a novel energy model for batteries and study the effect of battery behavior on routing in wireless ad hoc networks. Based on this model, we also propose a battery-aware routing protocol. The paper consists of two parts. In Part I of the paper, we propose an on-line computable discrete time analytical model to mathematically model battery discharging behavior. The model has low computational complexity and does not require large look-up tables. It is suitable for on-line battery capacity computation in ad hoc network routing. We use the data collected from actual nickel-cadmium battery to evaluate the performance of our model and the results show that it can accurately capture the behavior of battery discharging. In Part II of the paper [1], a battery-aware routing protocol (BAR) is proposed based on the new battery model. By dynamically choosing the nodes with well recovered batteries as routers, and leaving the "fatigue" nodes for recovery, the BAR protocol can effectively recover the node's battery capacity and achieve higher energy efficiency. Our simulation results show that the BAR protocol can increase network lifetime and total data throughput by up to 28% and 24%, respectively, compared with previous routing protocols. As far as we know, this is the first work considering battery-awareness with an accurate on-line computable battery model in ad hoc network routing. We believe our battery model can be used to explore other energy efficient schemes for wireless networks as well.