  Cyber-physical systems require the construction and management of various
models to assure their correct, safe, and secure operation. These various
models are necessary because of the coupled physical and computational dynamics
present in cyber-physical systems. However, to date the different model views
of cyber-physical systems are largely related informally, which raises issues
with the degree of formal consistency between those various models of
requirements, system behavior, and system architecture. We present a
category-theoretic framework to make different types of composition explicit in
the modeling and analysis of cyber-physical systems, which could assist in
verifying the system as a whole. This compositional framework for
cyber-physical systems gives rise to unified system models, where system
behavior is hierarchically decomposed and related to a system architecture
using the systems-as-algebras paradigm. As part of this paradigm, we show that
an algebra of (safety) contracts generalizes over the state of the art,
providing more uniform mathematical tools for constraining the behavior over a
richer set of composite cyber-physical system models, which has the potential
of minimizing or eliminating hazardous behavior.
