Reducing the Peak Power through Real-Time Scheduling Techniques in Cyber-Physical Energy Systems