Synchronous Programming of Cyber-physical Systems