Frequency Analysis of Solar PV Power to Enable Optimal Building Load Control †

: In this paper, we present a ﬂexibility estimation mechanism for buildings’ thermostatically controlled loads (TCLs) to enable the distribution level consumption of the majority of solar photovoltaic (PV) generation by local building TCLs. The local consumption of PV generation provides several advantages to the grid operation as well as the consumers, such as reducing the stress on the distribution network, minimizing voltage ﬂuctuations and two-way power ﬂows in the distribution network, and reducing the required battery storage capacity for PV integration. This would result in increasing the solar PV generation penetration levels. The aims of this study are twofold. First, spectral (frequency) analyses of solar PV power generation together with the power consumption of multiple building TCLs (such as heating, ventilation, and air conditioning (HVAC) systems, water heaters, and refrigerators) are performed. These analyses deﬁne the bandwidth over which these TCLs can operate and also describe the PV generation frequency bandwidth. Such spectral analyses, in frequency domain, can help identify the ﬂexible components of PV generation that can be consumed by the various TCLs through optimal building load utilization. Second, a quadratic optimization problem based on model predictive control is formulated to allow consuming most of the low and medium frequency content of the PV power locally by building TCLs, while maintaining occupants’ comfort and TCLs’ physical constraints. The solution to the proposed optimization problem is achieved using optimal control strategies. Numerical results show that most of the low and medium frequency content of the PV generation can be consumed locally by building TCLs. The remaining high-frequency content of the PV generation can then be stored / o ﬀ set using energy storage systems.


Introduction
The deployment of renewable energy sources, especially solar photovoltaics (PVs), has increased considerably in the past few years. Solar PV generation can serve part of the local loads to potentially reduce the stress on the distribution power grid and improve the overall grid performance. However, PV power generation varies quickly due to varying weather conditions, passing clouds or flocks of birds, and local intermittent shading. Such increase and variability in PV power output usually create distribution voltage rise issues and reduce the lifetime of the distribution system transformers due to the frequent change in tap positions. Moreover, PV generation in the distribution system allows for two-way power flows, which are very challenging for the protection system. Therefore, energy storage systems (ESSs) are usually used to handle the variability in the electricity produced by solar PV [1][2][3]. However, ESSs require large capital investment [1,3], which has motivated pursuing research for alternative options such as the utilization of flexible building loads. In this direction, local building loads may consume a large amount of the solar PV generation to reduce the impact on the distribution grid and/or ESSs.
Buildings account for more than 70% of the United States' electricity use, and nearly 40% of the United States' annual energy is consumed in residential and commercial buildings [4,5]. Buildings can use the flexibility inherent in their thermostatically controlled loads (TCLs) to help support some grid services at different timescales and to avoid transmission and capacity constraints. This has motivated researchers to develop control strategies for local building TCLs to allow them to consume a large amount of the generated solar PV power and therefore reduce the need for conventional electrical storage.
Few works in the literature [6][7][8][9] have investigated how frequency bandwidth concepts can take advantage of building TCLs to offset energy resource availability. These works are mainly focused on utilizing building TCLs to offset grid-side and building-side variabilities. In particular, the study in [6] showed that the supply fans of heating, ventilation, and air conditioning (HVAC) systems in commercial buildings can provide about 70% of the current regulation capacity needed in the United States. In [7,8], it is shown that the thermal storage capacity, or thermal inertia, inherent in building TCLs can be utilized to offset fast variations of transient frequency oscillations (swings) and local solar power, respectively, from a grid perspective with reduced need for conventional storage. In [9], a power electronic HVAC drive that acts as an effective electric swing bus is implemented to offset the variability of intermittent solar resources.
Furthermore, several control strategies for buildings' TCLs have been developed in the literature to support grid-interactive efficient buildings [10][11][12][13][14][15][16][17]. They can be categorized into model-based and data-driven control strategies. In particular, the study in [10] considers a model predictive control (MPC) approach to minimize the energy consumption in buildings while ensuring thermal comfort. However, MPC is a model-based approach that relies on a dynamical model of the building; thus, the least squares identification method is applied to estimate the numerical values of the model parameters. In [11], machine learning data-driven algorithms, such as deep time delay neural networks (TDNNs) and regression trees (RTs), are used to mimic the behavior of MPC in the context of building control. In [12], a robust MPC is presented to address the HVAC system model uncertainties. In [13], a comparison study between dynamic programming and a genetic algorithm is performed to implement control of HVAC for demand response (DR). In [14,15], an MPC strategy is presented to optimally dispatch a group of on/off and variable-air-volume HVAC systems, respectively, to compensate fluctuations in solar power generation. In [16,17], a model-free control (MFC) strategy and a signal temporal logic control (STL) strategy are presented, respectively, to also compensate fluctuations in solar power generation. Unlike MPC, the data-driven MFC strategy does not require building models and is easy to implement in practice, but it does not provide an optimal performance and predictive capability like MPC. While the STL control strategy allows for incorporating temporal constraints to further relax indoor temperatures and allow them to exceed the comfort limits for a short period of time. We refer interested readers to [18][19][20][21][22][23][24][25] for additional works on control of building TCLs to support grid services.
On the other hand, this paper focuses on utilizing building TCLs, such as HVAC systems, water heaters (WHs), and refrigeration systems, to act as virtual batteries and consume most of the PV generation locally in order to minimize its impact on the grid (minimizing voltage fluctuations and two-way power flows) without compromising the occupants' comfort. This contrasts most of the previous works that mainly focused on offsetting the fast variations in the solar PV power (or frequency Energies 2020, 13, 4593 3 of 18 transients). The opportunity of consuming most of the PV power output by local building TCLs is explored. Spectral (frequency) analyses are first conducted for one-year time duration of solar PV power output and various building TCLs power consumption measurements to better understand their frequency contents. These analyses identify the spectral contents of PV generation that can be consumed by the different types of building TCLs for optimal building load utilization. Then, an intelligent control strategy is used to allow the building TCLs to consume most of the solar PV generation while satisfying the occupants' comfort and TCLs' hardware constraints. We adopt an MPC-based optimal control strategy to dispatch multiple building TCLs such that the aggregate power consumption of all TCLs closely tracks the low and medium frequency content of the solar PV generation. We also show that the remaining high-frequency content of the solar PV power output can be offset using batteries/fly wheels. The main contributions of this work are summarized as follows: (1) conducting spectral analyses of one-year worth of solar PV power data together with the power consumption of multiple building TCLs to better understand their frequency contents and, therefore, optimally assign the building TCLs to the appropriate frequency content of PV power, and (2) verifying through simulations that most of the low and medium frequency content of the solar PV power can be consumed locally by building TCLs using an intelligent control strategy, while the remaining high-frequency content can be offset using electrical batteries/fly wheels.
The remainder of the paper is organized as follows: Section 2 presents the overall approach for synthesizing the solar PV power spectrum to match the different building TCLs responses. In Section 3, frequency-domain analyses for the measured PV power output and various building TCLs power consumption are presented and discussed. Section 4 formulates the MPC-based optimal strategy to optimally dispatch a group of building TCLs. Section 5 presents a case study to verify the claim that most of the low and medium PV frequency content can be consumed by building TCLs without compromising the occupants' comfort and TCLs' hardware constraints, while the remaining high-frequency content of the solar PV power can be offset using electrical batteries/fly wheels. Finally, Section 6 provides the conclusion and summarizes the main findings of this work. It is worth mentioning that part of the examinations and results described in Sections 2 and 3 was initially presented in [26,27].

Proposed Approach
Spectral (frequency) analysis of solar PV power provides a better understanding of the PV frequency content due to the variations in solar irradiance and disturbances in PV generation. This information can be used to optimally assign the different building TCLs to the appropriate frequency band. Figure 1 illustrates the proposed approach. Initially, the frequency content of the collected time-domain solar PV and building TCLs power data is captured via the Fourier transform operation. The solar PV output power is divided into three frequency bands: low, medium, and high-frequency contents. This filtered PV power is then fed to the controller along with other system parameters to dispatch different building TCLs that match the corresponding PV frequency content (response time scale). The objective is to allow the aggregated power consumption of the various TCLs to closely track solar PV generation.
It is important to understand the frequency distribution of various building TCLs as well, so that these can be dispatched appropriately to consume the matching frequency bands of the solar PV output power generation. For example, on/off HVACs, WHs, and refrigerators can only be dispatched to track the low frequency content of PV output power. Similarly, variable speed HVACs and fans of HVACs can be used to consume the medium frequency content of PV power, while batteries and fly wheel storage systems can be used to offset the high-frequency content of solar PV power. Details of these frequency bands will be discussed in the next section.
A central controller has the required information about the various TCLs in the neighborhood that participate in the DR program. It also aggregates solar PV power output data from rooftops located on various residential houses and commercial buildings in the neighborhood. The controller is the brain of this framework that dispatches a group of TCLs to track solar PV power output as closely as possible. Such a controller can be mathematically formulated as an MPC-based optimization with the Energies 2020, 13, 4593 4 of 18 objective of minimizing the difference between the solar PV power output and the total consumed powers by all participating TCLs. The constraints of this optimization may consist of satisfying the occupants' comfort (represented by maintaining the TCLs' temperatures within assigned temperature bounds), electrical battery parameters, appliance/battery physical constraints, etc. It is desirable if the controller has predictive capabilities to plan ahead of time for different circumstances. Thus, it is assumed that short-term forecasts (few hours in advance) of weather and solar PV power are known to the controller to make smart decisions for dispatching multiple TCLs. Details of the controller design are presented in Section 4. the occupants' comfort and TCLs' hardware constraints, while the remaining high-frequency content of the solar PV power can be offset using electrical batteries/fly wheels. Finally, Section 6 provides the conclusion and summarizes the main findings of this work. It is worth mentioning that part of the examinations and results described in Sections 2 and 3 was initially presented in [26,27].

Proposed Approach
Spectral (frequency) analysis of solar PV power provides a better understanding of the PV frequency content due to the variations in solar irradiance and disturbances in PV generation. This information can be used to optimally assign the different building TCLs to the appropriate frequency band. Figure 1 illustrates the proposed approach. Initially, the frequency content of the collected time-domain solar PV and building TCLs power data is captured via the Fourier transform operation. The solar PV output power is divided into three frequency bands: low, medium, and high-frequency contents. This filtered PV power is then fed to the controller along with other system parameters to dispatch different building TCLs that match the corresponding PV frequency content (response time scale). The objective is to allow the aggregated power consumption of the various TCLs to closely track solar PV generation.

Spectral Analyses of PV Power Generation and Building TCLs Power Consumption
In this section, statistical analyses of the frequency spectrum of solar PV and building TCLs' power profiles are presented. Spectral analysis illustrates the PV frequency content, which enables the optimal assignment of various building TCLs to the appropriate PV frequency band.

Solar PV
The frequency-domain analysis is conducted on 12-month one-second time resolution PV power measurements collected from a 13-kW solar PV panel located at Oak Ridge National Laboratory (ORNL). The time-domain PV power data are converted to frequency domain via the Fourier transform operation [28]. Figure 2 illustrates 24-h time-domain PV power profiles for eight summer days selected at random and their corresponding frequency-domain profiles. Significant generation variability (fluctuations) is observed in the time-domain power profiles and a wide range of frequencies (time scales) is observed in the frequency-domain profiles, ranging from a few hertz and fractions of hertz (sub-seconds to seconds), to multiple mHz (minutes), and to fractions of mHz (hours). This wide range of frequencies can be divided into categories of relatively high, medium, and low frequency bands.
Energies 2020, 13, 4593 5 of 18 [28]. Figure 2 illustrates 24-h time-domain PV power profiles for eight summer days selected at random and their corresponding frequency-domain profiles. Significant generation variability (fluctuations) is observed in the time-domain power profiles and a wide range of frequencies (time scales) is observed in the frequency-domain profiles, ranging from a few hertz and fractions of hertz (sub-seconds to seconds), to multiple mHz (minutes), and to fractions of mHz (hours). This wide range of frequencies can be divided into categories of relatively high, medium, and low frequency bands.  Boxplots [29] are used to visualize the annual and seasonal statistics of PV frequency content. The lower and upper lines of the "box" represent the 25th and 75th percentiles of the sample, respectively, the line in the middle of the box is the sample median, and the extended lines from each end of the box represent the minimum and the maximum values in the sample. Figure 3a illustrates the annual statistics of the PV power output frequency content. It is observed that about 98% of the PV energy is located in the low frequency band (lower than 1 mHz (~15 min)). Additionally, only little PV energy (about 2%) is found at frequencies between 1 and 100 mHz (~15 min to 10 s). Finally, PV energy at frequencies higher than 100 mHz is almost negligible (not shown in Figure 3a). The low frequency content corresponds to the daily solar power variations, which are mainly from the parabola shape in the time-domain power profiles. The medium frequency content comes from changes in solar irradiance due to moving clouds and other factors, while the high-frequency content comes from changes due to passing flocks of birds, local intermittent shading, etc. Furthermore, it can be observed that the dispersion from the medians is quite large, especially at low frequencies (~3 kW at 0.01 mHz, 0.3 kW at 0.05 mHz, etc.) due to many factors that include daily/hourly variations, diffuse/beam solar irradiance, and other factors. Figure 3b illustrates the seasonal statistics of the PV power output frequency content. It is observed that the median powers are highest in summer, moderate in fall and spring, and lowest in winter at the selected location.
Energies 2020, 13, x FOR PEER REVIEW 5 of 17 Boxplots [29] are used to visualize the annual and seasonal statistics of PV frequency content. The lower and upper lines of the "box" represent the 25th and 75th percentiles of the sample, respectively, the line in the middle of the box is the sample median, and the extended lines from each end of the box represent the minimum and the maximum values in the sample. Figure 3a illustrates the annual statistics of the PV power output frequency content. It is observed that about 98% of the PV energy is located in the low frequency band (lower than 1 mHz (~15 min)). Additionally, only little PV energy (about 2%) is found at frequencies between 1 and 100 mHz (~15 min to 10 s). Finally, PV energy at frequencies higher than 100 mHz is almost negligible (not shown in Figure 3a). The low frequency content corresponds to the daily solar power variations, which are mainly from the parabola shape in the time-domain power profiles. The medium frequency content comes from changes in solar irradiance due to moving clouds and other factors, while the high-frequency content comes from changes due to passing flocks of birds, local intermittent shading, etc. Furthermore, it can be observed that the dispersion from the medians is quite large, especially at low frequencies (~3 kW at 0.01 mHz, ~0.3 kW at 0.05 mHz, etc.) due to many factors that include daily/hourly variations, diffuse/beam solar irradiance, and other factors. Figure 3b illustrates the seasonal statistics of the PV power output frequency content. It is observed that the median powers are highest in summer, moderate in fall and spring, and lowest in winter at the selected location.

Building TCLs
In this section, three different types of building TCLs are considered: on/off HVAC systems, WHs, and refrigeration systems. It is assumed that each building may have any of the three loads. The detailed descriptions and modeling of the selected TCLs (HVAC, WH, and refrigerator systems) are presented in Section 4.1.

Building TCLs
In this section, three different types of building TCLs are considered: on/off HVAC systems, WHs, and refrigeration systems. It is assumed that each building may have any of the three loads. The detailed descriptions and modeling of the selected TCLs (HVAC, WH, and refrigerator systems) are presented in Section 4.1.
Daily power consumption of an on/off HVAC unit is recorded every 15 s for one year. The measurements were taken from the outdoor unit of a 3-ton capacity HVAC split system located at an ORNL building research house. Figure 4a illustrates 24-h power consumption of the selected HVAC unit for one summer day selected at random. The time-domain HVAC power consumption data are converted to frequency domain via the Fourier Transform operation. Figure 4b shows the corresponding frequency-domain profile for the HVAC power consumption data shown in Figure 4a.  Daily power consumption of a WH is recorded at one-minute time resolution for one year. The selected WH is located at the same ORNL building research house and is a 50-gallon tank unit with 4-kW resistive heating elements and a 0.9 efficiency factor. Figure 5 illustrates a 24-h power consumption of the selected WH for one summer day selected at random and its corresponding frequency-domain profile. Furthermore, daily power consumption of a refrigerator is recorded every 30 s for one year. The selected refrigerator has a 4.5 kW rated power and is also located at the same ORNL building research facility. Figure 6 illustrates a 24-h power consumption of the selected refrigeration system for one summer day selected at random and its corresponding frequency-domain profile.  Daily power consumption of a WH is recorded at one-minute time resolution for one year. The selected WH is located at the same ORNL building research house and is a 50-gallon tank unit with 4-kW resistive heating elements and a 0.9 efficiency factor. Figure 5 illustrates a 24-h power consumption of the selected WH for one summer day selected at random and its corresponding frequency-domain profile. Furthermore, daily power consumption of a refrigerator is recorded every 30 s for one year. The selected refrigerator has a 4.5 kW rated power and is also located at the same ORNL building research facility. Figure 6 illustrates a 24-h power consumption of the selected refrigeration system for one summer day selected at random and its corresponding frequency-domain profile.  Daily power consumption of a WH is recorded at one-minute time resolution for one year. The selected WH is located at the same ORNL building research house and is a 50-gallon tank unit with 4-kW resistive heating elements and a 0.9 efficiency factor. Figure 5 illustrates a 24-h power consumption of the selected WH for one summer day selected at random and its corresponding frequency-domain profile. Furthermore, daily power consumption of a refrigerator is recorded every 30 s for one year. The selected refrigerator has a 4.5 kW rated power and is also located at the same ORNL building research facility. Figure 6 illustrates a 24-h power consumption of the selected refrigeration system for one summer day selected at random and its corresponding frequency-domain profile.   Figure 7 illustrates the annual statistics of the HVAC, WH, and refrigeration systems' power consumption frequency contents. It is observed that most of the power consumption lies at frequencies less than 10 mHz that correspond to the low and medium frequency bands of the PV generated power. In addition, it can be observed that the dispersion from the medians is quite large for the HVAC and WH systems, while it is moderate for the refrigeration systems.
Energies 2020, 13, x FOR PEER REVIEW 7 of 17 Figure 7 illustrates the annual statistics of the HVAC, WH, and refrigeration systems' power consumption frequency contents. It is observed that most of the power consumption lies at frequencies less than 10 mHz that correspond to the low and medium frequency bands of the PV generated power. In addition, it can be observed that the dispersion from the medians is quite large for the HVAC and WH systems, while it is moderate for the refrigeration systems.

Comparison
Spectral analyses of solar PV and various building TCLs' power profiles have been previously discussed. Now, we relate the PV power output frequency content to the various building TCLs' frequency content for optimal utilization of these loads in consuming most of the PV generation. Figure 8 illustrates the frequency spectrum of the average powers generated/consumed by solar PV/building TCLs for comparison. It is observed that the frequency content of the average solar PV power output matches the ones for the on/off HVAC, WH, and refrigeration powers' consumption. Table 1 shows the percentage of the energy content for each frequency band (low, medium, and high) for the solar PV and the various building TCLs. The experimental results show that almost all (about 98%) of the PV power generation is available at frequencies lower than 1 mHz, which are equivalent

Comparison
Spectral analyses of solar PV and various building TCLs' power profiles have been previously discussed. Now, we relate the PV power output frequency content to the various building TCLs' frequency content for optimal utilization of these loads in consuming most of the PV generation. Figure 8 illustrates the frequency spectrum of the average powers generated/consumed by solar PV/building TCLs for comparison. It is observed that the frequency content of the average solar PV power output matches the ones for the on/off HVAC, WH, and refrigeration powers' consumption. Table 1 shows the percentage of the energy content for each frequency band (low, medium, and high) for the solar PV and the various building TCLs. The experimental results show that almost all (about 98%) of the PV power generation is available at frequencies lower than 1 mHz, which are equivalent to time scales higher than~15 min, and it is well-suited for consumption using building TCLs such as on/off HVAC units, WHs, and refrigeration systems. Medium frequencies in the range 1-100 mHz, which are equivalent to time scales between~15 min and 10 s, are well-suited for consumption using variable air volume (VAV) HVACs and fans of HVACs that have time scale responses in the range of few minutes to few seconds; while high frequencies faster than 100 mHz, which are equivalent to time scales faster than 10 seconds, are well-suited to be stored/offset using batteries/fly wheel systems. This study indicates that a large amount of the generated PV power is well-suited to be consumed by various building TCLs.  Now, we want to employ the concept of the load duration curve in [30], which is used to show the relative relation between the power capacity load utilization and the power generation capacity requirements. The load consumption data in a load duration curve are not ordered chronologically as in a typical load curve, rather they are ordered in a descending order of magnitude. This concept is employed in this study to understand the relative relation of the demands of HVACs and WHs to the solar PV generation over a one-year period. This will determine the power consumption over a year, and then we can relate this information to the solar PV generation. Figure 9 shows a comparison of the duration curves for the powers consumed by an HVAC and a WH and the power generated by a solar PV panel over one year. From the HVAC curve, we observe that the HVAC demand was greater than 1.5 kW for 1563 h in that year (17.8%). The WH curve shows that the WH was used for a total of 283 h in that year (3.2%). The PV curve shows that the 13-kW solar PV panel generates 5 kW (38% of its total capacity) for more than 1500 h in that year. PV generation and HVAC consumption have similar trends, but since the WH is on/off, it does not follow a similar trend. However,  Now, we want to employ the concept of the load duration curve in [30], which is used to show the relative relation between the power capacity load utilization and the power generation capacity requirements. The load consumption data in a load duration curve are not ordered chronologically as in a typical load curve, rather they are ordered in a descending order of magnitude. This concept is employed in this study to understand the relative relation of the demands of HVACs and WHs to the solar PV generation over a one-year period. This will determine the power consumption over a year, and then we can relate this information to the solar PV generation. Figure 9 shows a comparison of the duration curves for the powers consumed by an HVAC and a WH and the power generated by a solar PV panel over one year. From the HVAC curve, we observe that the HVAC demand was greater than 1.5 kW for 1563 h in that year (17.8%). The WH curve shows Energies 2020, 13, 4593 9 of 18 that the WH was used for a total of 283 h in that year (3.2%). The PV curve shows that the 13-kW solar PV panel generates 5 kW (38% of its total capacity) for more than 1500 h in that year. PV generation and HVAC consumption have similar trends, but since the WH is on/off, it does not follow a similar trend. However, by aggregating a large number of HVAC and WH loads, the solar PV signal can be closely tracked. A centralized controller will take a set of these building TCLs and dispatch them to match the solar PV generation. Details of the controller formulation are discussed in the next section.

Model Predictive Control of Building TCLs
In this section, we initially introduce simplified mathematical thermal models for the various building TCLs considered in this study. Then, an MPC-based control strategy will be developed to optimally schedule the local building TCLs and allow them to consume most of the low and medium frequency content of the generated PV power, without compromising the occupants' comfort and TCLs' hardware constraints. Meanwhile, the remaining high-frequency content of the generated PV power can be stored/offset via ESSs, as will be discussed in detail in Section 5.2.

HVAC Model
This subsection presents the mathematical thermal model of an HVAC unit as initially introduced in [31][32][33][34]. It is described by the following continuous-time linear time invariant (LTI) model: where the system states are the room air temperature , interior wall surface temperature , and exterior wall core temperature . The control inputs (≤0) and (≥0) represent cooling and heating powers, respectively, and can be combined as , = + since heating and cooling cannot occur simultaneously. , , and denote the outside air temperature in °C, solar radiation in kW, and internal heat sources in kW, respectively. Note thatare, respectively, the building heat capacities of nodes with temperatures -, whileare, respectively, the building heat gains for the ceiling, floor, windows, external walls with windows, and external walls without windows. Furthermore, , , and represent the system disturbances, and = , / represents the HVAC electrical power input and it is the control input, where is the coefficient Power (kW) Figure 9. Comparison of duration curves for HVAC, WH, and PV powers.

Model Predictive Control of Building TCLs
In this section, we initially introduce simplified mathematical thermal models for the various building TCLs considered in this study. Then, an MPC-based control strategy will be developed to optimally schedule the local building TCLs and allow them to consume most of the low and medium frequency content of the generated PV power, without compromising the occupants' comfort and TCLs' hardware constraints. Meanwhile, the remaining high-frequency content of the generated PV power can be stored/offset via ESSs, as will be discussed in detail in Section 5.2.

HVAC Model
This subsection presents the mathematical thermal model of an HVAC unit as initially introduced in [31][32][33][34]. It is described by the following continuous-time linear time invariant (LTI) model: . .
where the system states are the room air temperature t 1 , interior wall surface temperature t 2 , and exterior wall core temperature t 3 . The control inputs u c (≤0) and u h (≥0) represent cooling and heating powers, respectively, and can be combined as u h,u = u h + u c since heating and cooling cannot occur simultaneously. δ 1 , δ 2 , and δ 3 denote the outside air temperature in • C, solar radiation in kW, and internal heat sources in kW, respectively. Note that C 1 -C 3 are, respectively, the building heat capacities of nodes with temperatures t 1 -t 3 , while K 1 -K 5 are, respectively, the building heat gains for the ceiling, floor, windows, external walls with windows, and external walls without windows. Furthermore, δ 1 , δ 2 , and δ 3 represent the system disturbances, and u HVAC = u h,u /η HVAC represents the HVAC electrical power input and it is the control input, where η HVAC is the coefficient of performance (efficiency) of the HVAC in converting the electrical power into heating/cooling power. The state-space HVAC model in Equations (1)-(3) will be discretized and used later in the case study. We refer the readers to [31] for more details on the adopted HVAC model in Equations (1)-(3).

Water Heater
Now, we describe a generic mathematical model of a WH. The water heater temperature, t 4 , at discrete time step k is described by [35]: where α WH (K/interval) is the warming effect on water temperature when the WH is turned on, γ WH (K/interval) is the cooling effect on water temperature when the WH is turned off, β WH is the cooling effect of hot water usage/draw on the water temperature of WH, τ is the time interval duration, and W(k) is the average hot water usage/draw per hour at time step k. The heating effect on water temperature when the WH is turned on is represented by α WH , while the cooling effect on water temperature when the WH is turned off is represented by γ WH , which captures the thermal leakage due to the difference between the outside temperature and water temperature. Lastly, β WH captures the effect of hot water usage/draw on the water temperature.

Refrigeration System
Similar to the WH model in Equation (4), the inside temperature of a refrigerator, t 5 , can mathematically be described by [35]: where A R (k) represents the activity level of the fridge at time step k, and α R , β R , γ R have similar physical meanings to their WH counterparts, but with different values/settings. The cooling effect on the inside temperature of a refrigerator when it is turned on is represented by α R , while the heating effect on the inside temperature of a refrigerator when it is turned off is represented by γ R . Lastly, β R captures the effect of activity level on the inside temperature of a refrigerator, such that when a household activity level increases there is more cooling demand on the refrigerator. We refer the readers to [35] for more details on the adopted WH and refrigerator models in Equations (4) and (5).

Building Model
Using the aforementioned thermal models for the various TCLs, the thermal state-space model of a building can be represented as follows: with the states X = [t 1 ; t 2 ; t 3 ; t 4 ; t 5 ], inputs U = [u HVAC ; u WH ; u R ], and disturbances V = [δ 1 ; δ 2 ; δ 3 ; W; A R ]. Without loss of generality, we only consider summer cooling days in this paper. Therefore, we can ignore u h in the HVAC model. Moreover, the discrete-time state-space matrices A, B, and G can be obtained/estimated for a building, while the disturbance matrix V can be obtained from recorded weather and activity data for a specific location and time.

MPC Design
An MPC-based strategy is developed to compute the optimal schedule for a given set of building TCLs. The thermal dynamics of the various building TCLs are formulated in Section 4.1 and will be used in the control design formulation. The proposed control strategy is based on MPC and solved using quadratic programming. It aims to minimize the tracking error between the filtered low and medium frequency content (time scale greater than 10 min) of the PV generation and the aggregate building TCLs power consumption, without compromising the occupants' comfort and TCLs' hardware constraints. It is described by where P PV (k) is the PV power output at time step k, K is the prediction horizon, J is the total number of TCLs, x j (k). represents the indoor/water/refrigerator temperature of TCL j at time step k, x re f j represents the temperature setpoints for TCL j, u r j is the rated power for TCL j, and R > 0 and Q > 0 are compatible weighting matrices. In addition, i = {1, . . . , I} represents the building index number, and I is the total number of buildings. Note that the input variables for u j are binaries, which take values as either 0 or u r j . The first term in Equation (7) allows the total power consumption of all TCLs to track the PV power output signal, while the second term allows the indoor/water/refrigerator temperatures for TCLs to be as close as possible to their corresponding temperature setpoints. The third term in Equation (7) minimizes the total power consumption (i.e., allows energy efficiency). We consider summer days for the case studies using the proposed controller. We choose temperature setpoints of 23 • C for HVAC systems and indoor temperatures fluctuate ±1 • C around the setpoints, while WH temperatures vary from 45 • C to 55 • C considering customers' comfort levels. The controller allows the power consumption of all building TCLs to track the solar PV power output as much as possible while fluctuating indoor/water/refrigerator temperatures inside their assigned comfort bands. This optimization formulation is a mixed-integer linear quadratic programming problem, which is implemented in MATLAB and solved using Gurobi [36] through the YALMIP interface [37].

Low and Medium Frequency Contents of PV Power
In this section, simulation results are presented to verify that most of the low and medium frequency content of the solar PV power can be consumed locally by building TCLs using the proposed MPC-based optimization described in Section 4.2. It is worth mentioning that we do not intend to verify the MPC performance in this case study, but we want to verify the claim that with the help of an advanced control strategy, such as the MPC strategy in Equations (7)-(9), most of the low and medium PV frequency content can be consumed by building TCLs. Indeed, other advanced control strategies can be used to verify this claim, but we selected the MPC since it is the most commonly used one in such applications. A central coordinator is considered that collects information about the total solar PV power and allocates it to a group of building TCLs. Although it is possible to control temperatures of refrigeration systems, their degrees of controllability are limited. Therefore, refrigerators are ignored in the presented case study, and thus we assume that each building has one HVAC unit and one WH. The values for the various building TCLs' parameters are estimated from the corresponding input-output measurements using the general gray-box system identification method in [38] and are presented in Table 2. Both solar PV generation and weather profiles are picked for one summer month from a local station. Figure 10 shows the solar PV generation and outdoor temperature for one summer week used in this case study, while Figure 11 shows the typical daily water usage profile used in this case study. Note that only the low and medium frequency content of the solar PV power are fed to the controller applied in this subsection. The high-frequency content of the solar PV power will be dealt with in Section 5.2. Table 2. HVAC and WH models' parameters.

WH Model Parameters
Energies 2020, 13, x FOR PEER REVIEW 12 of 17   We consider 30 buildings, which include 30 HVAC units and 30 WHs. The control interval is selected to be 10 min, while the prediction horizon is selected to be 12 control time steps (2 h). The 10-min control time interval is selected because most TCLs, especially HVAC systems, do not allow frequent on/off switching within a short period of time (short-cycling), usually less than 10 min, in order to avoid wear and tear of such devices and thus preserve their life time [39]. Due to this hardware constraint, we set the objective of the controller to allow consuming only the low and medium (not high) frequency content, in the range of higher than 10 min, of the generated PV power    We consider 30 buildings, which include 30 HVAC units and 30 WHs. The control interval is selected to be 10 min, while the prediction horizon is selected to be 12 control time steps (2 h). The 10-min control time interval is selected because most TCLs, especially HVAC systems, do not allow frequent on/off switching within a short period of time (short-cycling), usually less than 10 min, in order to avoid wear and tear of such devices and thus preserve their life time [39]. Due to this hardware constraint, we set the objective of the controller to allow consuming only the low and medium (not high) frequency content, in the range of higher than 10 min, of the generated PV power by the different building TCLs. Gallons W ater U sag e/D raw P ro file Figure 11. Daily water usage profile.
We consider 30 buildings, which include 30 HVAC units and 30 WHs. The control interval is selected to be 10 min, while the prediction horizon is selected to be 12 control time steps (2 h). The 10-min control time interval is selected because most TCLs, especially HVAC systems, do not Energies 2020, 13, 4593 13 of 18 allow frequent on/off switching within a short period of time (short-cycling), usually less than 10 min, in order to avoid wear and tear of such devices and thus preserve their life time [39]. Due to this hardware constraint, we set the objective of the controller to allow consuming only the low and medium (not high) frequency content, in the range of higher than 10 min, of the generated PV power by the different building TCLs.
After that, the optimization problem is solved, and one week's worth of results are presented in Figures 12 and 13. Figure 12 illustrates the power tracking performance for the fifth and the sixth days of the week shown in Figure 10. It is observed that the 30 HVACs and 30 WHs are well managed so their total power consumption tracks the PV generation using the proposed MPC strategy. Note that the controller only runs when there is enough PV power available (when PV power is greater than 25 kW). In Figure 13, we observe that both the hot water and indoor temperatures are maintained within the desired comfort band for the whole week. Table 3 shows the tracking performance in terms of the root-mean-square-error (RMSE) for one-week and one-month simulation time durations. It can be observed that the tracking performance is satisfactory (relative error is less than 10%), and thus most of the low and medium PV power frequency content can be locally consumed by building TCLs. The high-frequency content of the solar PV power will be addressed in the next section.
Energies 2020, 13, x FOR PEER REVIEW 13 of 17 of the root-mean-square-error (RMSE) for one-week and one-month simulation time durations. It can be observed that the tracking performance is satisfactory (relative error is less than 10%), and thus most of the low and medium PV power frequency content can be locally consumed by building TCLs. The high-frequency content of the solar PV power will be addressed in the next section.   of the root-mean-square-error (RMSE) for one-week and one-month simulation time durations. It can be observed that the tracking performance is satisfactory (relative error is less than 10%), and thus most of the low and medium PV power frequency content can be locally consumed by building TCLs. The high-frequency content of the solar PV power will be addressed in the next section.

High Frequency Contents of PV Power
From the results in Section 5.1, it is shown that building TCLs can provide good tracking performance for the low and medium frequencies of solar PV power while maintaining the occupants' comfort and hardware constraint; this leaves us with the high-frequency content of PV power. Electrical batteries can be used to store/offset such high-frequency content. Usually batteries are sized based on the solar PV ratings. For example, for one of the solar PV power outputs shown in Figure 2, the total energy over one day that needs to be stored is 61.5 kWh (assuming that all solar PV energy is going to the battery). However, by only storing the high-frequency content of the solar PV power in a battery, we can reduce its size as the amount of energy over one day that needs to be stored will be significantly reduced. For example, for the same selected solar PV profile in Figure 2, only 0.76 kWh needs to be stored over that day. A generic mathematical model of an ESS is described by [40]: where k is the time step in seconds, E bat denotes the energy state of the battery in kWh, τ is the time constant, η chg and η dchg are the charging and discharging efficiencies, respectively, and E rated is the rated energy of the battery in kWh. Finally, P chg and P dchg are, respectively, the charging and discharging power levels of the battery. Equation (10) represents the energy state of the battery as a function of the charging and discharging power levels of the battery, while Equation (11) represents the state-of-charge (SOC) of the battery as a function of the energy state of the battery computed in Equation (10). The high-frequency content of the solar PV generation is used as an input (P chg (k) and P dchg (k)) to the electrical battery, which has three modes: charging, discharging, or idle. Note that if both P chg (k) and P dchg (k) are zeros at any given time interval, then the battery is in idle mode. Figure 14a shows the battery modes when the high-frequency content of the same selected solar PV profile in Figure 2 is fed to the battery. The SOC of the battery is illustrated in Figure 14b. Note that it is assumed that the initial SOC of the battery is 50%.
Energies 2020, 13, x FOR PEER REVIEW 14 of 17 stored will be significantly reduced. For example, for the same selected solar PV profile in Figure 2, only 0.76 kWh needs to be stored over that day. A generic mathematical model of an ESS is described by [40]: where k is the time step in seconds, Ebat denotes the energy state of the battery in kWh, τ is the time constant, ηchg and ηdchg are the charging and discharging efficiencies, respectively, and Erated is the rated energy of the battery in kWh. Finally, Pchg and Pdchg are, respectively, the charging and discharging power levels of the battery. Equation (10) represents the energy state of the battery as a function of the charging and discharging power levels of the battery, while Equation (11) represents the state-ofcharge (SOC) of the battery as a function of the energy state of the battery computed in Equation (10). The high-frequency content of the solar PV generation is used as an input (Pchg(k) and Pdchg(k)) to the electrical battery, which has three modes: charging, discharging, or idle. Note that if both Pchg(k) and Pdchg(k) are zeros at any given time interval, then the battery is in idle mode. Figure 14a shows the battery modes when the high-frequency content of the same selected solar PV profile in Figure 2 is fed to the battery. The SOC of the battery is illustrated in Figure 14b. Note that it is assumed that the initial SOC of the battery is 50%. As seen in Figure 14, the battery level changes from charging mode to discharging mode, and vice versa, in seconds. Even though there is almost negligible decrease in the SOC (about 2.5%), the battery switches from discharging mode to charging mode, and vice versa, 7440 times in one day. This may harm the battery or reduce its lifecycle. Another option is to use a flywheel storage system to alleviate this issue for storing/offsetting the high-frequency solar PV power. Flywheels require low maintenance, have negligible impact on the environment, and have a long lifetime as they are capable As seen in Figure 14, the battery level changes from charging mode to discharging mode, and vice versa, in seconds. Even though there is almost negligible decrease in the SOC (about 2.5%), the battery switches from discharging mode to charging mode, and vice versa, 7440 times in one day. This may harm the battery or reduce its lifecycle. Another option is to use a flywheel storage system to alleviate this issue for storing/offsetting the high-frequency solar PV power. Flywheels require low maintenance, have negligible impact on the environment, and have a long lifetime as they are capable of over 100,000 full depth of discharge cycles [41].

Conclusions
Spectral analyses of generated PV power data were conducted to better comprehend its frequency spectrum. The annual and seasonal statistics of the PV frequency content were presented and discussed. Spectral analyses of various building TCLs were also conducted to develop methods to locally consume most of the generated PV power. It was observed that most of the PV frequency spectrum matches the ones for the HVAC, WH, and refrigeration power consumptions. The experimental results showed that almost all (about 98%) of the PV power generation is available at frequencies lower than 1 mHz, and it is well suited for consumption using building TCLs such as on/off HVAC units, WHs, and refrigeration systems. Medium frequencies of PV power in the range 1-100 mHz are well suited for consumption using VAV HVACs and fans of HVACs that have time scale response in the range of few minutes to few seconds, while high frequencies of PV power faster than 100 mHz are well suited to be stored/offset using battery/fly wheel systems. Moreover, a central coordinator was developed that collects information about the total solar PV power and allocates it to a group of building TCLs. Simulation results show that by using a proper control of the various building TCLs, almost all of the solar PV generation can potentially be consumed locally. Finally, we showed that by consuming the solar PV generation locally, the need and capital expense for ESSs at the grid/building side will be largely reduced.
Future works include generalizing the proposed spectral analysis approach to other power sources and smart loads such as wind generation, heat pumps, pool pumps, lighting, plug loads, etc. In addition, we are currently investigating a distributed control strategy to reduce the two-way information exchange (and communication overhead) between the central controller and building TCLs and home energy management systems. Such a distributed control strategy will also protect the privacy of the households.