Optimal Sampling Rate Assignment With Dynamic Route Selection For Real-Time Wireless Sensor Networks