A Prosumer Model Based on Smart Home Energy Management and Forecasting Techniques †

: This work presents an optimization framework based on mixed-integer programming techniques for a smart home’s optimal energy management. In particular, through a cost-minimization objective function, the developed approach determines the optimal day-ahead energy scheduling of all load types that can be either inelastic or can take part in demand response programs and the charging/discharging programs of an electric vehicle and energy storage. The underlying energy system can also interact with the power grid, exchanging electricity through sales and purchases. The smart home’s energy system also incorporates renewable energy sources in the form of wind and solar power, which generate electrical energy that can be either directly consumed for the home’s requirements, directed to the batteries for charging needs (storage, electric vehicles), or sold back to the power grid for acquiring revenues. Three short-term forecasting processes are implemented for real-time prices, photovoltaics, and wind generation. The forecasting model is built on the hybrid combination of the K-medoids algorithm and Elman neural network. K-medoids performs clustering of the training set and is used for input selection. The forecasting is held via the neural network. The results indicate that different renewables’ availability highly inﬂuences the optimal demand allocation, renewables-based energy allocation, and the charging–discharging cycle of the energy storage and electric vehicle.


Introduction
A smart grid is defined as a power grid integrated with a computerized and bidirectional communication network. Due to the rising importance and significance of smart grid applications in households, these topics have increased interest in academic and practical applications. A detailed review has been carried out in [1], highlighting the critical challenges of involving demand-side management in optimization problems, providing information for developing different optimization algorithms. A mixed-integer linear programming (MILP) model for the cost-optimal operational scheduling of an individual end-user has been developed in [2], including renewable energy sources (RES), an energy storage system (ESS), and an electric vehicle (EV). Apart from the main power grid, an energy trading platform is also modeled for energy exchanges. The end user's energy demand is considered deterministic. A MILP model has been presented in the same context in [3] for the cost-optimal smart home energy management system, including RES, ESS, and EV. The smart home's consumption is considered deterministic except for two appliances: a washing machine and a dishwasher, modeled as shiftable load types. A similar MILP considering the supply side and flexibility providers. The authors in [23] proposed a demand scheduling optimization approach to minimize the peak hourly load, including shiftable loads and EVs. In this work, ESSs and RES were not modeled. Finally, an incentive-based methodological framework has been developed in [24] for scheduling various electric appliances of a residential community.
As it is clear from the provided literature review, several works deal with the smart home energy optimization problem from many perspectives, the majority of which cover all the aspects of the studied problem partially. This work is based on the development of an optimization approach, namely, a MILP model, for optimal smart home energy management, including all types of smart loads (uncontrollable loads, curtailable, adjustable, uninterruptible and independent loads, uninterruptible and dependent loads, and thermostatic ones), RES, in the form of wind and photovoltaic power contribution, ESS, EV, and energy exchanges with the power grid. This work comprises an extension of the work presented in [25], on the grounds that it incorporates the following: i.
A forecasting approach is proposed combining clustering and neural network. The critical variables that affect the prosumer's expenses are electricity prices. Photovoltaics (PV) generation and wind turbine (WT) generation are employed in the forecasting process. The clustering part of the forecasting model is utilized for the optimal selection of historical values of the target variable; ii. A peak load constraint has been added in the mathematical formulation, exerting significant influence on the decision making; iii. A more detailed temporal granularity has been employed, namely, 15 min time step instead of an hourly one in [25]; iv. The case studies executed include both summer and winter days, providing the ability to capture the seasonal fluctuation in terms of RES generation and the operation of thermostatic loads.
Thus, the salient feature of the present work that is among few works in the literature integrates scheduling of both supply and demand sides, including the flexibility providers and all types of smart loads.
The developed modeling framework has been assessed on an illustrative case study, including a summer and a winter day, to demonstrate its applicability and effectiveness. It aims at capturing the time dynamics and interdependencies among the load scheduling, the flexibility provided by EVs and ESSs, the renewable energy contribution, and the interaction with the power grid. This systematic approach enhances decentralized energy generation, converting passive consumers into active prosumers, and is characterized by significant flexibility on the grounds that it can be easily adapted for large-scale case studies at a neighborhood and/or an urban level.
The main decision variables to be determined by the optimization approach are (i) RES generation scheduling (allocation of the energy generation and interactions with the grid), (ii) optimal load dispatch of the home's smart appliances, and (iii) optimal operation of flexibility providers (ESS and EV).
Following the Introduction section, the work's structure has the following form: Section 2 presents the mathematical model formulation of the underlying problem and is followed by Section 3, explaining the modeling approach of the forecasting processes whose outputs provide some of the required inputs to the optimization model. The assumptions and the input data of the employed case studies are described in Section 4, and Section 5 provides a detailed discussion of the model solution outputs. Last but not least, Section 6 summarizes the key findings of the work. Figure 1 illustrates the graphical flowchart of the developed optimization approach. The smart home consists of different types of appliances classified into six load types according to the following: (i) constant or uncontrollable loads, (ii) curtailable loads, (iii) adjustable loads, (iv) uninterruptible and independent loads, (v) uninterruptible and dependent loads, and (vi) thermostatic loads (air-conditioning, refrigerator, and water heater). In addition, flexibility providers are modeled, including an ESS and an EV, as well as RES generation, enabling the energy exchanges with the power grid. The problem under consideration is formally defined according to the following:

Objective Function
The objective function refers to the minimization of the smart home's total net daily cost, namely, the total daily cost for electricity purchases from the grid minus the total daily profits from electricity sales to the grid, as stated by Equation (1).

Demand Balance
The demand balance states that the total electricity supply from the power grid, plus the RES-based electricity generation, plus the ESS and EV discharging directed for the household's energy requirements must meet the dynamic load of all smart appliances in each time period, as presented in Equation (2).

Energy Storage Modeling
As stated by Equation (3), the amount of energy stored in the ESS in each time period equals the corresponding stored amount of the previous time period, plus the ESS charging power, taking into account the ESS charging efficiency, minus the ESS discharging power The state-of-energy in the ESS must also be bounded between specific limits, as set by Constraint (4).
The amount of ESS charging power includes power originating from the power grid, the electric vehicle, and on-site renewable energy generation, based on Equation (5).
In the same context, the amount of net ESS discharging power, taking into account the battery's discharging efficiency, can be directed to household energy requirements and EV charging, as defined by Equations (6) and (7).
The charging and discharging power are bounded by maximum rates (Constraints (8) and (9)) and the available capacity space in the battery in each time period (Constraints (10) and (11)).
Finally, charging and discharging decisions cannot be taken simultaneously (Constraint (12)).
x ESS,char

Electric Vehicles Modeling
Similar to the corresponding Equation (3) for the ESS, Equation (13) states that the amount of energy stored in the EV in each time period (B EV t ) equals the corresponding amount of the previous time period (B EV t−1 ), plus the EV charging power (P EV,char t ), taking into account the EV battery's charging efficiency (F CH,EV ), and minus the gross EV discharging power (P EV,disc t ), according to Equation (3).
The state-of-energy in the EV battery (B EV t ) has corresponding upper (B EV,max ) and lower limits (B EV,min ), as set by Constraint (14).
According to Equation ( Based on Equation (16), the amount of EV net discharging power (P EV,used t ) equals the EV gross discharging power (P EV,disc t ), multiplied by the EV battery's discharging efficiency (F DC,EV ). Equation (17) determines that this amount (P EV,used t ) can be directed to cover the household's requirements (P EV,home t ), and it can contribute to the ESS charging (P EV,ESS t ).
The EV charging (P EV,char t ) and discharging (P EV,disc t ) power are bounded by maximum rates (Constraints (18) and (19)), subject to the decisions for charging (x EV,char t ) and discharging (x EV,disc t ), correspondingly, or not. They are also bounded by the available capacity space in the EV battery in each time period (Constraints (20) and (21)).
Constraint (22) guarantees that the charging (x EV,char t ) and discharging (x EV,disc t ) decisions cannot be implemented simultaneously during the same time period.
x EV,char t + x EV,disc t ≤ 1 ∀t (22) Comparing to the ESS modeling, two additional constraints guarantee that when the EV is out of home (x OFF t = 1), it is not available for charging and discharging decisions (Constraints (23) and (24)).
x EV,char

Renewable Generation and Interaction with the Grid
The amount of renewable electricity generation (P RES,prod t ) can be either utilized locally (P RES,used t ) or sold back to the grid (P RES,sell t ) (Equation (25)). P RES,prod t = P RES,used t + P RES,sell t ∀t (25) The amount of power that is locally used (P RES,used t ) can be directed to ESS (P RES,ESS t ), EV battery (P RES,EV t ), and home energy consumption (P RES,home t ) (Equation (26)).
The total amount of energy that is sold to the grid (P sell t ) is the corresponding part of the RES-based electricity generation (P RES,sell t ) (Equation (27)).
The total amount of power supply from the grid (P Grid t ) is split into three parts, namely, from grid to ESS (P Grid,ESS t ), EV (P Grid,EV t ), and home energy (P Grid,home t ) (Equation (28)).
The energy exchanges with the grid (P Grid t and P sell t ) are bounded by a maximum amount in each time period (TB and TS), subject to the decision for electricity purchases from or sales to the grid (x Grid t ) (Constraints (29) and (30)).

Load Types
Six types of loads w ∈ W are modeled. These concern (i) constant or uncontrollable loads, (ii) curtailable loads, (iii) adjustable loads, (iv) uninterruptible and independent loads, (v) uninterruptible and dependent loads, and (vi) thermostatic loads (air-conditioning, refrigerator, and water heater).

Constant or Uncontrollable Loads
The first load type refers to constant or uncontrollable load w ∈ W co , whose operation is deterministic and continuous and cannot be interrupted, adjusted, and/or curtailed (Equation (31)).

Curtailable Loads
The second type of loads concerns curtailable load w ∈ W cu , which can be totally curtailed for certain time periods (Equation (32)). Operation and curtailment decisions cannot be taken simultaneously (Constraint (33)). If it is operational (x oper w,t = 1), it operates with its full load (Constraint (34)), while in case of curtailment (x crt w,t = 1), its power output is zero (Equation (35)).

Adjustable Loads
The third type of load concerns the adjustable load w ∈ W adj whose power demand can be adjusted/modified (Equations (36) and (37)), subject to the decision for adjustment or not (x adj w,t ), based on the comparison of the forecasted power price with an imposed price limit (Constraints (38)).

Uninterruptible and Independent Loads
The fourth type of load has to do with uninterruptible and independent loads w ∈ W und . Once they start-up, at least a certain time before the end of the scheduling period and within the desired time limits T on w , T o f f w (Equation (39)), it remains operational without interruptions and adjustments until the end of its operational duration (Equations (40) and (41)).
A logical constraint correlating the start-up, shut-down, and operating decisions are defined by Equation (42). Its total power consumption per time period is provided by Equation (43), subject to the decision of its operation or not.

Uninterruptible and Dependent Loads
The fifth type of loads covers the uninterruptible and dependent among the loads w ∈ W ud . All the constraints describing the operation of uninterruptible and independent loads w ∈ W und (Equations (39)-(43)) are also active (here Equations (44)-(48)), and an additional constraint (uninterruptible-dependent-consecutive) is introduced to state that the operation of one appliance (e.g., washing machine) has to be completed in order for a consecutive task (e.g., dryer) to be able to start-up (Equation (49)). In addition, there is also another kind of dependence, stating that the operation of one appliance (e.g., printer) is subject to the concurrent operation of another appliance (e.g., desktop), as stated by Constraint (50).
2.6.6. Thermostatic Loads The sixth type of loads refers to thermostatic loads, including three thermal appliances such as a heater/air conditioner, a refrigerator, and a water heater. The modeling of this type of load follows the same approach as presented in [7].
Heater/Air Conditioner Constraints (51)-(54) model the air conditioner's operation in both the heating and cooling modes. According to Constraint (51), the home inside temperature (T AC,in t ) is a function of the corresponding temperature in the previous time period (T AC,in t−1 ), plus the thermal conductivity of home to outside g· T out t − T AC,in t , and the cooling and heating rate (g AC and g H ), subject to the relevant activation or not (x AC t and x H t ). Constraint (52) sets the lower and upper limits of the home inside temperature, and Constraint (53) states that the air conditioner can operate to at most one mode (heating or cooling) in each time period. Finally, Equation (54) determines the final load of the air conditioner in each time period.
Water Heater Constraints (58)-(60) describe the same constraints for the water heater as those of the refrigerator.
T wh,in

Peak Load
Finally, Constraint (61) defines that the total load in each time period (∑ w L w,t ) must not exceed an imposed peak value (PL).
The overall problem is formulated as a MILP model aiming at minimizing the household's total net daily cost (1), and subject to constraints (2)-(61).

Forecasting Processes
The scope of forecasting processes is the optimal strategic utilization of the prosumer resources in order to reach out in minimal energy costs. In this paper, a method of selecting the proposer inputs for the forecasting model is proposed. The prosumer model is applied to two test cases, namely, the summer day and the winter day. Figure 2 shows the connection of the forecasting processes and the prosumer model. The latter receives inputs the forecasts and is executed every time step. The proposed forecasting model refers to a combination of unsupervised and supervised machine learning algorithms. The unsupervised machine learning part corresponds to clustering. The K-medoids algorithm is employed for proper selection of the training inputs [26]. The supervised part refers to the Elman neural network (ENN) [27]. The role of ENN is to perform the forecasts of the three variables. Figure N . The data are normalized in the [0, 1] range by dividing each element of x (q) with the maximum value among the Q values. The normalization aids at the better exploitation of clustering results. In the clustering procedure, the scope is to group together patterns with similar characteristics. In the case of Real-Time Prices (RTP) and generation, the similarity lies on the similarity of the time series shapes. The pattern corresponds to the time series that cover a 24 h period. K-medoids is applied for the proper selection of historical data that will be used for the training of the ENN. Let d be the target day of forecasting, i.e., either the summer or winter day. The training input selection process is composed by the following steps: • Step#1: Conduct a correlation analysis between the current time instance (i.e., 15 min) h of day d with all previous hours from the start date of the available dataset. For example, Figure 3 presents the Pearson correlation coefficient curves for the summer and winter days up to 196 h in the past [28]. It can be noticed that day d is more corelated with day d − 1. • Step#2: Apply K-medoids for k number of clusters to all days up to d − 1.

•
Step#3: Locate the cluster that day d − 1 belongs to. • Step#4: Calculate the Euclidean distances between all days in the same cluster of day d − 1 and day d − 1.

•
Step#5: Sort the according distances in ascending order.

•
Step#6: Selected m days on the top of the order and train ENN using this set.  The above process leads to the selection of the most similar days to day d, which refers to the target day. According to Figure 3, external variables are utilized as inputs. For the RTP forecasting process, the RTPs of the two test days are predicted using only historical values. More specifically, it is regarded that the prosumer purchases electricity from a retailer. The RTP is the forecasted system marginal price (SMP) increased by 65%. This increase is necessary for the retailer to cover its operational expenses and witness profit. RES generation includes photovoltaics (PV) and small wind turbines (WT). Let RTP(h + 1), PV(h + 1), and WT(h + 1) be the RTP, PV generation, and WT generation of time instance h + 1, respectively. These variables refer to the outputs of the forecasting model. Table 1 presents the outputs and the inputs of the model. The forecasts of PV and WT generations include external variables, namely, mean daily temperature of day, Temp(d), clearness sky index of day d, CSI(d), and mean daily wind speed of day d, WS(d).
The selected time lags h and h − 1 are selected via correlation analysis. Figure 4 presents the correlation coefficient curves for the two test days.  K-medoids is a partitional clustering algorithm. Prior to its execution, the most significant parameters that needs to be defined are the number of training epochs, the objective function threshold improvement, and the selection of initial centroids method. These have been selected with a trial-and-error procedure. Specifically, the number of epochs is set to 500, the threshold to 10 −6 and the centroids are initialized randomly. Let k = 1, 2, . . . , K be the indicator denoting the number of clusters, and K is the number of clusters. Each cluster is presented by the medoid, which is the median of all patterns of the cluster. Let m (k) be the medoid of the k-th cluster. Through a number of iterations, K-medoids aims at minimizing the sum of squared errors (SSE) between pattern x (q) and each medoid of the clusters:

Outputs Inputs
For ENN, the following structure is selected: one hidden layer, resilient back-propagation training algorithm, tangent sigmoid activation function for the neurons of the hidden and output layers, number of epochs 500, and objective function threshold improvement 10 −6 [29]. The training error refers to mean absolute percentage error (MAPE) [30].
In order to fully evaluate the performance of ENN, a comparison takes place between ENN and an auto-regressive integrated moving average (ARIMA) model [31]. Prior to its implementation, the order of the model needs to be defined. Let y(h) be the value of variable y in next hour h. The ARIMA model treats future values of the variable as a linear combination of historical values. ARIMA is composed of the sum of auto-regressive (AR) and moving average (MA) components. The AR(p) component is obtained by the following expression: where p is the order of the model, ϕ 1 , ϕ 2 , . . . ., ϕ p are the factors of the AR components, c is a constant, and ε p is white noise. The moving average (MA) components consider part errors. The MA(q) component is obtained by the following expression: where q is the order of the model, θ 1 , θ 2 , . . . ., θ q are the factors of the AR components, c is a constant, and ε q is white noise. By combining Equations (63) and (64), the ARIMA model expression is obtained: where ε h is white noise. The model is represented as ARIMA(p, d, q), where d is the number of differentiation needed for the time series to become stationary. In order to select the order of the model, the sample auto-correlation function (SAF) and sample partial auto-correlation function (SPAF) are checked. Figure 5 presents the SPAF for the RTP, and Figures 6-9 present the SAF and SPAF of PV and WT generation, respectively.     By checking Figures 4a and 5, the RTP series presents a correlation with high order lags. This is not the case for PV and WT generation. In order to select the order of the model, Akaike's information criterion (AIC) and Bayesian information criterion (BIC) are considered. They are given by the following equations, respectively: where L is the log-likelihood estimate, k is the number of independent variables used, and T is the number of observations. Thus, a series of different structures are examined. Different combiations of p and q are take into account. Tables 2 and 3 present the scores of the various examined models of ARIMA(p, 0, q) and ARIMA(p, 1, q) for RTP forecasting, respectively. The tables refer to the summer day. The scores are calculated using the same training set that the ENN has used. The selected structure should lead to lower values to AIC and BIC. It can be observed that, in general, ARIMA(p, 1, q) results in better scores compared to ARIMA(p, 1, q). The best scores are met at the ARIMA(5, 1, 6) model. Tables 4 and 5 show the scores of ARIMA(p, 0, q) and ARIMA(p, 1, q) for PV generation forecasting, respectively. Finally, Tables 6 and 7 show the scores of ARIMA(p, 0, q) and ARIMA(p, 1, q) for WT generation forecasting, respectively. For the PV generation, model ARIMA(3, 0, 4) is selected. For the WT generation, model ARIMA(5, 0, 6) is selected.

Case Study
The proposed optimization approach's applicability has been assessed on an illustrative case study of a smart household. Two representative days, a typical winter and a summer day, have been selected with a 15-min time step. Table 8 presents the mathematical model's parameters' values, categorizing them into EV, ESS, RES, and grid-related data. Figure 10 provides the RTP and the SMP forecasts of the two test days. The price for electricity exports to the grid is assumed to be constant during the whole day amounting to 0.0703 EUR/kW. Figure 11 depicts the forecasted PV and wind turbine availabilities during the summer and winter days, and Figure 12 shows the forecasted outside temperature on the summer and winter days, influencing the thermostatic loads' operation. Table 9 presents the home appliances' specific characteristics, including the load type, duration, earliest starting operating time, and the latest operating time.       Figure 11 presents the graphical comparison between the ENN and ARIMA forecasts. Using the mean absolute range normalized error (MARNE) indicator of the forecasting accuracy is assessed [32]. Tables 10 and 11 show the MARNEs of the models for the summer and winter days, respectively. It can be observed that the ENN results in lower errors in all the examined cases.

Results
This section provides the model outputs from the examined cases for the two representative days of summer and winter. The problem has been solved to global optimality using the ILOG CPLEX 12.6.0.0 solver incorporated in the General Algebraic Modeling System (GAMS) tool [33]. An integrality gap of 0% has been achieved in both cases. Figure 13 presents the optimal demand allocation of the smart home appliances' scheduling in each period of the winter day, satisfying the user's time preferences simultaneously. The total daily load equals around 115.4 kWh, peak load amounts to 7.46 kW at 01:00, and the lowest load, being equal to 1.61 kW, is reported at 17:45 when only uncontrollable power loads and sensors are activated. Due to the electricity prices' assumptions, almost 45% of the total daily load is activated during 0-8 h, followed by almost 29% in 8-16 h and 26% in 16-24 h. The constraints for uninterruptible and dependent among the loads are also satisfied; namely, the washing machine's operation has to be completed in order for the task of the dryer to be able to start-up. Moreover, the model solution satisfies the other type of dependence, namely, the printer's operation is subject to the desktop's concurrent operation. The total daily net cost, namely, expenses for acquiring the grid's electricity minus revenues from selling renewable electricity to the grid, for the smart home's operational scheduling leads to small revenues of around EUR 6.60.  Figure 14 highlights the operational schedule of adjustable, curtailable, and thermostatic loads in each period of the winter day. The adjustment option of the adjustment load activates for 23 15-min time intervals (5.75 h in total), especially during 10-16 h. The curtailment load's total curtailment load occurs during eight 15-min time intervals (2 h in total) of the day, especially between 19-20 h, when there is a combination of low RES availability and high electricity prices. Air-conditioning in the heating option (for 10.5 h), refrigerator (for 6.25 h), and water heater (for 5.5 h) are operational during several hours of the day to maintain the temperature settings. Figure 15 depicts the optimal generation mix to satisfy home appliances' power consumption on the winter day. As can be observed, grid power covers the largest part of the home loads during the majority of hours (51% in total at a daily level), and on-site RES generation meets almost 39% of the total at a daily level. It is also worth mentioning that the combined RES availability, based on the forecast conducted, is zero in 21-24 h. EV contributes around 6% of the whole load, covering the home's consumption in the period 20:45-22:00 when the PV availability is zero, and wind is at relatively low or even zero levels. During the last seven time intervals, from 22:15 to 24:00, electricity imports the whole household load from the grid cover alone. Finally, ESS covers the remaining 4% in the energy contribution mix with relatively high percentages during several 15-min time intervals between 2-3 and 14-15 h. Due to the existence of the constraint stating that the home cannot import and export energy simultaneously at the same period, renewable energy sales to the grid occur only during periods when the on-site infrastructure, ESS and EV, can cover the household load alone and/or in combination between them. Figure 16 represents the renewable energy balance highlighting the flows in each time period of the winter day. It can be seen that the majority of electricity exports to the grid occur when there is increased PV availability, namely, in the period 10-16 h.   Figure 17 depicts the state-of-energy in the ESS, including also the charging and discharging decision making. It is clear that the ESS is being charged only when there are electricity purchases from the grid, while its discharge occurs when there are RES electricity exports to the grid, and thus, ESS contributes to the demand satisfaction. A similar pattern is also determined by the model solution for the EV chargingdischarging cycle, as presented in Figure 18. The strategy followed includes the full EV charging before it starts its trip, and after its return, it is mainly utilized for power discharge, up to its minimum allowable operational battery storage level at the end of the day.  Table 12 summarizes the evolution of the inside house (AC), refrigerator, and water heater's temperatures during the whole winter day. The temperature lower and upper limits are guaranteed in all cases through the periodical activation of the specific appliances.  Figure 19 shows the optimal demand allocation of the smart home appliances' scheduling in each period of the summer day, satisfying the user's time preferences simultaneously. The total daily load equals around 115 kWh, peak load amounts to 7.46 kW at 15:00, while the lowest load, being equal to 1.61 kW, is reported at 09:00 and 09:45 when only uncontrollable power loads and sensors are activated. A striking difference with the winter day's corresponding allocation is the relocation of the peak loads towards the second half of the day. In particular, the household's consumption exceeds the level of 6 kW for 31 15-min time intervals during the second half of the day (12:00-00:00) and ten 15-min time intervals during the first half of the day (00:00-12:00). The winter day's corresponding values are 31 15-min time intervals during the first half of the day (00:00-12:00), and seven 15-min time intervals during the second half of the day (12:00-00:00). This is also reflected in the overall demand allocation. In particular, around 46% of the total daily load is activated during 16-24 h, followed by almost 28% in 0-8 h and 26% in 8-16 h. The total daily net cost, namely, expenses for acquiring the grid's electricity minus revenues from selling renewable electricity to the grid, for the smart home's operational scheduling leads to small expenses of around EUR 7.80. Figure 20 highlights the operational schedule of adjustable, curtailable, and thermostatic loads in each period of the summer day. The adjustment option of the adjustment load activates for 13 15-min time intervals (3.25 h in total), especially during the period 10-16 h. The curtailment load's total curtailment load occurs during eight 15-min time intervals (2 h in total) of the day, especially between 09:45-11:00. Air-conditioning in the cooling option (for 3.5 h), refrigerator (for 7.5 h), and water heater (for 7.5 h) remain operational during several hours of the day to maintain the temperature settings.   Figure 21 depicts the optimal generation mix to satisfy home appliances' power consumption on the summer day. The grid's electricity imports continue to be the dominant source, standing for almost 48% of the total, followed by on-site RES generation and direct utilization accounting for 27% of the total and the increased contribution from EV and ESS, whose share amounts to 12 and 11% of the total, respectively. As can be observed, despite the favorable weather conditions and the increased PV availability, on-site RES generation displays a lower share in the demand coverage mix than on the winter day. This is because electricity sales to the grid more than double on the summer day than on the winter one, as depicted in Figure 22. In particular, almost 96 kWh of RES generation are sold to the grid on the summer day, while the winter day's corresponding value was 36 kWh. The amount of RES generation directed to cover the household's requirements equal almost 34 kWh at a daily level, and around 6.5 kWh are utilized for the combined charging of the EV and ESS.      Table 13 summarizes the evolution of the inside house (AC), refrigerator, and water heater's temperatures during the whole summer day. The most striking difference with the winter day is the noticeable increase in the inside home temperature, ranging from 0.4 • C at 00:00 to 4 • C at 14:00.

Conclusions
A generic optimization framework for optimal smart home's load dispatch is presented in this work under the presence of an energy storage system, electric vehicle, renewable energy generation system, and interaction with the grid. The model is formulated as a MILP model, and the model's objective concerns the minimization of the total net daily cost of the system, employing an intra-hourly time step. The model determines the optimal energy mix on the supply side (generation allocation and energy exchanges with the power grid), the operation of flexibility providers (ESS and EV), and the smart home's appliances' optimal load dispatch on the demand side. The model outputs highlight the synergies between the supply and demand side towards more efficient energy resources' utilization and higher cost savings. The renewables' availability factors significantly influence the appliances' demand scheduling and the allocation of renewables-based generation. The fact that energy exchanges with the grid are constrained to at most one direction in each period has as a consequence the increased RES availability to lead to decreased direct utilization of that generation and increased energy sales to the power grid. This deficit is covered by more intense utilization of the ESS and EV flexibilities. In addition, the incorporation of a constraint regarding the amount of peak load leads to a demand levels between 1.61 and 7.46 kW in both cases, among which the thermostatic loads comprise the largest consumers.
In the absence of that constraint, the objective function value can be significantly improved, also resulting in a different demand scheduling mix. Future expansions of the methodology will regard the model extension into a multi-energy system in order to meet the electrical, cooling, and heating demands of end-users, and the application of the proposed modeling approach at a neighborhood and/or urban level, also considering various Distribution System Operator (DSO) topologies.
Author Contributions: N.K. performed the research, developed the smart home energy optimization model, and wrote the paper. I.P.P. provided guidance for the research and developed the forecasting models. D.P. and G.C.C. provided guidance for the research and revised the paper. All authors have read and agreed to the published version of the manuscript.