Wireless Sensor Networks (WSNs) are networks of distributed autonomous sensors that monitor and collect environmental data, such as temperature, sound, vibration, pressure, or motion. These networks are key in IoT applications, environmental monitoring, healthcare, smart homes, etc. NS2 (Network Simulator 2) is a discrete event network simulator that is widely used for simulating wireless networks, including WSNs, due to its flexible and powerful simulation environment.NS2 is an open-source network simulator that allows researchers to model various network topologies and protocols. It supports both wired and wireless networks and can be extended with custom protocols. For WSN simulations, NS2 provides various modules, such as the mobile node model and energy models, that can simulate the behavior of sensor nodes in a WSN. Each node in a WSN is typically composed of sensors, a microcontroller, a transceiver, and a power source. These nodes monitor physical phenomena and relay data to a central node (sink). The nodes in a WSN communicate with each other and the sink via wireless links. Communication protocols vary depending on network requirements, such as energy efficiency, latency, and reliability.