Energy-saving cyber-physical systems in smart cities