This thesis deals with the modeling and simulation of wireless sensor networks in order to provide mote accurate prediction of energy consumptions. A SystemC-based system level design and simulation framework is proposed, named as IDEA1. It enables the design space exploration of sensor networks at an early stage. The simulation results include packet delivery rate, transmission latency and energy consumptions. A testbed consisting of 9 motes is built to validate the simulation results of IDEA1. The average deviation between the IDEA1 simulations and the experimental measurements is 4.6%. The performances of IDEA1 are compared with a widely-used WSN simulator,NS-2. With the hardware and software co-simulation, IDEA1 can provide more detailed models of sensor nodes. For offering the simulation results at same abstraction level,IDEA1 only uses one third of the simulation time of NS-2. Finally, two case studies are performed to validate design flow of IDEA1. The performance of IEEE 802.15.4sensor networks is comprehensively evaluated for various traffic loads and configurations of protocol parameters. In addition, a real-time active vibration control application is also studied. By the simulation of IDEA1, the best choice of communication protocols and hardware platforms is found.