Comparisons with Previous Works

Concerning the validation of the power simulation accuracy and the comparison with other work, it is not possible to directly compare with other similar methods, as it would imply re-implementing the codes of other authors, since the comparable frameworks are not open-source. Although different in the way the co-simulation of power and cost is carried out, one possible option is to build the same proposed framework in Simulink, the work of [36] has demonstrated that already demonstrated that a SystemC-based homogeneous simulation can conduct the EES power simulation with excellent accuracy compared with Simulink (the average error is smaller than 0.0001%; the maximum error of all different components in the EES is smaller than 0.5% ), while achieving a speedup of about 250X on simulation time. In terms of the cost evolution, Simulink it requires additional post-processing of power traces to track the cost metrics, which further supports the benefits of our proposed concurrent simulation, as the post-processing for the evaluation of the cost is proportional to the length of the total simulated interval.

#### 5.1.4. Design Space Exploration through Proposed Simulation Framework

The previous section has shown the type of analysis that our framework can provide; however, its main use is to allow a cost-aware design of EES while simultaneously simulating the power flow of the system.

To demonstrate this feature, this Section provides three possible design space exploration (DSE) experiments to rank different system configurations from the cost perspective. We first compare the *adoption of two possible power policies*: the standard power managemen<sup>t</sup> policy proposed in Section 5.1.1 and a cost-aware policy, designed for real time pricing rates.

Then, we propose two design space explorations that consider as variables *the amount of power sources and of energy storage*; i.e., the numbers of PV modules, battery cells, and wind turbines included in the system. The reference initial configuration is the one proposed in [46] and listed in Table 1, i.e., one wind turbine, 30 PV modules, and a battery pack of 2400 battery cells. The first experiment carries out an exhaustive exploration of different configurations to determine the one with the highest economic profit as computed by Equation (9); the second one explores the most profitable configuration under the fixed initial capital cost limitation.

#### Comparison of Different Power Bus Policies

The pricing policies applied by the grid suppliers have an important impact on the profit and the costs connected to EES operation, as evident from the different cost definitions provided in Section 3. When building the power managemen<sup>t</sup> policy of an EES, it is thus crucial to determine how the energy balance between loads and renewable power sources fits the pricing policy that will be applied by the supplier.

The power managemen<sup>t</sup> policy presented in Section 5.1.1 is not cost-aware: it assumes a traditional *time of use* (TOU) policy like the one in Section 5.1.2, where electricity price is different at different times of the day (higher/cheaper rates during peak/off-peak hours). However, the smart grid market has started featuring into complex pricing policies [54–56]. Comparing such rates and understanding their economic impact given the power managemen<sup>t</sup> policy is far from trivial.

The framework proposed in this paper naturally enables this kind of analysis, thanks to the concurrent cost/power co-simulation of the EES on typical environmental traces, with the possibility of evaluating different power managemen<sup>t</sup> policies implemented by the power bus.

To prove this effectiveness, we compare the adoption of the non-cost-aware policy presented in Section 5.1.1 with a cost-aware policy. In the latter, electricity price is changed dynamically according to a *real time pricing* (RTP) strategy. RTP improves flexibility as electricity price closely reflects the trend of the wholesale market and of the energy demand over time on the grid: prices vary at any time of day, several times per day, and differently on different days (even working ones) of the week; this should encourage users to behave in a flexible manner to reduce demand peaks [56].

As a possible strategy that uses this dynamically changing pricing, we propose the following energy managemen<sup>t</sup> policy: if the renewable power sources cannot satisfy the load demand, the power bus checks the current price of electricity. If the price is *lower than the daily average buying price* (calculated as the moving average over one week), then electricity is bought from the grid. This allows one to save the energy stored in the battery pack for more expensive time slots. This modification makes the policy cost-aware, as it shifts electricity demand on the grid to cheaper time slots.

Figure 9 analyzes the impact of the two policies (the non-cost-aware and cost-aware ones) by comparing the simulation results on a one-week simulation, from Monday to Sunday. Plot *A* shows the evolution of the total load power consumption of the whole community (blue) and the total power generation from renewables (i.e., PV modules and wind turbine, in red), in order to highlight the power balance in the system. Plot *B* indicates the evolution of electricity prices to buy energy from the grid applied by the cost-aware policy, as derived from [56] (solid) and the moving average used by the policy to implement cost-awareness (dashed); notice that the electricity price exhibits a high heterogeneity not only across the hours of a single day but also across different days of the week. As a concrete comparison between the two policies, plot *C* reports the SOC profile of the battery pack (dashed for the cost-aware, solid for the non-cost-aware).

The main difference is visible on Monday (Day 1), when the total renewable power generation cannot satisfy the load consumption. Since the RTP is lower than the average buying price, the cost-aware policy does not use the battery (whose SOC does not change in this interval), but rather buys power from the grid. Vice versa, the non-cost-aware policy uses the battery to provide, and the SOC curve of non-cost-aware policy (orange color) reaches the minimum threshold of 10%.

Table 4 lists all the costs after one year of operation by applying the two different policies. Net cost and profit are calculated with Equations (7) and (9): net cost is the sum of real-time capital costs, operation and maintenance costs, and the cost of buying/selling power from/to the grid; notice the cost of selling energy (second row) is a negative value since it is treated as a gain of the EES

compared to the cost of buying energy; profit is the value gained by using renewable power sources minus the net cost. The year uses the same real load consumption (total AC loads of 15 houses [49]), environmental data collected by MIDC at University of Arizona [51] as the previous simulation, and RTP is extrapolated by [56] repeating the 1-week profile shown in Figure 9B. The cost-aware policy reduces the time-dependent capital cost and operation and maintenance cost of the battery, which is less involved in the EES energy flow. However, the cost to buy from the grid is higher for the cost-aware policy, and it is not compensated by a higher gain to sell to the grid. This is not counter-intuitive: a cost-aware policy is not necessarily improving the overall net cost or profit, as shown in the table, but it is just inclusive of the electricity cost in the decision of the energy flow. While the choice of buying energy when the price is low seems reasonable, it causes in fact a reduction of the energy provided by the EES itself (avoid using the battery and rather buy when electricity price is considered low, thereby reducing the benefit generated by using power sources to feed the loads).

**Figure 9.** Different scenarios of two power managemen<sup>t</sup> policies within one example week.

Generally speaking, the design of a smart energy managemen<sup>t</sup> policy that maximizes the profit is not the target of this work. In this section we just showed that the proposed simulation framework can easily include cost "in the loop" and can efficiently validate the policies over time intervals of practical significance. In this perspective, the result on the cost-aware policy confirms that it is necessary to evaluate the mutual impact of cost and power, to ge<sup>t</sup> a complete view of the economic advantage of the EES under design.


**Table 4.** Different cost values after one year operation by two policies.

Exhaustive Exploration of Different Configurations

The first scenario is an exhaustive DSE to determine the configuration with the highest economic benefit. Two cases are described in here based on the presence of wind turbine. As the capital cost of one wind turbine is approximately equal to the capital cost of 29 PV modules, the ranges of the parameters of power source and energy storage are set as follows:


The AC loads and input environmental traces are same as the ones introduced in Section 5.1.3. The TOU scheme is adopted as electricity buy price, 0.03 \$/kWh as the electricity sell price; then we use the non-cost-aware power managemen<sup>t</sup> policy in the exploration simulations.

The left-hand side of Figure 10 shows the *net cost* for the cases with (top left) and without (bottom left) wind turbine after 20 years, which is the maximum operating lifetime of wind turbine and PV modules. The right-hand curves show instead the corresponding 20 years *annualized cost* computed by Equation (8). The x-axis and y-axis represent the different numbers of PV modules and battery cells in the pack, and the z-axis represents corresponding cost.

**Figure 10.** Net cost (**left**) and annualized cost (**right**) of different ESS configurations after 20 years with (**top**) and without (**bottom**) wind turbine.

The results illustrate the advantage of wind turbine in the EES: the annualized cost of those EES including wind turbine is about 10% of the annualized cost of configurations including only PV modules and batteries. Such a big advantage is mainly caused by the complementary effect of the wind turbine with respect to photovoltaic energy generation: the wind turbine mostly generates power at night or on cloudy/rainy days, when the PV modules cannot generate power or can only generate power with low efficiency. Additionally, the wind turbine increases total power generation during the peak hours to reduce the need of buying power from the grid.

The optimal EES configuration without wind turbine is made of 5000 battery cells and 150 PV modules, thereby reaching an annualized cost of 0.9591 \$/kW. The optimal configuration when the wind turbine is present has 2000 battery cells and 100 PV modules, with a total 0.4984 \$/kW annualized cost. This confirms the intuition that annualized cost can be reduced by increasing total power generation.

However, such configurations may not be optimal from the perspective of *profit*; i.e., when taking into account also the advantage of self-consumption of power generated by the renewable power sources. The corresponding results for the exhaustive exploration results in the perspective of profit are shown in Figures 11 and 12. The x-axis and y-axis represent the different numbers of PV modules and battery cells in the pack. The z-axis represents the total profit of EES computed by Equation (9) for the various configurations, at different points of the lifetime of the EES (i.e., after 5, 10, 15 and 20 years).

**Figure 11.** Profit in different years with various configurations for case without wind turbine in EES.

**Figure 12.** Profit in different years with various configurations for case with wind turbine in EES.

Figure 11 refers to EES configurations without the wind turbine: the results illustrate that **none** of the configurations without a wind turbine results into a positive profit, even after 20 years. The 3-D

surface shown in the figures indicates that the more PV modules the higher the benefit, still on the negative profit side. The optimal configurations is different from the previous analysis and always include 6000 battery cells and a number of PV modules that varies from 140 to 150 (due to the varying nature of environmental inputs and load power consumption profiles over the years). Notice that, for longer time horizons, the profit of the EES worsens, e.g., the configuration of 6000 battery cells with 140 PV modules has lost 2805.77 K\$ after one year, and this loss is enlarged to 58,080.77 K\$ after the EES run for 20 years.

When the EES includes the wind turbine for generating power, there exist several configurations making profit, as revealed in Figure 12. This proves once again the benefit of a wind turbine in the EES.

According to the simulation results, the optimal configuration with highest profit is made of 3000 battery cells with 60 PV modules and one wind turbine. Some years see a higher profit when decreasing PV modules to 50, due to the different weather conditions and load power profiles; however, the increase in profit is minimal; e.g., the configuration with 50 PVs leads to an increase of 86.90 \$ after 5 years, while one with 60 PV modules makes a profit 850.42 \$ bigger than the 50 PV modules one after 20 years). Thus, the two configurations can be considered comparable, and the user may choose the one he prefers (e.g., the one with lower initial capital cost), knowing that the profit will be comparable.

#### Exploration with Fixed Initial Capital Cost

A more realistic scenario is the one where the initial capital investment is a fixed constraint, i.e., the compared EES configurations have same initial capital cost. Given the big advantage of the presence of a wind turbine in the EES indicated in the previous exploration, the configurations considered in this analysis always take into account the presence of the wind turbine.

We assume an initial capital cost to 60,000 \$: Table 5 lists 20 different configurations with different numbers of PV modules, battery cells and wind turbines, with an initial capital cost as closed as possible to 60,000 \$. Note that configurations from 1 to 13 have one wind turbine, and explore the number of PV modules (from 0 to 60) and of battery cells (0 to 16,200). Configurations from 14 to 20 additionally explore the introduction of a second wind turbine, thereby lowering the number of the other EES components to meet the initial capital cost constraint.


**Table 5.** Different configurations with fixed initial capital cost in the exploration.

Furthermore, we bring another factor in the exploration to investigate the influence of weather condition. We conduct the exploration with data relative to two locations from the database of NREL's MIDC [51] that have significantly different climatic characteristics: one is located in Eugene, Oregon (cloudy and wet climate), the other in Tucson, Arizona (dry and windy climate).

The exploration results in perspective of profit in both locations show the same finding as previous explorations, the highest profitable configuration is the same one in each year.

Figure 13 shows the profit results after 20 years for the two locations. As expected, the profits in Arizona (right) are always higher than in Oregon, due to its better environmental conditions. Table 6 lists the profit made by highest profitable configuration at both locations in different years: the difference of the profit keeps about 150%, due to the their climatic characteristics. For example, the average annual energy generated by PV modules for configuration 10 in Arizona is about 30,000 kWh, and the wind turbine produces about 50,000 kWh every year; while the same numbers in Oregon become about 20,000 kWh and 25,000 kWh, respectively.

Overall, the highest profit configuration in Eugene is number 19 in Table 5, and the highest one is number 18 for Tucson (peaks of the 3-D surfaces across all years). Note that both optimal configurations have two wind turbines, thereby proving that wind power generation is the critical factor among three modifiable parameters in the EES. The valleys in both 3-D surfaces correspond to 13, which features no battery: this indicates that the battery pack also plays an important role to maximize the profit, as it reduces the need for buying energy from the grid.

**Figure 13.** Profit of different configurations have same initial capital cost at two locations.


**Table 6.** Highest profit at both locations in different years.

## *5.2. EES Case Study 2*

In order to show the high flexibility of our proposed simulation framework, we built another EES case study as described in Figure 14; the EES is composed of a PV array, an electric vehicle (EV), an AC load, a common DC bus, and the relative converters. The left-hand side of Figure 14 draws the conceptual graph of the new EES case study, the right-hand side displays the corresponding modules of the EES in the proposed simulation framework.

The construction of the power layer and cost layer in the proposed simulation framework has been done similarly to the previous example of Sections 5.1.1 and 5.1.2.

**Figure 14.** Structure of the EES case study 2 (**left**) and result of the application of the proposed approach (**right**).

Concerning the power layer, the PV array has been modeled by starting from a single PV module model [48], which has then been scaled up to the size of the final array; namely, 10 PV modules to mimic a small-size residential PV installation. In this case study the size of the array is fixed. The AC load represents the power consumption of one single house from dataset [49]; converters are modeled as already described above [50]. The EV consists of two sub-modules; namely, the battery pack module and EV motor module; their models are built by the methods provided in [50]; the grid is used to keep track of the power balance between house power consumption and PV array power generation and energy storage of EV.

The input traces of solar irradiance from the dataset provided by the National Renewable Energy Laboratory's (NREL's) Measurement and Instrumentation Data Center (MIDC) [51]. Concerning the driving profile, we assume the EV operates according to a daily commute routine: the driver leaves at 7:30 a.m. and drives half an hour to arrive at the destination; then he/she drives another half an hour and comes back home at 7 p.m. We assume the EV consumes the identical energy every day in the following simulations to remove from the analysis the influence from the EV driving situations. This scheme can obviously be changed should one be interested in analyzing the fluctuations due to specific driving patterns.

We envision two main scenarios in the EES daily operation; the first one is with the EV plugged, the second one is when PV acts as as the only power source connected to the EES. The power bus module implements a cost-aware energy managemen<sup>t</sup> policy: (1) when the EV is not connected, the PV array provides its generated power to satisfy load demand of the house; excess power will be sold to the grid while power deficit will be bought from the grid; (2) when the EV is plugged, we set a threshold electricity price to decide whether the power consumption of the house is provided by the EV (price < threshold), or bought from the grid (price > threshold). However, the EV can provide power only until its battery SOC reaches to 10%, then the house will have to buy from the grid the required power, and the EV will start to charge the battery until the electricity price goes below the threshold price. As already discussed for the previous uses case, this is just an example of policy and it has no claim of optimality; our objective is to show the flexibility of the framework and not to provide optimized policies.

Concerning the cost layer, we adopted the three-time slots electricity price as indicated in Table 3 in this case study and we set the threshold electricity price is 0.21 \$/kWh; therefore, it means EV plays the power source role in the EES during the electricity price in the F1 and F2 periods if it has residual energy.

The cost items referred to the battery and the PV modules are the same as in Tables 1 and 2. We selected several EVs with different battery pack sizes in the market used in the following simulations.

Notice that the cost analysis does not consider the items involved in the EV operations outside the house EES, such as possible intermediate charging costs or different driving distances.

## 5.2.1. One-Week Example Simulation Traces

We extract a five-day simulation (one week of working days) results of the EES with EV case study to show the different power and cost quantities that can be tracked in our proposed simulation framework. For the battery pack size of the EV used in this example, the 21 kWh battery pack with 40*sX*40*p* configuration is adopted. The selected solar irradiance trace is the location at the University of Arizona [51]. The load consumption profile is extracted from the number 1 house in the dataset [49].

## Evolution of the Power Layer

Figure 15 shows the EES main quantities evolution of the power layer. Plot A shows the PV array generation power evolution, it illustrates the EES does not have a renewable power source during the night. Plot C shows the result of the power bus policy that leads to buy or sell energy with the grid. Plot D shows the SOC over time of EV battery pack and plot E shows the corresponding battery current profile, the positive value means the discharge current, the negative values means the charge current.

**Figure 15.** Five-Day simulation of the EES in terms of power tracing quantities. The PV power generation profile is shown in (**A**) illustrate different daily weather conditions; (**B**) reports the load power consumption of one house; the interactions with utility grid to buy or sell energy due to the energy surplus and deficit are illustrated in (**C**); battery SOC profile is shown in (**D**), within its operating range from 10% to 90%; the corresponding battery current is indicated in (**E**).

In order to show how the policy executed in the power bus and how we consider the time-dependent capital and O&M cost of the battery pack in EV in our simulations, we extract one day from Figure 15 to give more details as shown in Figure 16.

Because EV leaves from the house at 7:30 a.m. and comes back home at 7 p.m., there are two periods after 7 a.m. and before 7 p.m. in the plot C indicate the SOC of battery decreases (as estimated) due to the driving. In the period when the EV is plugged in the house, the battery pack in the EV provides the power to the house if the electricity price is higher than the threshold price 0.21 \$/kWh, therefore, plot E shows there are discharge currents between 7 a.m. and 7:30 a.m. and from 7 p.m. to 11 p.m. However, the SOC of battery pack reaches its bottom operation limitation 10% during the period from 7 p.m. to 11 p.m. as indicated in plot C, so the house has to buy power from the grid starting from about 9:50 p.m. as shown in plot B.

As discussed above, the cost generated by the EV daily driving and charging does not take into account in our analysis, the reason is that the EV is independent energy storage or power source component to the house, there is no direct relation between load demand of the house and the EV, we only consider the power involved between the EV and the house when the EV plays a role of the power source. Therefore, the power consumed by the daily driving and the charging power to backfill such consumed power is ignored, but the charged power for compensating the power provided to the house should be taken into account. This point is illustrated by plots B and C, the EV starts to provide power to the house when it comes back house at 19:00 and the SOC is about 40% at that time as indicated by red arrow A; then the house start to buy power from the grid after the SOC decreases to 10% at around 21:45 as shown by red arrow B; the electric price is lower than the threshold price after 23:00; thus, the EV starts to charge the battery pack; when the SOC increases to 40% around 24:00 as indicated by red arrow C, the bought power for charging the battery is stopped since it reaches the SOC when the EV arrives at house, only left the bought power for the load demand of house as shown in plot B. We remove the influence of the EV driving conditions from our analysis in this way, only consider the period between arrow A and C which is the period of EV involved with the House.

**Figure 16.** One-day long simulation with power quantities of the EES extracted from Figure 15.

## Evolution of the Cost Layer

The corresponding cost quantities traces are shown in Figure 17, each subplot is related to one cost equation formalized in Section 3.2.1.

Plots A and B show the time-dependent capital cost and operation and maintenance cost of PV modules and battery pack in EV; the time-dependent capital cost of PV modules is updated according to Equation (2), so it increases as time elapses. Conversely, the time-dependent capital cost of the battery pack is given by Equation (4), so it only increases when the EV connects with the house to provide the power or to charge the battery pack to backfill the provided power; both actions use Equation (5) to compute the operation and maintenance cost; therefore the curve of PV is related to the power generation profile that keeps stable during the night and increases during the daytime, whereas the curve of the battery pack has the similar trend as time-dependent capital cost.

Plot D shows the cost related to the grid as per Equation (6). It indicates that the surplus PV power is sold to the grid and the house needs to buy the power if PV power cannot satisfy the power demand when the EV is disconnected with the house; it also indicates that the house always buy the power from the grid from 11 p.m. to 7 a.m. due to the low electricity price. The blue line in plot F shows the net cost formalized by Equation (7), which grows over time since it is a result of the sum of the described previous cost. Plot E shows the evolution of intrinsic benefit generated by using the PV power and battery pack of EV, instead of buying power from the grid to satisfy the load demand. The orange line in plot F illustrates the profit profile of the EES computed by Equation (9), the negative values tell this EES cannot bring profit finally, but notice that the EES still can bring the benefit, a more comprehensive comparison is introduced in the following section to illustrate the benefit of EES.

**Figure 17.** Five-day simulation with cost quantities of the EES corresponding to Figure 15.

#### 5.2.2. Comparison of Different EVs in the EES

As an example of design-space exploration, we investigated the impact of different EVs involved in the EES, in terms of different battery sizes. We select several EVs (with different battery pack sizes) in the following simulation. Table 7 lists the corresponding configurations, chosen from a set the popular common EVs in the market [57]. We also added two configurations without battery pack involved in the EES as a reference. The first one shows a scenario in which the house always buys the power from utility grid since there is no any other power sources; the second one indicates the house can also ge<sup>t</sup> the power from PV modules instead of only buying power from the grid, while still having no storage (EV).


**Table 7.** Different configurations of EES for comparing the cost quantities.

Table 8 shows the one-year long simulation results of the different configurations list in Table 7. The first row indicates the situation when all the load demand needs to be satisfied by the grid, so there is only electricity buying cost, the net cost and profit is computed based on the Equations (7) and (9), respectively; notice that the negative sign in the last column means an absolute cost for the household. The PV array cost columns are constant but in the first case, as it generates the same power. The "buy" electricity cost column indicates that the cost of buy electricity decreases if the battery pack size in the EV increases due to the residual energy of battery pack increases when the EV comes back house, the last three cases show that the "buy" electricity cost are same because of the maximum energy can be provided to the load by the battery pack is reached, it means increasing the battery pack size becomes useless.

The "own" electricity cost behaves similarly to the buy cost; it first increases for increasing battery sizes, then it stabilizes since the maximum energy provided by the EV is reached. The battery pack cost columns indicate that the O&M cost is positively correlated to the power provided from the battery pack, while the time-dependent capital cost column tends to decrease for larger sizes because the time-dependent capital cost (Equations (4) and (10)) states that the aging degradation is reduced when the battery pack size increases.

The last column in the Table 8 illustrates that all the different EVs involved in the EES cannot bring profit for the house, which is not like the results in the previous case study, for example, 3000 battery cells with 60 PV modules and 1 wind turbine combination of previous EES case study can generate positive profit as shown in Figure 12. However, involving EV in the EES can bring economic benefit compared to the situation when this is no EV in the EES; for example, involving an EV with a 16 kWh battery pack (third row) can bring 16.36 \$ economic benefits compared to the EES without EV involved (second row). Finally, the profit-optimal battery size is the one in the third case; it provides about a 1104.33 \$ benefits compared to the case without PV modules and EV involved in the EES.


**Table 8.** Cost quantities simulation results of one-year period with different battery packs in the EV.
