Wireless sensor networks (WSNs) simulation is essential for the development and optimization of such kind of networks. In this paper we present modifications made to prowler, a WSNs simulator, making its MAC protocol model compliant with the crossbow MICAz mote running on Tiny OS. Moreover, we added radio propagation models to the simulator and, most important, we implemented an energy consumption estimation model of the CC2420 radio chip. Then, the simulator is addressed to the development of WSNs applications with a particular emphasis on energy consumption optimization (and consequently battery lifetime). We present as case study the comparison between simulated results of two different physical deployments, showing how real operating conditions can affect and modify the system behavior in comparison with the results predicted by theoretical analysis.