A Dynamic Algorithm to Improve Industrial Wireless Sensor Networks Management