*3.5. Applications: Optimization Engine*

Existing solutions often use proprietary platforms and site-specific specifications for generating and sending optimal control signals to devices. Similarly to how XBOS is used as middleware platform by SPO, the open-source package MPCPy [73] is used to implement MPC-based optimization in an extensible and open-source framework. SPO integrates MPCPy as an XBOS application, extending its capabilities to interact with real-time systems. This application, labeled as the "Optimization Engine" queries historical data and future forecasts from the data store, solves the optimization problem using the MPCPy framework and publishes control signals to devices through WAVEMQ. Figure 4 depicts this interaction between the optimization engine, the data store and the device drivers. Through this implementation, SPO provides a scalable, protocol- and manufacturer-independent solution for implementing advanced building controls. This section details the components of the optimization engine.

**Figure 4.** The optimization engine component and its relationship to other parts of SPO.
