Cyber-Physical Systems Design: Electricity Markets and Network Security