The residual power levels of the nodes in a wireless sensor network determine its important performance metrics like the network lifetime, coverage, and connectivity. In this paper, we present a general framework to model the availability of power at sensor nodes as a function of time, based on models for population dynamics in biological studies. Models are developed for sensors with and without battery recharging and expressions are derived for the network lifetime as well as the distribution and moments of random variables describing the number of sensors with different levels of residual energy as a function of time. The model is also extended to the case where new sensors are periodically added to the network to substitute older sensors that have expended their energy. Finally, the effect of the packet arrival rates and a sensor's geographical location are modeled. Simulation results to verify the accuracy of the proposed models are presented.