Performance study and improvement of routing protocols in wireless sensor networks under varying network conditions