Cross-layer design of reconfigurable cyber-physical systems