Energy management in wireless cellular and ad-hoc networks