Energy management in solar cells powered wireless sensor networks for quality of service optimization