Cross-Layer Framework for CPSs