Resource management for energy and spectrum harvesting sensor networks