Optimizing charging locations and charging time for energy depletion avoidance in wireless rechargeable sensor networks