A bi-level optimized charging algorithm for energy depletion avoidance in wireless rechargeable sensor networks