Modeling the Performance of Wireless Sensor Networks