*2.3. Energy Storage System Model*

Whenever the combined output power of WT and PV generation surpasses the capacity of load demand, the ESS transitions into the charging state. The amount of energy stored at any given time *t* is primarily determined by the difference between the sum of the total PV and WT generation, and the load demand.

### 2.3.1. Battery Energy Storage System (BESS)

The amount of discharging and charging power drawn or sent to the battery energy storage system, respectively, is subject to the previous state of charge (SOC) as well as the ESS system constraints. The SOC at any given *t* is determined by the following equation.

$$\text{SOC(t)} = \left[ \left( PV\_p(t) + WT\_p(t) \right) - \frac{L\_D(t)}{\beta\_c} \right] \times \beta\_{ch} + \text{SOC(t-1)} \left( 1 - dr \right) \tag{3}$$

where *SOC*(*t* − 1) and *SOC*(*t*) and is the BESS state of charge for the previous and current period in kWh, respectively. *LD*(*t*) is the load demand, *βc* denotes the power converters efficiency, *dr* and *βch* is the hourly self-discharge rate and BESS charging efficiency respectively. Whenever the total generation cannot meet the load demand, BESS shifts into the discharging mode. Consequently, the current state of charge at any given time *t* is given by:

$$\text{SOC}(t) = \left(\frac{L\_D(t)}{\beta\_{ds}} - \left(PV\_p(t) + \mathcal{W}T\_p(t)\right)\right) / \beta\_{ds} + \left(\text{SOC}(t-1)\left(1 - dr\right)\right) \tag{4}$$

where *βds* is the discharging efficiency. The energy storage level (SOC) must be constrained within the upper *SOCmax* and the lower *SOCmin* bounds of the BESS.

$$\text{SOC}\_{\text{min}} \le \text{SOC}(t) \le \text{SOC}\_{\text{max}} \tag{5}$$

### 2.3.2. Pumped Heat Energy Storage (PHES)

The PHES stores electricity as sensible heat in two thermal storage system; a hot high pressure and temperature tank (+500 ◦C, 12 bars pressure) and a cold low pressure and temperature tank (−160 ◦C, 1 Bar). It also consists of a two compressor/expander pair, argon as a working fluid and it uses gravel as the storage medium. The operation strategy is analogous to pumped hydro storage but rather than pumping water, heat pumping is used to create temperature difference. Theory of operation and development is adequately covered in [44–46]. Figure 2. shows the schematic diagram of the PHES.

**Figure 2.** Schematic diagram of PHES.

The energy stored in a PHES depends on the temperature differences between the two thermal storage system. The energy stored *ESSphes*(*t*) in the reservoirs per unit volume is the difference between the internal energies of the storage medium in the hot and cold stores. The internal energies of the storage medium are the function of the mass (*Mr*) and specific heat densities of the storage medium (*SHr*). The energy stored can be determined by the temperature difference between the hot and cold store [47] as illustrated below:

$$ESS\_{\text{plus}}(t) = M\_{\text{I}} \times SH\_{\text{I}} \times \left\{ \left( T\_2(t) - T\_3(t) \right) - \left( T\_1(t) - T\_4(t) \right) \right\} \tag{6}$$

The power output and input *Pphes*(*t*) of the PHES per unit volume (for charging and discharging instance) is determined by the mass (*Mg*) and the specific heat of the argon gas (*SHg*), and the temperature difference [48] as follows:

$$P\_{\rm phys}(t) = M\_{\mathcal{g}} \times SH\_{\mathcal{g}} \times \left\{ \left( T\_2(t) - T\_1(t) \right) - \left( T\_3(t) - T\_4(t) \right) \right\} \tag{7}$$

where (*<sup>T</sup>*1(*t*), *<sup>T</sup>*2(*t*)) are the top and (*<sup>T</sup>*3(*t*), *<sup>T</sup>*4(*t*)) are the bottom section temperature of the hot tank and cold tank respectively.

### **3. Flexible Demand Resources (FDRs) and Demands Response Program (DRPs)**

Figure 3 shows the flowchart for the integrated system planning method considered in this work. The framework combines the optimal ESS scheduling and optimal DRP implementations. The FDRs play significant roles in the flexibility managemen<sup>t</sup> of the system whenever they are appropriately activated to minimize the mismatch between generation and demand. The DSM approach that is employed in this study for the DRPs is based on the optimal scheduling of appropriate FDRs in the microgrid as explained below. The net capacity of the shiftable load demand (*FDR*), throughout the system scheduling period, is assumed to have a maximum range of up to 10% up (*FDRmax*) and down (*FDRmin*) of the initial total FDR load demand value [49].

$$FDR^{\min} \le FDR(t) \le FDR^{\max} \tag{8}$$

**Figure 3.** Flowchart for the proposed integrated system planning framework.

### *3.1. Price Elasticity of Demand and Load Modeling*

A change in price of a service will have an impact on the amount of quantity demanded. For instance, a change in the price of electricity (*∂Epr std*(*i*)) in the *i*th period will result in a change of the load demand (*∂LD*(*j*)) in the *j*th period either by increasing or decreasing the load demand. Thus, a change in electricity price during the single period *i*th affects the load demand during all the periods (*T*). The price elasticity of demand (*PEφ*(*<sup>i</sup>*,*<sup>i</sup>*)) gives a measure of the responsiveness at which the end-user time-shift their energy consumption patterns with respect to change in electricity as shown below:

$$PE\_{\phi(i,i)} = \frac{E^{pr}(i)}{L\_D(i)} \frac{\partial L\_D(i)}{\partial E^{pr}(i)}; \ \forall i, j \in T \tag{9}$$

The price elasticity of demand entails self and cross-elasticity; the self-elasticity defines the sensitivity of load demand with respect to price within the same pricing interval (single period elasticity) and usually has a negative value implying some proportion of the load cannot be transferred from one period to another. On the other hand, cross-elasticity (*PEφ*(*<sup>i</sup>*,*j*)) defines the load demand sensitivity of the (*i*th) pricing period in response to the electricity price variation in the (*j*th) pricing period (multi-period elasticity) and usually has positive value implying some proportion of the load demand is shiftable to another period. The cross-elasticity of load demand is given by [50];

$$PE\_{\phi(i,j)} = \frac{E\_{std}^{pr}(i)}{L\_D(j)} \cdot \frac{\partial L\_D(j)}{\partial E^{pr}(i)}; \ \forall i, j \in T \tag{10}$$

### *3.2. Critical Peak Pricing (CPP) Demand Response Program*

CPP is a time-based DRP that divide electricity usage time into periods and presents the fixed electricity prices for each period in advance; peak and off-peak periods. It is usually employed to increase system energy efficiency and alleviate stress on the power system especially when the load demand is likely to surpass the generation capacity. It commonly enforces a very high electricity price during system peak load demand periods and for some specific time periods in order to achieve load reduction during these periods, and retains a flat pricing scheme or a lower electricity price during off-peak periods [51]. The electricity customer responds by shifting load demand from one time period to another due to the enforced pricing scheme. The ultimate customer's demand profile after implementation of CPP DRP is expressed as [41,52]:

$$\begin{aligned} L\_D^{cpp}(i) &= L\_D(i) \left\{ 1 + P E\_{\phi(i,i)} \frac{[E\_{cpp}^{pr}(i) - E\_{\text{std}}^{pr}(i) + pd(i) + ps(i)]}{E\_{\text{std}}^{pr}(i)} \\ &+ \sum\_{j=1, j \neq i}^{T} P E\_{\phi(i,j)} \frac{[E\_{cpp}^{pr}(j) - E\_{\text{std}}^{pr}(j) + pd(j) + ps(j)]}{E\_{\text{std}}^{pr}(j)} \end{aligned} \right\} \tag{11}$$

where *Epr std*(*i*) is the standard Kenyan electricity price before CPP DRP implementation, *Epr cpp*(*i*), *Epr cpp*(*j*) is the electricity price for current *i*th period and the *j*th period after implementation of CPP DRP, *pd*(*i*) and *pd*(*j*) are the incentives and *ps*(*i*) and *ps*(*j*) are penalties enforced for non-compliance's of DRP.

### *3.3. Time-Ahead Dynamic Pricing (TADP) Demand Response Program*

The cost of generation and the corresponding cost of electricity are highly affected by the shortages and surplus of power generated in the power system. Short periods of mismatch in load demand and generation might necessitate an over-sizing or additional capacity in the ESS that might not be necessary or efficiently used during normal operating times. A remedy to this challenge is to offer motivating electricity prices to influence a time shift in FDRs by the end user. A longer pricing horizon ahead of time can guarantee end-user participation in the DRP. Thus, in TADP DRP, time-ahead electricity pricing profile formulated as a function of the mismatch in the forecasted demand and generated power is relayed to the end user an hour (one period) in advance.
