4.3.1. Modeling

As mentioned in Section 4.1, the main occupied zone in the store is conditioned by two RTU systems. One of the two food storage rooms is conditioned by a custom-made refrigeration system; the other by a freezer. The layout of these spaces is captured by the building model, which includes four thermal zones: two RTU zones, one refrigerator zone and one freezer zone. The building zones are modeled using the lumped resistance and capacitance approach: each zone is represented by one resistance and one capacitance and connected with each other thermally. The overall building thermal model is therefore a linear fourth-order model. The battery system is modeled based on the bucket model approach by considering the battery as a repository for energy [97]. The state variable is the battery SOC and the input is the real power that should be stored in or extracted from the battery. The PV system is modeled with a constant efficiency and the input is the predicted plane-of-array solar radiation. The linearity of these models allows efficient computation for the optimization algorithm, which takes about one minute to converge to an optimal solution in these experiments. Figure 7 shows the MPC model structure and its interaction with the local controllers.

**Figure 7.** MPC model structure.

The weather parameters considered for the building are the dry bulb temperature and the solar radiation. The dry bulb temperature forecast is obtained from the Dark Sky API based on the site latitude and longitude. The solar radiation forecasts for the building and PV system are predicted using the built-in model as described in Section 3.5.5. The prediction horizon used in the experiments is 6 h. The store zones are occupied by staff for 24 h each day. The occupancy disturbance is therefore not considered. The major internal load disturbance in the store is from the gaming machines, which emit heat directly to the zone. These machines are in operation 24 h per day. This internal thermal load is therefore assumed to be constant in the model. The system constraints for MPC used in the experiments are defined by the facility staff and are summarized in Table 3. The thermal comfort setpoints for the HVAC system are constrained to values between 19.44 ◦C (67 ◦F) and 23.33 ◦C (74 ◦F). The constraints for the freezer cabinet temperature setpoint are from −34.44 ◦C to −18.89 ◦C ( −30 ◦F to −2 ◦F). The constraints for the refrigerator cabinet temperature are from 0.56 ◦C to 3.33 ◦C (33 ◦F to 38 ◦F). The battery cannot be charged more than 95% and discharged below 25% of its total capacity. The maximum charge or discharge power is 14 kW. The upper and lower bounds for the power consumption are calculated for each grid signal, as shown in Table 1.

The system states of the model are the space temperatures of the RTU systems, cabinet temperatures of the refrigerator and freezer system and the battery SOC. These values are all measured and thus there is no need for state estimations in the MPC formulation. The measured states are updated in the model at each control interval (5 min). The control inputs for the model are the heating or cooling rate for the RTUs, the cooling rates for the refrigerator and the freezer, and the battery charging and discharging rate. The control outputs are the supervisory setpoints for each individual system: zone setpoints for the RTUs, refrigerator setpoint, freezer setpoint and charge/discharge power setpoint for the battery. When the setpoints are sent to each controller, the controller decides its operation mode based on its internal control loop implemented by the manufacturer. For instance, the thermostat receives the optimal setpoint and determines whether to switch the RTU heating or cooling state ON or OFF.
