betaFeedback

WorksMathematics

Statistical and Optimization Models for Generating Electricity in Energy Markets

Abstract

Electricity generation has become a remunerative avenue for new investments, particularly in the area of renewable energy resources. This paper introduces a framework for integrating statistical methods with optimization modeling to improve decision support in electricity generation. The analysis begins by evaluating the success of mini-grid projects installed across the globe using both a probit and a Bayesian hierarchical model to estimate the probability of project success. Furthermore, we provide a multi-resource optimization framework for determining the optimal profit in electricity generation while reducing carbon emissions in production facilities. We also analyze the impact of a battery energy storage system and bidding behavior in the Alberta electricity market by constructing a mixed-integer self-scheduling model that determines optimal charging and discharging strategies. Numerical experiments show how storage systems can enhance energy arbitrage profitability and influence market clearing prices. Finally, we propose a Stochastic Dynamic Programming (SDP) model to maximize profit in electricity generation while accounting for price volatility. Integrating statistical methods with optimization-based modeling reveals great value in achieving more effective, profitable, and clean energy systems.

Introduction

The availability of sustainable and clean energy in the world is one of society’s most important challenges. According to Ember [1], solar power alone met 75% of the net increase in electricity demand in 2026 and together with wind, these two sources met almost all (99%) of the global demand growth. In Canada, the reliability and affordability of energy is needed for the development of a robust Canadian economy - for example, energy costs are the third largest cost for mining operation (see for example [2]). To increase availability of energy and reduce costs, energy providers will need to look at alternative energy sources. Increasingly, this means producing energy from alternative sources, such as renewable energy sources, locally.

The purpose of this paper is to provide a model which will help small produces namely private or community based producers to enter the energy market by being able to predict how to produce and store energy in a way that will minimize costs and maximize profits. Large producers may also gain strategic advantage as storage systems, particularly battery storage systems (BESS) lower operating costs, reduce reliance on expensive peaking units, and improve overall system reliability, making them a powerful tool for modern energy producers navigating increasingly variable electricity markets.

Both small and large energy producers benefit from local energy generation. Local energy generation refers to the production of electrical power close to where it is consumed rather than relying on large, centralized power plants. Local energy generation often relies on distributed renewable sources like solar panels and wind turbines, supported by energy storage systems and coordinated through microgrids. Microgrids operates similar to the utility grid but are located near energy-consuming areas, thus reducing the burden on the utility grid. Instead of connecting all the power generation sources directly to the utility grid, microgrids operate within a grid of generators and renewable energy sources.

The novelty of this research is two-fold and first entails providing a comparison of statistical and optimization methods for maximizing profit in electricity generating. Our methods utilize fossil fuel, natural gas and renewables in generating electricity. Next we propose a stochastic dynamic programming approach to model a battery energy storage system and maximize profit.

The statistical method implemented in this paper, begins by extending the work done by Durand and Sahinyazan [3] in determining factors that influence the success of mini-grid projects installed across the globe. For their results, factors such as Ownership, particularly Community Ownership and Storage emerge as statistically significant predictors of the success of a renewable mini-grid project. Furthermore, we compare the results of a Probit regression model to a Bayesian hierarchical model in determining factors that influence project success. Results indicate, that the Bayesian model is suitable in capturing the underlying probability of a project being successful.

Second, we explore optimization methods for maximizing profit and minimizing costs in electricity generation and propose a mixed integer programming model towards a battery storage system. Our model decides hour-by-hour to charge/discharge in order to maximize profit, consistent with Alberta’s market participation rules. In addition to energy storage systems balancing the supply and demand of electricity, they can also reduce carbon emissions as stored renewable energy displaces fossil fuels during peak demand thus enabling reliable clean power. Furthermore, battery energy storage systems provide opportunities for energy arbitrage and take advantage of hourly off and on peak electricity prices by buying and storing electricity at times when prices are low, and then selling it back to the grid when the price of electricity is greater.

Moreover, optimization frameworks for battery energy storage systems have been proposed in [4, 5, 6]. The impact of providing energy arbitrage by energy storage systems in various electricity markets has been shown to be both a price-maker and price-taker [7, 8, 9, 10] with various statistical and optimization models being proposed in [3, 11, 12, 13, 14].

Third, we implement a dynamic programming model to maximize the profit in electricity generation while also accounting for the volatility of prices. Preliminary results indicate the dynamic programming model as a promising method when compared against the mixed-integer programming model for generating profit.

The remainder of this paper is summarized as follows. After a brief review of the related methods in § 2, we present in § 3, a comparison of a Probit and Bayesian model in determining factors that influence the success of a mini-grid installed across the globe. In § 4, we discuss mathematical models for maximizing profit in electricity generation and analyze the impact of a battery energy storage problem in storing energy and minimizing costs in § 5. In § 7 we propose SDP as a novel approach for maximizing profit in battery energy storage systems and the potential of models for capturing price volatility. Preliminary results indicate the dynamic programming model as a promising method when compared against the mixed-integer programming model. Finally we summarize and conclude in § 9 and discuss directions for our future work in § 10.

Related Work

Statistical and optimization models for electricity generation have been studied in various research [11, 12, 13, 14]. The statistical models deal in detail with explanatory variables for electricity price fluctuations whereas the finance models focus on the stochastic part of the price change. For example, in [11] a Bayesian regression model is employed to model the wholesale electricity market and in [12], a weather model using regression analysis is presented to predict the demand for the electricity supply system. The financial models in [13, 14], focus on capturing the volatility of prices in the Alberta electricity market. Moreover, Barlow [13] and Ware [14] propose diffusion models and Polynomial maps respectively to model the spikes and capture the volatility in prices. Additionally, Jarrow, Protter and Sezer [15] propose a credit risk model for a class of diffusion processes where the market observes the firm’s asset value when it crosses certain levels and interprets it as a significant change for the firm to make a public announcement.

Optimization models for electricity generation have also been studied in [16, 17]. Two-stage optimization modeling frameworks are proposed in [18, 19] for generating electricity given products, such as diesel generations and renewables. In [19], the electricity demand is assumed to be independently and identically distributed and the optimal investment strategy is determined using a multi-dimensional news vendor model. Moreover, an optimization framework for a price-maker energy storage system is developed in [17] which involves coordinating charging and discharging of an energy storage system in a nodal electricity market. Further optimization models for electricity markets are proposed in the following papers [20, 21]. In these papers, the problem is formulated as a bi-level optimization problem, consisting of bidding strategy and market clearing problems in the upper and lower levels. In [20] a single firm-model is proposed and is formulated as a Mathematical Program with Equilibrium Constraints (MPEC) with a parameter-dependent spatial price equilibrium problem as the inner problem. In [21] a binary expansion (BE) solution to the strategic bidding problem under uncertainty in short-term electricity markets is presented. The BE scheme is used to transform the products of variables in the nonlinear bidding problem into a mixed integer linear programming formulation.

In [6] a multistage stochastic programming (SP) model is formulated whose objective is to minimize the expected total energy costs incurred within a microgrid over a finite planning horizon. In this model, the demand, renewable supply and prices are all modeled as random variables. Furthermore, in [5], a stochastic optimization configuration model for the energy storage system is constructed. The expected revenue of the optimal configuration was found to be higher than the scheme with a fixed probability distribution model. Additionally, in [4], a global battery capacity optimization method for existing buildings based on the historical load is proposed for maximizing the annualized net revenue. Results show that the proposed method can effectively identify the global optimal capacity of the battery energy storage system for the buildings and caused an annual reduction in the electricity bills.

Stochastic dynamic programming have been applied to battery storage problems in various research [22, 23, 24, 25, 26]. The model in [22] considered the problem of operating a battery storage unit in a home with a rooftop solar photovoltaic (PV) system so as to minimize expected long-run electricity costs under uncertain electricity usage, PV generation, and electricity prices. Their model also incorporated approximate cost-to-go functions. In [23] a two-stage stochastic programming problem is formulated where the joint operation of wind with photovoltaic power systems has an energy storage device. The optimal bids and the energy flow in the battery are the first-stage variables and the energy flow is the second stage variable of the problem. In [24], the price arbitrage problem is formulated using stochastic dynamic programming and real-time prices are modeled as a Markov process. Results indicate that the proposed method captures 50% to 90% of arbitrage profit compared to perfect price forecasts. Another multi-stage stochastic programming model is proposed in [25] where the objective function comprises two terms: (1) the expected profit of the renewable energy owner and (2) the CVaR (conventional value at risk) multiplied by a weighting factor βW\beta W, which controls the degree of risk aversion of the renewable energy owner. Furthermore, in [26] battery storage optimization strategies are evaluated by comparing various stochastic dual dynamic programming (SDDP) model configurations against a linear programming (LP) benchmark mode. To the best of our knowledge, statistical and optimization methods including dynamic programming and stochastic dynamic programming have never been applied to a battery energy storage problem as done in our case.

Mini-grids in Electricity Generation

A Bayesian Hierarchical Model

First we begin by extending the work done by Duand and Sahinyazan [3] in determining factors that influence the success of a mini-grid project. Our proposed methods includes the following Bayesian hierarchical model with a bernoulli response. Consider YiY_i to be the outcome of minigrid project ii, and write Yi∼Bernoulli(pi)Y_i \sim Bernoulli(p_i), where pip_i is the probability of project ii being successful. The covariates are X1=StorageX_1 = \text{Storage} and X2=OwnershipX_2 = \text{Ownership}, in the model. The model is presented below:

Yi∣pi∼Bernoulli(pi),i=1,…,104(1)Y_i \mid p_i \sim\text{Bernoulli}(p_i), \quad i = 1,\ldots,104 \tag*{(1)}
logit⁡(pi)=β0+β1X1i+β2X2i\operatorname{logit}(p_i) = \beta_0 + \beta_1 X_{1i} + \beta_2 X_{2i}
X1i:Ownership,X2i:StorageX_{1i}: \text{Ownership}, \quad X_{2i}: \text{Storage}

Now pip_i:

log⁡(pi1−pi)=ηi=β0+β1X1i+β2X2i.(2)\log\left(\frac{p_i}{1-p_i}\right) = \eta_i = \beta_0 + \beta_1 X_{1i} + \beta_2 X_{2i}. \tag*{(2)}

now the shape of the posterior is proportional to the likelihood,

π(β∣y)∝L(β∣y),(3)\pi(\boldsymbol{\beta} \mid\mathbf{y}) \propto L(\boldsymbol{\beta} \mid\mathbf{y}), \tag*{(3)}

where

L(β∣y)=∏i=1104piyi(1−pi)1−yi,(4)L(\boldsymbol{\beta} \mid\mathbf{y}) = \prod_{i=1}^{104} p_i^{y_i}(1-p_i)^{1-y_i}, \tag*{(4)}

and solving for pip_i gives

pi=exp⁡(ηi)1+exp⁡(ηi).(5)p_i = \frac{\exp(\eta_i)}{1+\exp(\eta_i)}. \tag*{(5)}

We apply a Bayesian approach to the model in Eq. (1) and let βT=(β0,β1,β2)\boldsymbol{\beta}^{T} = (\beta_0,\beta_1,\beta_2) be our parameters of interest. In specifying the conjugate prior for the Bernoulli distribution, the beta distribution, B(α,β)B(\alpha,\beta) is utilized. If aa and bb has an equal likelihood of being observed that is, a=1a = 1 and b=1b = 1 then the beta distribution is uniform. Therefore we define the following priors for each parameter as

β0∼unif⁡(0,1)β1∼unif⁡(0,5),β2∼unif⁡(0,5)\beta_0 \sim\operatorname{unif}(0,1) \quad\beta_1 \sim\operatorname{unif}(0,5), \quad\beta_2 \sim\operatorname{unif}(0,5)

There are a number of R packages available for the posterior estimation of this Bayesian hierarchical model. In this paper we implement the RJAGS package which uses the Markov chain Monte–Carlo sampling (MCMC) algorithm [27]. The MCMC samples are generated by the coda function package in rjags. N.iter was set as 10,000 with 2 chains to allow for adequate convergence and mixing of the chains to provide a good approximation to the posterior.

The Metropolis Algorithm or MCMC algorithm is applied to the scenario of flipping a coin N times and observing p heads (success or failure of a project). For a simplistic hierarchical model, the bernoulli likelihood function is applied and proceeds as follows:

  1. Arbitrary start at an initial value of β\beta (in the valid range), denoted by βcurrent\beta_{current}.

  1. Generate a proposed candidate δβ∼(μ=0,σ)\delta\beta\sim(\mu= 0,\sigma) and denote the proposed value of the parameter as βproposed=βcurrent+δβ\beta_{proposed} = \beta_{current} + \delta\beta.

  1. Compute the probability of moving to the proposed value, specifically expressed as:

4.

ηi∗=β0∗+β1∗X1i+β2∗X2i,(6)\eta_i^* = \beta_0^* + \beta_1^* X_{1i} + \beta_2^* X_{2i}, \tag*{(6)}
ℓ(β∗)=∑i=1104[yiηi∗−log⁡(1+exp⁡(ηi∗))].(7)\ell(\beta^*) = \sum_{i=1}^{104} \left[y_i\eta_i^* - \log(1+\exp(\eta_i^*))\right]. \tag*{(7)}
ℓ(β(t−1))=∑i=1104[yiηi(t−1)−log⁡(1+exp⁡(ηi(t−1)))].(8)\ell(\beta^{(t-1)}) = \sum_{i=1}^{104} \left[y_i\eta_i^{(t-1)} - \log(1+\exp(\eta_i^{(t-1)}))\right]. \tag*{(8)}
α=min⁡{1,exp⁡[ℓ(β∗)−ℓ(β(t−1))]}.(9)\alpha= \min\left\{1,\exp\left[\ell(\beta^*)-\ell(\beta^{(t-1)})\right]\right\}. \tag*{(9)}

If the proposed value βproposed\beta_{proposed}, happends to land outside of the permissible bounds of θ\theta, the prior and /or likelihood is set to zero.

  1. Accept the proposed parameter value if a random value is sampled from a [0, 1] uniform distribution is less than the probability of moving to a new location and the proposed parameter value and tally the current value again.

Repeat the above steps until a sufficiently representative sample has been generated

Probit Regression Model

Here, for comparison, we specify a probit model with a binary outcome Yi∈{0,1}Y_i \in\{0,1\} as follows:

pi=Pr⁡(Yi=1∣Xi)=Φ(ηi)p_i = \Pr(Y_i = 1 \mid X_i) = \Phi(\eta_i)

where, Φ(⋅)\Phi(\cdot) is the cumulative distribution function of the standard normal distribution.

Φ(ηi)=∫−∞ηi12πexp⁡(−t22) dt\Phi(\eta_i) = \int_{-\infty}^{\eta_i} \frac{1}{\sqrt{2\pi}}\exp\left(-\frac{t^2}{2}\right)\,dt

It maps any real number ηi∈(−∞,∞)\eta_i \in(-\infty,\infty) to a probability pi∈(0,1)p_i \in(0,1), as it represents the cumulative distribution function of the standard normal distribution.

Data Analysis

The data comprises of 104 mini-grid installations and pilot projects in rural areas across the world. The data related to each project can be found in [3] and is manually encoded from a vast collection of primary documentation, including scientific publications, reports and databases from government, public utilities, regulators and rural electrification agencies, grey literature such as NGO, donor and development agency report, case studies, portfolios of private developers and news articles.

VariableDescription
Project Success (Independent)Project success is encoded as 0–1. Mini-grid infrastructure in working conditions.
Project Capital Cost per Capita (PCCC) (Independent)One-time fixed costs incurred for the purchase of equipment, installation, and connection costs.
OwnershipCategorical variable over four mini-grid ownership models: public-owned, private-owned, public-private partnership (PPP), and community-based.
Technology TypeIndicator variable for each of the common mini-grid renewable technologies: solar, hydro, wind, and biomass.
RegionObservations from 39 countries.
Renewable Proportion (Renew)Continuous variable representing the proportion of renewable sources in the total installed capacity.
StorageIndicator variable signifying projects with a battery or flywheel component.
Demand Management System (DM)Indicator variable included in the model.
System Capacity per Capita (SCPC)Total system generation capacity installed per capita in megawatts.

Table 1. Description of Variables Used in the Model

Experimental Details

A probit regression model is fitted to the data to capture the probability of success/failure on a mini-grid project. Additionally, the probit regression model and Bayesian models are used to predict the probit regression coefficients. A comparison of the results is provided in the Table 5 and Figure 1 below:

ObsProbit (A)Bayesian (B)
10.75993210.7751
20.92102540.9158
30.95191280.9512
40.73391350.7183
50.73678910.7491
60.92231070.9235
70.92102540.9158
80.92231070.9235
90.92231070.9235
100.92231070.9235
110.92102540.9158

Table 5. Probit and Bayesian Predicted Probabilities

Probit vs Bayesian Predicted Values

Figure 1. Plot of predictive probabilities between Bayesian and probit model

ObsProbit (A)Bayesian (B)
120.46763120.4677
130.73391350.7183
140.73678910.7491
150.92231070.9235
160.92102540.9158
170.92102540.9158
180.92102540.9158
190.92102540.9158
200.92231070.9235
210.73678910.7491
220.99287700.9875
230.73391350.7183
240.99287700.9875
250.99287700.9875
260.95191280.9512
270.92102540.9158
280.92102540.9158
290.99287700.9875
300.75993210.7751
310.75993210.7751
320.92102540.9158
330.92102540.9158
340.92102540.9158
350.92102540.9158
360.92102540.9158
370.99287700.9875
380.95191280.9512
390.95191280.9512
400.92102540.9158
410.92231070.9235
420.99287700.9875
430.75993210.7751
440.95191280.9512
450.99287700.9875
460.92231070.9235
470.95191280.9512
480.92102540.9158
490.46763120.4677
500.95191280.9512
510.73678910.7491
520.95191280.9512
530.92102540.9158
540.95191280.9512
550.75993210.7751

Table 9.

ObsProbit (A)Bayesian (B)
560.73391350.7183
570.73391350.7183
580.73391350.7183
590.73391350.7183
600.73391350.7183
610.73678910.7491
620.73678910.7491
630.95191280.9512
640.73678910.7491
650.73678910.7491
660.73391350.7183
670.73391350.7183
680.92102540.9158
690.92231070.9235
700.73678910.7491
710.73678910.7491
720.73678910.7491
730.73678910.7491
740.73678910.7491
750.73391350.7183
760.73391350.7183
770.75993210.7751
780.99287700.9875
790.99287700.9875
800.99287700.9875
810.46763120.4677
820.92231070.9235
830.73678910.7491
840.95191280.9512
850.92102540.9158
860.99287700.9875
870.99287700.9875
880.99287700.9875
890.99287700.9875
900.99287700.9875
910.99287700.9875
920.99287700.9875
930.99287700.9875
940.99287700.9875
950.99287700.9875
960.95191280.9512
970.73678910.7491
980.95191280.9512
990.95191280.9512

Table 10.

ObsProbit (A)Bayesian (B)
1000.95191280.9512
1010.73678910.7491
1020.73678910.7491
1030.95191280.9512
1040.95191280.9512

Table 1 (PDF p. 10).

Histogram

Figure 2. Histogram showing the number of successful projects

Results and Discussion

Figure 3 demonstrates a scatter plot of the predicted values of the probit model and Bayesian model. The scatter points indicate how closely both models match for each observation. The fitted regression line shows the overall trend and positive linear relationship.

Scatter plot showing how closely the two models agree for each observation

Figure 3. Scatter plot showing how closely the two models agree for each observation

Table 2 illustrates the regression results for the probit model from the variables listed in Table 1. The model is given below as:

TermEstimateStd. Errorz valuePr(> |z|)
(Intercept)-0.30311.8127-0.1670.8672
Ownershipcommunity1.49840.65422.2900.0220*
Ownershipppp-0.91970.6338-1.4510.1468
Ownershipprivate0.48470.50650.9570.3386
Storage1.09260.45092.4230.0154*
DM-0.41620.5421-0.7680.4426
RegionAmericas-0.52010.5504-0.9450.3447
RegionAsiaPacific-0.57580.4656-1.2370.2162
Renew-0.79220.7554-1.0490.2943
PCCC0.12470.11291.1050.2693

Table 2. Probit regression coefficients full Model. Signif. codes: 0 “***” 0.001 “**” 0.01 “*” 0.05 “.” 0.1 “ ” 1

P(Successi=1∣Xi)=Φ(ηi)P(\mathrm{Success}_i = 1 \mid X_i) = \Phi(\eta_i)
ηi=β0+β1Privatei+β2PPPi+β3Communityi+β4Storagei+β5DMi+β6Americasi+β7AsiaPacifici+β8Renewi+β9PCCCi.\begin{aligned} \eta_i = \beta_0 + \beta_1 \mathrm{Private}_i + \beta_2 \mathrm{PPP}_i + \beta_3 \mathrm{Community}_i + \beta_4 \mathrm{Storage}_i + \beta_5 \mathrm{DM}_i \\ &+ \beta_6 \mathrm{Americas}_i + \beta_7 \mathrm{AsiaPacific}_i + \beta_8 \mathrm{Renew}_i + \beta_9 \mathrm{PCCC}_i. \end{aligned}

As demonstrated in Table 2, Community Ownership and Storage emerge as statistically significant predictors of project success.

Table 3, Table 4 and Figure 1 display the results of the Probit and Bayesian model considering Community Ownership and Storage. If we look into the mechanism, we will observed that the probit model adequately estimates the model parameters. Based on these results, we build the following reduced probit regression model based on project success (Y=1Y=1).

VariableEstimateStd. Errorz valuePr(> |z|)
Intercept0.6246920.3322371.8800.0601 .
Ownership_community1.0389970.5442511.9090.0563 .
Ownership_ppp-0.7059180.530820-1.3300.1836
Ownership_private0.0087850.4116270.0210.9830
Storage0.7873100.3691502.13320.0329

Table 3. Probit Regression Coefficients. Significance codes: *** p<0.001p < 0.001 ** p<0.01p < 0.01 * p<0.05p < 0.05 . p<0.1p < 0.1; not significant

VariableMeanSDNaive SETime Series SE
Intercept2.16794.718380.07460410.8832710
Ownership_community1.30814.709880.07446970.8474668
Ownership_ppp-2.32044.74500.07502540.8360369
Ownership_private-1.00514.739340.07493560.8750269
Storage1.57520.741310.01172120.0124255

Table 4. Emperical Mean and Standard deviation for Bayesian Model. Significance codes: *** p<0.001p < 0.001 ** p<0.01p < 0.01 * p<0.05p < 0.05 . p<0.1p < 0.1; not significant

Pr⁡(Yi=1∣Xi)=Φ(β0+β1Ownershipcommunity,i+β2Ownershipppp,i+β3Ownershipprivate,i+β4Storagei).\Pr(Y_i = 1 \mid X_i) = \Phi\left(\beta_0 + \beta_1 \mathrm{Ownership}_{\mathrm{community},i} + \beta_2 \mathrm{Ownership}_{\mathrm{ppp},i} + \beta_3 \mathrm{Ownership}_{\mathrm{private},i} + \beta_4 \mathrm{Storage}_i\right).

From the probit model results we see that the probability of success increases with both Community Ownership and Storage. Furthermore, from their p values 0.0220 and 0.0154 Community Ownership and Storage emerge as statistically significant predictors of project success. Thus the probit regression model is recommended as a method to determine the probability of success of a project given various factors and covariates.

For the bayesian analysis, we ran the MCMC algorithm for 10,0000 iterations with thin=100 (or every hundredth draw). Convergence was assessed from traceplots ensuring that the chains mixed well. Table 4 shows the posterior mean for all the parameters with a 95% Bayesian credible intervals. The main goal is to estimate the coefficients of the model via simulating posterior samples. The mean posterior densities closely match the estimates determined by the probit regression model. To evaluate the predictions, we make use of the SEs as shown in Table 4. According to Table 4, the SE are extremely small, reflecting high precision under the bayesian framework.

Table 5 and Figure 1 show a comparison between the probit and Bayesian model. Fitting the probit regression model to the dataset using the function glm in R is a frequentist way of analyzing this dataset, while the Bayesian hierarchical linear model is the bayesian approach. We compare the point estimates of both methods via SE’s and predictions. The naive SE is the standard error of the mean captures simulation error of the mean rather than the posterior uncertainty. While the Time Series Standard Error (TSSE) (or Monte Carlo SE) accounts for autocorrelation by using the effective sample size. The Naive SE underestimates uncertainty due to autocorrelation, whereas TSSE provides a better measure of MCMC estimation error

Also based on the model predictions seen in Figure 1, both the probit and the Bayesian models are suited to handling probabilities. In conclusion, the probit model captures the significant relationship between the project success and its covariates, Community Ownership and Storage and its predictive performance is closely related to the Bayesian model. Bayesian methods are useful when the data is scarce and particularly for handling latent variables, in our case the probability of a mini-project being successful.

Mathematical Optimization Methods in Electricity generation

In this section, we provide a multi-resource optimization method for determining the optimal profit and minimizing the cost of electricity generation and transmission while reducing carbon emissions. Mathematically, investment models, in electricity production facilities are naturally formulated as optimization models constrained by other optimization models. A general instance of such a model is given by the following:

max⁡x,y(1),…,y(n),λ(1),…,λ(n)f(x,y(1),…,y(n),λ(1),…,λ(n))(10)\max_{x,y^{(1)},\ldots,y^{(n)},\lambda^{(1)},\ldots,\lambda^{(n)}} f\left(x,y^{(1)},\ldots,y^{(n)},\lambda^{(1)},\ldots,\lambda^{(n)}\right) \tag*{(10)}
s.t.h(x,y(1),…,y(n))=0(11)\mathrm{s.t.}\quad h\left(x,y^{(1)},\ldots,y^{(n)}\right)=0 \tag*{(11)}
g(x,y(1),…,y(n))≤0(12)g\left(x,y^{(1)},\ldots,y^{(n)}\right)\leq0 \tag*{(12)}
{max⁡y(1)f(1)(x,y(1),…,y(n))s.t. h(1)(x,y(1),…,y(n))=0:λ(1)g(1)(x,y(1),…,y(n))≤0⋮(13)\begin{aligned} &\left\{ \begin{aligned} &\max_{y^{(1)}} f^{(1)}\left(x,y^{(1)},\ldots,y^{(n)}\right)\\ &\mathrm{s.t.}\ h^{(1)}\left(x,y^{(1)},\ldots,y^{(n)}\right)=0:\lambda^{(1)}\\ &g^{(1)}\left(x,y^{(1)},\ldots,y^{(n)}\right)\leq0\\ &\vdots \end{aligned} \right. \tag*{(13)} \end{aligned}
{max⁡y(n)f(n)(x,y(1),…,y(n))s.t.h(n)(x,y(1),…,y(n))=0:λ(n)g(n)(x,y(1),…,y(n))≤0(14)\left\{ \begin{aligned} \max_{y^{(n)}}\quad&f^{(n)}\left(x,y^{(1)},\ldots,y^{(n)}\right)\\ \text{s.t.}\quad&h^{(n)}\left(x,y^{(1)},\ldots,y^{(n)}\right)=0:\lambda^{(n)}\\ &g^{(n)}\left(x,y^{(1)},\ldots,y^{(n)}\right)\le0 \end{aligned} \right. \tag*{(14)}

Problem ((1.1a-1.1c)) is the upper level problem while problems ((13)) - ((14)) are the lower level problems. The upper-level problem is the investment problem, which seeks to identify the investment decisions that maximize profit, while the lower-level problems represent market-clearing conditions.

Multi-Resource Investment Problems

Minimizing electricity generation costs while reducing carbon emissions can be formulated as a multi-resource investment problem, where a firm must allocate mm resources to produce nn products across tt time periods. In this setting, the single product is electricity, which can be generated using two resources: diesel purchases and a renewable capacity generator. A two-stage optimization model is applied where in the first stage, a nonnegative vector of capacity levels k=(KA,KB)∈R+2k=(K_A,K_B)\in\mathbb{R}^{2}_{+}, can be chosen representing the diesel purchase and renewable generator capacity respectively, before observing the actual energy demand, D∈R+D\in\mathbb{R}_{+}, and before the renewable energy supply is known. In the second stage, a vector of dispatch quantities x=(xa,xb)x=(x_a,x_b) can be determined. The second stage problem with dual variables can be written as follows:

C2(KA,KB,δ,γ)=min⁡(xa,xb)∈R+2, p≥0eaxa+cppC_2(K_A,K_B,\delta,\gamma)=\min_{(x_a,x_b)\in\mathbb{R}^{2}_{+},\,p\ge0} e_a x_a+c_p p

subject to

−xb≥−γKB←λb-x_b\ge-\gamma K_B\quad\leftarrow\lambda_b
−xa≥−KA←λa-x_a\ge-K_A\quad\leftarrow\lambda_a
p+xa+xb≥δp+x_a+x_b\ge\delta

The first-stage problem is defined as:

min⁡(KA,KB)∈R+2C1(KA,KB)=cAkKA+cBkKB+ED,Γ[C2(KA,KB,D,Γ)].\min_{(K_A,K_B)\in\mathbb{R}^{2}_{+}} C_1(K_A,K_B)=c_A^kK_A+c_B^kK_B+\mathbb{E}_{D,\Gamma}[C_2(K_A,K_B,D,\Gamma)].

Solving this problem involves partitioning the uncertainty space into six regions in each of which the optimal second-stage dispatch decisions and the dual variables have the same structure.

First, we choose a non-negative vector of capacity levels

k=(KA,KB)∈R+2\mathbf{k}=(K_A,K_B)\in\mathbb{R}^{2}_{+}

representing diesel purchase and renewable generator capacity. The demand is a continuous nonnegative random variable written as

D∈R+,D \in\mathbb{R}_{+},

and the renewable supply is realized as

kb=ΓKB,Γ∼U[0,1].k_b = \Gamma K_B,\quad\Gamma\sim U[0,1].

For the second stage problem,

C2(KA,KB,δ,γ)=min⁡(xa,xb)∈R+2, p≥0eaxa+cppC_2(K_A,K_B,\delta,\gamma)=\min_{(x_a,x_b)\in\mathbb{R}_{+}^{2},\ p\geq0} e_a x_a+c_p p

subject to

−xb≥−γKB←λb(15)-x_b \geq-\gamma K_B \quad\leftarrow\lambda_b \tag*{(15)}
−xa≥−KA←λa(16)-x_a \geq-K_A \quad\leftarrow\lambda_a \tag*{(16)}
p+xa+xb≥δ.(17)p+x_a+x_b \geq\delta. \tag*{(17)}

and the dispatch-vector is given by:

x=(xa,xb)∈[0,KA]×[0,kb],x=(x_a,x_b)\in[0,K_A]\times[0,k_b],

The first-stage problem is given by

C1(KA,KB)=cAkKA+cBkKB+ED,Γ[C2(KA,KB,D,Γ)].C_1(K_A,K_B)=c_A^kK_A+c_B^kK_B+\mathbb{E}_{D,\Gamma}[C_2(K_A,K_B,D,\Gamma)].

The Demand Space is partitioned as follows: For (δ,γ)∈R+×[0,1](\delta,\gamma)\in\mathbb{R}_{+}\times[0,1], the regions are given by:

Ω1(k∗)={(δ,γ)∣δ≤γKB},λb∗=0,λa∗=0\Omega_1(k^*)=\{(\delta,\gamma)\mid\delta\leq\gamma K_B\},\quad\lambda_b^*=0,\quad\lambda_a^*=0
Ω2(k∗)={(δ,γ)∣γKB<δ≤γKB+KA},λb∗=γea,λa∗=0\Omega_2(k^*)=\{(\delta,\gamma)\mid\gamma K_B<\delta\leq\gamma K_B+K_A\},\quad\lambda_b^*=\gamma e_a,\quad\lambda_a^*=0
Ω3(k∗)={(δ,γ)∣γKB+KA<δ},λb∗=γcp,λa∗=cp−ea\Omega_3(k^*)=\{(\delta,\gamma)\mid\gamma K_B+K_A<\delta\},\quad\lambda_b^*=\gamma c_p,\quad\lambda_a^*=c_p-e_a

We consider the dual to the second stage optimization problem

max⁡ −γKBλb−KAλasubject to: −λb≤ea−λa=0(18)\begin{aligned} \max\ &-\gamma K_B\lambda_b-K_A\lambda_a\\ \text{subject to: }&-\lambda_b\leq e_a\\ &-\lambda_a=0 \tag*{(18)} \end{aligned}

In calculating the expectation by conditioning on the demand, of renewable supply Kb(KB)=Γ(KB)K_b(K_B)=\Gamma(K_B), we get,

E[Γ]=E[E[Γ∣D]]=∫−∞∞E[Γ∣D=d]P(D=d)=∫−∞∞E[Γ∣D=d]fD(d) ddE[\Gamma] = E[E[\Gamma|D]] = \int_{-\infty}^{\infty} E[\Gamma|D=d]P(D=d) = \int_{-\infty}^{\infty} E[\Gamma|D=d]f_D(d)\,dd

Using this result, Table 6 and the steps in the Harrison and Van Mieghem [19] journal, the equation below is obtained by taking the partial derivative of the Lagrangian function w.r.t to the two capacity decision variables KAK_A and KBK_B with vector KiΓ=0K_i\Gamma= 0 for i∈A,Bi \in A,B (also complementary slackness condition) of the first stage problem.

Partition for (γ,δ)∈R×[0,1](\gamma,\delta) \in\mathbb{R} \times[0,1]λb∗(KA,KB,δ,γ)\lambda_b^*(K_A,K_B,\delta,\gamma)λa∗(KA,KB,δ,γ)\lambda_a^*(K_A,K_B,\delta,\gamma)
Ω1(K∗)={(δ,γ)∣δ<γKB}\Omega_1(K^*) = \{(\delta,\gamma)\mid\delta< \gamma K_B\}0000
Ω2(K∗)={(δ,γ)∣γKB≤δ≤γKB+KA}\Omega_2(K^*) = \{(\delta,\gamma)\mid\gamma K_B \le\delta\le\gamma K_B + K_A\}γea\gamma e_a00
Ω3(K∗)={(δ,γ)∣γKB+KA<δ}\Omega_3(K^*) = \{(\delta,\gamma)\mid\gamma K_B + K_A < \delta\}γcp\gamma c_p(cp−ea)(c_p-e_a)

Table 6. Partitioning of the demand space

The KKT conditions also ensure an optimal solution k∗=(KA,KB)k^*=(K_A,K_B). Thus we have,

(00)P(Ω1(K∗))+EΓ[(γea0)|Ω2(K∗)]P(Ω2(k))+EΓ[(γcpcp−ea)|Ω3(K∗)]P(Ω3(K∗))=(cBK−ΛBcAk−ΛA)(19)\begin{pmatrix} 0 \\ 0 \end{pmatrix} P(\Omega_1(K^*)) + E_{\Gamma}\left[\begin{pmatrix} \gamma e_a \\ 0 \end{pmatrix}\middle|\Omega_2(K^*)\right]P(\Omega_2(k)) + E_{\Gamma}\left[\begin{pmatrix} \gamma c_p \\ c_p-e_a \end{pmatrix}\middle|\Omega_3(K^*)\right]P(\Omega_3(K^*)) = \begin{pmatrix} c_B^K-\Lambda_B \\ c_A^k-\Lambda_A \tag*{(19)} \end{pmatrix}

The demand space is partitioned into three regions as shown in Table 6. For Region 1, Ω1:δ<γKB\Omega_1:\delta< \gamma K_B, the renewables alone meet the demand, for Region 2, Ω2:γKB≤δ≤γKB+KA\Omega_2:\gamma K_B \le\delta\le\gamma K_B + K_A, implies that the renewables are insufficient and diesel is also used to meet the demand and Region 3 γKB+KA<δ\gamma K_B + K_A < \delta indicates the share where even diesel plus renewables together are not enough, to meet the demand. The share or probability of each region is determined by integration. For example, the probability of Ω1\Omega_1 can be found by considering the following:

Ω1={(δ,γ)∣δ≤γKB},D∼U[0,Δ],Γ∼U[0,1],independent.\Omega_1 = \{(\delta,\gamma)\mid\delta\le\gamma K_B\},\quad D\sim U[0,\Delta],\quad\Gamma\sim U[0,1],\quad\text{independent}.

Thus,

P(Ω1)=P(D≤ΓKB)=∫01P(D≤γKB) dγ=∫01min⁡(1,γKBΔ) dγ.P(\Omega_1)=P(D\le\Gamma K_B)=\int_0^1 P(D\le\gamma K_B)\,d\gamma=\int_0^1 \min\left(1,\frac{\gamma K_B}{\Delta}\right)\,d\gamma.

Case KB≤ΔK_B \le\Delta:

P(Ω1)=∫01γKBΔ dγ=KBΔ12=KB2Δ.P(\Omega_1)=\int_0^1\frac{\gamma K_B}{\Delta}\,d\gamma=\frac{K_B}{\Delta}\frac{1}{2}=\frac{K_B}{2\Delta}.

Case KB>ΔK_B > \Delta:

P(Ω1)=∫0Δ/KBγKBΔ dγ+∫Δ/KB11 dγ,=12ΔKB+(1−ΔKB)=1−Δ2KB.P(\Omega_1) = \int_{0}^{\Delta/K_B} \frac{\gamma K_B}{\Delta}\,\mathrm{d}\gamma+ \int_{\Delta/K_B}^{1} 1\,\mathrm{d}\gamma, \\ = \frac{1}{2}\frac{\Delta}{K_B} + \left(1-\frac{\Delta}{K_B}\right) = 1-\frac{\Delta}{2K_B}.

If, Δ=800\Delta= 800, and KB≤ΔK_B \leq\Delta we have

P(Ω1)=1800∫01∫0γKB1 dδ dγ=1800∫01γKB dγ=KB1600.P(\Omega_1) = \frac{1}{800}\int_{0}^{1}\int_{0}^{\gamma K_B} 1\,\mathrm{d}\delta\,\mathrm{d}\gamma= \frac{1}{800}\int_{0}^{1}\gamma K_B\,\mathrm{d}\gamma= \frac{K_B}{1600}.

where the capacities are found by solving Equation (19) (using software for example, Wolfram Mathematica).

Two stage multi-resource investment models are invaluable as they help mirror, energy systems. In the first stage capacity decisions are known, these are investment decisions and made before the demand or renewable availability is known. In the second second stage dispatch decisions, are made after uncertainty is realized. The two-stage structure also reveal how capacity choices KAK_A and KBK_B influence the probability of operating in different regions: fully renewable supply, diesel-supported supply, or shortage. This leads to solutions that are more robust, economically efficient, and align with how real systems behave when facing variability and risk.

Battery Energy Storage System and its effect in Electricity Generation

Another method for maximizing the profit and minimizing the cost from electricity generation while reducing carbon emissions is through battery energy storage systems. Moreover, an optimal sized battery energy storage system can help maximize the benefits of the power both generated from PV systems and diesel sources while being financially economical. In this section, we propose a mixed-integer programming approach which decides hour-by-hour to charge/discharge in order to maximize profit, consistent with Alberta’s market participation rules. The optimization problem is developed in a similar manner to that described in [17]

Data

The data is in the form of a csv file indicating Day, Hour Ending, Price Quantity and Dispatched. The market in Alberta has a price cap of CAD $1000, and a price floor of $0. Producers are obliged to offer all of their available capacity into the market, but are under no obligation to ensure that prices correspond to variable cost. An example bid stack, from March 1 2010 is shown in Figure 4.

Supply curve for hour ending 1 on 01-Mar-2010

Figure 4. Bidstack on March 1st 2010

As demonstrated in Figure 4 the shape of this curve varies from hour to hour and the steps represent the price offered by generators for a quantity of power in a particular hour. The flat lines reflect cheaper prices however between 600,000-700,000MW and a vertical line indicating a drastic increase in the price.

Figure 5 and Figure 6 show how the electricity prices vary throughout the day on January 1st, hour ending 1 and for all 24 hours throughout the day on September 1 2010 respectively. Not surprisingly, price increases with quantity as higher demand requires more expensive sources of electricity. There’s a notable steep price jump between roughly 600,000 MW and 800,000 MW, suggesting that during these hours, the grid needed to tap into much costlier electricity sources to meet demand. Beyond 800,000 MW, prices often exceeded $500/MWh and even approaching $1000/MWh, indicating extreme scarcity or reliance on expensive peaking power plants. As shown in Figure 6 each blue curve represents one hour of the day and the shape and spread of the curves imply variability in supply conditions across the day, also indicating that the market participants submit their offers strategically depending on the market conditions.

Supply curve for hour ending 1 on 01-Jan-2010

Figure 5. January 1 hour ending 1

Supply curves for all 24 hours on 01-Sep-2010

Figure 6. September 1, 24 hour

Figure Figure 7 shows the GPQC and DPQC for hour ending 20 on January 1st 2010. For the GPQC each horizontal segment represents a block of generation capacity offered at a fixed price. This is a supply curve and as more MW are dispatched, the price increases in steps, this reflects marginal cost bidding by generators. The DPQC is a demand curve and shows how much consumers bid for electricity in blocks, with higher willingness to pay for initial MW and lower for additional consumption.

Generation PQC and Demand PQC on the same graph

Figure 7. Hour ending 20- Charging and Discharging Blocks

Battery Energy Storage Systems

Using GPQCs and DPQCs as input data we develop we develop a self-scheduling formulation in which the price is a variable and is a function of the charging or discharging quantities. Next, using this framework we determine bidding strategies and assess the economic feasility of the energy storage systems providing opportunities for energy arbitrage in the Alberta electricity market.

Optimization Model

List Of symbols

dd Day index, d=1,…,Dd = 1, \ldots, D

hh Hour index, h=1,…,Hh = 1, \ldots, H

ss Charge/discharge block index

DD Set of days

HH Set of hours

SS Set of piecewise-linear blocks

Decision Variables:

xd,h,sd∈{0,1}x^{d}_{d,h,s} \in\{0,1\} binary, select discharge block ss at (d,h)(d,h)

bd,h,sd≥0b^{d}_{d,h,s} \ge0 continuous, discharge quantity within block ss at (d,h)(d,h)

xd,h,sc∈{0,1}x^{c}_{d,h,s} \in\{0,1\} binary, select charge block ss at (d,h)(d,h)

bd,h,sc≥0b^{c}_{d,h,s} \ge0 continuous, charge quantity within block ss at (d,h)(d,h)

SoCd,h∈[0,400]\mathrm{SoC}_{d,h} \in[0,400] state of charge at (d,h)(d,h)

Parameters:

pd,h,sp_{d,h,s} price of discharge block ss at (d,h)(d,h)

pcd,h,spc_{d,h,s} price of charge block ss at (d,h)(d,h)

qd,h,sq_{d,h,s} quantity of discharge block ss at (d,h)(d,h)

qcd,h,sqc_{d,h,s} quantity of charge block ss at (d,h)(d,h)

OCOC operating cost per hour

η\eta charge efficiency (e.g., 0.7)

SoC0\mathrm{SoC}_{0} initial state of charge (e.g., 100 MWh)

The Objective Function and Constraints

Maximize net profit:

max⁡∑d∈D∑h∈H[∑s∈Sd(d,h)pd,h,s(bd,h,sd+xd,h,sd⋅qd,h,smin⁡)(20)\max\sum_{d \in D}\sum_{h \in H}[\sum_{s \in S_d(d,h)}p_{d,h,s}(b^{d}_{d,h,s}+x^{d}_{d,h,s}\cdot q^{\min}_{d,h,s}) \tag*{(20)}
−∑s∈Sc(d,h)pcd,h,s(bd,h,sc+xd,h,sc⋅qcd,h,smin⁡)−OC](21)-\sum_{s \in S_c(d,h)}pc_{d,h,s}(b^{c}_{d,h,s}+x^{c}_{d,h,s}\cdot qc^{\min}_{d,h,s})-OC] \tag*{(21)}

Constraints

bd,h,sd=fd,h,sd⋅qd,h,smax⁡,∀d,h,s∈Sd(d,h)(22)b^{d}_{d,h,s}=f^{d}_{d,h,s}\cdot q^{\max}_{d,h,s},\quad\forall d,h,s\in S_d(d,h) \tag*{(22)}
bd,h,sc=fd,h,sc⋅qcd,h,smax⁡,∀d,h,s∈Sc(d,h)(23)b^{c}_{d,h,s}=f^{c}_{d,h,s}\cdot qc^{\max}_{d,h,s},\quad\forall d,h,s\in S_c(d,h) \tag*{(23)}
bd,h,sd≤xd,h,sd⋅qd,h,smax⁡,∀d,h,s∈Sd(d,h)(24)b^{d}_{d,h,s}\le x^{d}_{d,h,s}\cdot q^{\max}_{d,h,s},\quad\forall d,h,s\in S_d(d,h) \tag*{(24)}
bd,h,sc≤xd,h,sc⋅qcd,h,smax⁡,∀d,h,s∈Sc(d,h)(25)b^{c}_{d,h,s}\le x^{c}_{d,h,s}\cdot qc^{\max}_{d,h,s},\quad\forall d,h,s\in S_c(d,h) \tag*{(25)}
∑s∈Sd(d,h)xd,h,sd+∑s∈Sc(d,h)xd,h,sc≤1,∀d,h(26)\sum_{s \in S_d(d,h)} x^d_{d,h,s} + \sum_{s \in S_c(d,h)} x^c_{d,h,s} \le1,\quad\forall d,h \tag*{(26)}
SoCd,h=SoCd,h−1+η∑s∈Sc(d,h)(bd,h,sc+xd,h,sc⋅qd,h,smin⁡)(27)\mathrm{SoC}_{d,h} = \mathrm{SoC}_{d,h-1} + \eta\sum_{s \in S_c(d,h)} \left(b^c_{d,h,s} + x^c_{d,h,s} \cdot q^{\min}_{d,h,s}\right) \tag*{(27)}
−∑s∈Sd(d,h)(bd,h,sd+xd,h,sd⋅qd,h,smin⁡),∀d,h(28)-\sum_{s \in S_d(d,h)} \left(b^d_{d,h,s} + x^d_{d,h,s} \cdot q^{\min}_{d,h,s}\right),\quad\forall d,h \tag*{(28)}

with initial condition:

SoCd=1,h=1=SoC0\mathrm{SoC}_{d=1,h=1} = \mathrm{SoC}_0

and bounds:

0≤SoCd,h≤400,∀d,h0 \le\mathrm{SoC}_{d,h} \le400,\quad\forall d,h

According to Table 7, the battery supplies energy during its discharging hours, for example during hours ending 1, 2 and 6. During these hours, the prices decrease, benefitting customers. However during the battery’s charging hours the battery the prices increase. Table 8 shows the block details for the optimization problem with the profit or Gurobi objective value was found to be $8351.22

HourSoC (MWh)ModeElectricity (MWh)Price ($/MWh)
0136.00Discharge64.0057.25
020.00Discharge36.0057.24
030.00Idle0.000.00
040.00Idle0.000.00
05100.00Charge142.8628.73
060.00Discharge100.0045.00
070.00Idle0.000.00
08154.70Charge221.0016.40
0985.70Discharge69.0029.56
10286.60Charge287.0014.60
11400.00Charge162.0015.15
12400.00Idle0.000.00
13304.00Discharge96.0043.97
14304.00Idle0.000.00
15400.00Charge137.1429.56
16400.00Idle0.000.00
17400.00Idle0.000.00
18312.00Discharge88.0066.86
19216.00Discharge96.0055.06
20146.00Discharge70.0057.19
2131.00Discharge115.0049.00
2231.00Idle0.000.00
2331.00Idle0.000.00
240.00Discharge31.0047.91

Table 7. Battery Operation Schedule for 2010-01-01

HourModeBlockElectricity (MWh)Price ($/MWh)
01Discharge264.0057.25
02Discharge236.0057.24
05Charge1142.8628.73
06Discharge2100.0045.00
08Charge2221.0016.40
09Discharge269.0029.56
10Charge2287.0014.60
11Charge1162.0015.15
13Discharge296.0043.97
15Charge1137.1429.56
18Discharge288.0066.86
19Discharge296.0055.06
20Discharge270.0057.19
21Discharge2115.0049.00
24Discharge231.0047.91

Table 8. Charge and Discharge Block Details for 1 January 2010

Dynamic Programmming towards the Battery Storage Problem

The novelty in this research is two-fold. First we provide a comparison of statistical and optimization methods for maximizing profit while minimizing cost and reducing carbon emission in electricity generation. Next we propose a novel approach based on stochastic dynamic programming towards the battery storage problem for electricity generation. To our knowledge, such a comparison has never been done before in this context.

Stochastic dynamic programming has become a powerful tool when applied to a variety of problems (see [28, 29, 30, 31, 32, 33] and the one-armed bandit processes was formulated as a stochastic process using a Bayesian approach and solved using dynamic programming by Wang and Bickis in [34]. A dynamic programming formulation towards battery energy storage operators have been studied in various research [35]. However these research is still different to the approach proposed in this paper. In [35] the authors propose a stochastic dynamic programming model that accounts for the amount of energy stored in a battery at the beginning and the end of an hour. The objective function maximizes the revenue function based on the resource/energy level, prices/bids and number of charge/discharge cycles and using approximate dynamic programming to solve the problem. programming towards the battery energy

In this research, we adopt a SDP formulation towards the Battery Storage problem in order to optimize profit in an energy market. Our implementaiton is as follows:

Let Jt∗J_t^* denote the maximum expected return for a tt-stage problem and assign vectors x⃗t\vec{x}_t as the state vector of the system on state space X\mathcal{X} and vector a⃗t\vec{a}_t as the control decision vector on action space A\mathcal{A}. Where s=1,…ncs=1,\ldots n^{c}- the number of charging blocks and s′=1,…nds'=1,\ldots n^{d} the number of discharging blocks.

If we let TT denote the number of stages and tt denote the number of stages to go, the problem involves maximizing the following expected cost over a finite number of stages TT.

JK:=E{cT(xT)+∑t=1T−1ct(x⃗t,a⃗t)}(29)J_K := E\left\{c_T(x_T)+\sum_{t=1}^{T-1}c_t(\vec{x}_t,\vec{a}_t)\right\} \tag*{(29)}

We observe that the optimal allocation to the problem max⁡Jt\max J_t given by,

max⁡u⃗1,…,u⃗tE{cT(xT)+∑t=1T−1ct(x⃗t,a⃗t)}(30)\max_{\vec{u}_1,\ldots,\vec{u}_t} E\left\{c_T(x_T)+\sum_{t=1}^{T-1}c_t(\vec{x}_t,\vec{a}_t)\right\} \tag*{(30)}

To find the optimal allocation for the optimization problem (30), we start by defining value functions, VTV_T. The value functions {Vt}\{V_t\} are a sequence of functions Vt:X→RV_t:\mathcal{X}\to R, defined by the following:

  1. At the last stage TT, VT(x)=cT(x)V_T(x)=c_T(x), ∀x\forall x.

  2. At time k=T−1,…,0k=T-1,\ldots,0, Qt:X×U→RQ_t:\mathcal{X}\times\mathcal{U}\to R, the QQ function is defined by

Qt(x,u)=ct(x,u)+E(Vt+1(Xt+1))Q_t(x,u)=c_t(x,u)+E(V_{t+1}(X_{t+1}))

where Qt(x,u)Q_t(x,u) is the expected cost or reward in regard to states xx and action uu.

  1. At time tt, the value function is

Vt(x)=max⁡u∈UQt(x,u)V_t(x) = \max_{u \in U} Q_t(x,u)

Therefore the optimal policy is given by

gt∗=arg⁡max⁡u∈UQt(x,u)(31)g_t^* = \arg\max_{u \in\mathcal{U}} Q_t(x,u) \tag*{(31)}

The optimality of Equation (31) is illustrated if we define the cost-to-go function by

Jt(x,g):=E{cT(xT)+∑s=tT−1cs(x⃗s,u⃗s)}J_t(x,g) := E\left\{c_T(x_T) + \sum_{s=t}^{T-1} c_s(\vec{x}_s,\vec{u}_s)\right\}

then Jt(x;g)≤Vk(x)J_t(x;g) \leq V_k(x) where the equality holds if

gv=arg⁡max⁡u∈AQv(x,a)g_v = \arg\max_{u \in\mathcal{A}} Q_v(x,a)

∀s≥k\forall s \geq k.

The system dynamics depends on the state-action pair (xt,ut)(x_t,u_t) at current stage tt and probabilities ptp_t:

xt−1=ft(xt,ut,pt), for t=0,1,…,T−1(32)x_{t-1} = f_t(x_t,u_t,p_t), \text{ for } t = 0,1,\ldots,T-1 \tag*{(32)}

where P(xt−1∣xt,ut,pt)P(x_{t-1}|x_t,u_t,p_t). The Bellman recursion is then

Qt(x,u)=ct(x,u)+E(Vt+1(Xt+1))Q_t(x,u) = c_t(x,u) + E(V_{t+1}(X_{t+1}))

An Implementation of Stochastic Dynamic Programming to Battery Storage problems

In this section, we propose a stochastic dynamic programming approach to model a battery energy storage system and maximize profit in electricity generation. Energy markets, particularly electricity markets inherently have probabilistic prices due to volatile renewable energy, demand shift and grid congesting, requiring sophisticated probabilitic forecasting, hedging and optimal trading strategies. Methods for predicting the uncertainty in prices vary and include Polynomial mapping and Deep Learninng methods. This research proposes a novel SDP approach to account for the uncertainty in prices associated with the while maximizing profit and revenue in electricity generation.

Stochastic Dynamic Programming Model

For finite horizon stochastic problems, the optimality equations at time tt are given by:

V(xt)=max⁡ut∈UE(CT(xT,ut)+∑t=1T−1Vt+1(xt,ut,wt))V(x_t)=\max_{u_t\in U}\mathbb{E}\left(C_T(x_T,u_t)+\sum_{t=1}^{T-1}V_{t+1}(x_t,u_t,w_t)\right)

which is equivalent to solving the following, known as Bellman’s optimality equations:

V(xt)=max⁡ut∈U(Ct(xt,ut)+E[Vt+1(xt,ut,wt)])(33)V(x_t)=\max_{u_t\in U}\left(C_t(x_t,u_t)+\mathbb{E}\left[V_{t+1}(x_t,u_t,w_t)\right]\right) \tag*{(33)}

where xtx_t is the state variable, in this case the state of charge and the price at time tt, and summarizes past information useful for solving future states, utu_t is the control or decision variable, that is whether to charge or discharge , and wtw_t is a random parameter capturing the uncertainty of the prices

Given the value function Vt(e)V_t(e) as the optimal expected value, then the optimization problem with tt stages remaining can be written as:

Vt(e)=max⁡u∈Ut(e){E[Πt(u)]+Vt−1(e′)},t=1,…,T,V_t(e)=\max_{u\in U_t(e)}\left\{\mathbb{E}\left[\Pi_t(u)\right]+V_{t-1}(e')\right\},\qquad t=1,\ldots,T,

where,

e′=e+ηc(b)ch−bdise'=e+\eta_c(b)^{ch}-b^{dis}

and

Πt(ut)=pt,s×btdis−pct,s×btch\Pi_t(u_t)=p_{t,s}\times b_t^{dis}-pc_{t,s}\times b_t^{ch}

with the last stage as:

V0(e)=cT(e)i.e., cT(e)=0V_0(e)=c_T(e)\quad\text{i.e., }c_T(e)=0

Example without incoporating the stochastic nature of prices

Consider a toy example involving t=2t=2 hours as the time given and s=2s=2 blocks. The discharging and charging price per hour at time tt and step ss is given by pt,sdisp_{t,s}^{dis}, and pt,schp_{t,s}^{ch} respectively. The corresponding values are p1,1dis=$20p_{1,1}^{dis}=\$20, pc1,2=$10pc_{1,2}=\$10, p2,1=$25p_{2,1}=\$25, pc2,2=$5pc_{2,2}=\$5 with initial conditions, V0(E)=0V_0(E)=0, E(0)=5E(0)=5. The reward function rtr_t is calculated as rt=pt,s×btdis−pt,sch×btchr_t=p_{t,s}\times b_t^{dis}-p_{t,s}^{ch}\times b_t^{ch}.

For time t=1t=1, suppose the battery is in state E0=5E_0=5 and u1=Idleu_1=\text{Idle} that is, neither charging nor discharging. Using b1,1ch=0b_{1,1}^{ch}=0 and b1,1dis=0b_{1,1}^{dis}=0. Therefore,

V1(5)=r1+V0(5)=0V_1(5)=r_1+V_0(5)=0

For time t=1t=1, and ut=Discharging 1 MWh b1,1dis=1u_t=\text{Discharging 1 MWh }b_{1,1}^{dis}=1, b1,1ch=0b_{1,1}^{ch}=0, E1=5−1=4E_1=5-1=4, r1=20∗1=20r_1=20*1=20

Therefore,

V1(4)=r1+V0(5)=20V_1(4)=r_1+V_0(5)=20

For time t=1t=1, and u1=chargingu_1=\text{charging}, E0dis=5E_0^{dis}=5, b1,1ch=0,b1,1=1b_{1,1}^{ch}=0,b_{1,1}=1, E1=5+0.8∗1=5.8E_1=5+0.8*1=5.8, r1=−10∗1=−10r_1=-10*1=-10, E1=5+0.8∗1=5.8E_1=5+0.8*1=5.8

V1(5.8)=r1+V0(5.8)=−10V_{1}(5.8) = r_{1} + V_{0}(5.8) = -10

The maximum value is found by evaluating all possible feasible actions. That is, all possible discharge and charge amounts over all possible values and outcomes. The dynamic programming model can also incorporate the stochastic nature of prices as done in several papers (see for example [36] and [35]).

Discussion

The results of § 3 indicate the probit and Bayesian model suited for determining the probability of a mini-grid project being successful and handling probabilities. The probit model captures the significant relationship between project success and its covariates, Community Ownership and Storage and its predictive performance is closely related to the Bayesian model. Bayesian methods are useful when the data is scarce and particularly for handling latent variables, such as the probability of a mini-project being successful in this case.

Sections 4 focuses on the mathematical optimization model for minimizing cost in generating electricity while reducing carbon emissions. In particular, a two-stage multi-resource investment model is described in § 4 where capacities are chosen before the uncertainty is revealed. In the first stage, investment decisions are made for different types of capacities—typically a reliable but costly resource, for example diesel and a cheaper renewable resource, whose availability is uncertain. In the second stage, after the demand and availability are realized, resources are allocated to meet the demand, and a penalty is paid for any unmet demand. The model naturally divides the demand space into different regions. The expected cost combines the probability of each region when the renewables alone meet the demand, when the renewables alone are insufficient and diesel is used and when diesel and renewables are still insufficient to meet the demand. This captures the trade-off between upfront capacity investments for diesel and renewable purchases (KAK_{A} and KBK_{B}) and the chance that, later on, demand is high or availability is low, forcing expensive penalty costs.

Sections 5 and 6 introduce battery energy storage systems as another method for maximizing profit and minimizing the cost in electricity generation while reducing carbon emissions. In § 5, we propose a mixed-integer programming approach which decides hour-by-hour to charge or discharge in order to maximize profit, consistent with Alberta’s market participation rules. The battery successfully executes a daily arbitrage strategy, that is, charging when prices are relatively low and discharging when prices are high. The battery’s value is not just in daily smoothing, but in capturing rare price spikes and dampens this spike by discharging during peak price hours. Thus, consumers pay less, and the system benefits from price stability.

§ 7 implements a dynamic programming framework for optimizing battery storage operations in which the uncertainty in electricity prices can be incorporated. The state variable xtx_{t} (or state of charge ete_{t}) summarizes all relevant past information, the control variable utu_{t} represents charging or discharging decisions, and wtw_{t} captures price uncertainty. The volatility of electricity prices for the SDP model can be evaluated using different methods. In this paper, we illustrate the effect of a dynamic programming model applied to a battery energy storage system and leave the stochastic component of prices to be incorporated in future research

Conclusion

This paper introduces a statistical and optimization modeling framework to examine decision-making strategies in modern energy systems. First, a Bayesian hierarchical model is compared with a probit model on 104 mini-grids installed across the globe to highlight the strengths of statistical modeling and provide insights into the success of mini-grid projects in electricity generation. Second, a deterministic mixed-integer optimization model is developed which maximizes profit while reducing carbon emissions. Results indicate that battery systems can execute effective arbitrage strategies that is, charging when prices are relatively low, discharging when prices are high.

Furthermore, we propose a dynamic programming modeling framework to the battery energy storage system. Preliminary results indicate that dynamic programming method offers a promising alternative to mixed-integer programming, particularly in volatile electricity markets. In a follow-up paper we will explore methods for capturing the volatility and provide extensive experimental results.

The results highlighted in this paper emphasize the importance of integrating statistical and optimization methods towards energy systems. By accounting for uncertainty, these frameworks support more resilient decision-making efforts. Future research may entail incorporating further statistical, probabilistic and optimization based methods towards extensive research in developing effective, clean, reliable energy systems.

Acknowledgments

I gratefully acknowledge that this research was supported in part by the Pacific Institute for the Mathematical Sciences. Many thanks also to my postdoctoral Supervisors at the University of Calgary for the data and their guidance during this time.

References

  1. [1]Ember: Global electric review (2026)
  2. [2]Environment and Climate Change Canada: National inventory report 1990–2023: Greenhouse gas sources and sinks in canada. Technical report, Environment and Climate Change Canada, Ottawa, ON (2025). https://www.canada.ca/en/environment-climate-change/services/climate-change/greenhouse-gas-emissions/sources-sinks-executive-summary-2025.html
  3. [3]Duran, A.S., Sahinyazan, F.G.: An analysis of renewable mini-grid projects for rural electrification. Socio-Economic Planning Sciences 77, 100999 (2021) https://doi.org/10.1016/j.seps.2020.100999
  4. [4]Su, L., Gang, W., Liu, M., Ling, Z., Zhang, Y., Dong, S.: A capacity optimization method for the battery energy storage system based on historical electricity data of existing buildings. Energy Reports 13, 6132–6147 (2025) https://doi.org/10.1016/j.egyr.2025.05.060
  5. [5]Zhang, D., Ma, Y., Liu, J., Jiang, S., Chen, Y., Wang, L., Zhang, Y., Li, M.: Stochastic optimization method for energy storage system configuration considering self-regulation of the state of charge. Sustainability 14(1), 553 (2022) https://doi.org/10.1103/PhysRevD.99.12350
  6. [6]Bhattacharya, A., Kharoufeh, J.P., Zeng, B.: Managing energy storage in microgrids: A multistage stochastic programming approach. IEEE transactions on smart grid 9(1), 483–496 (2018)
  7. [7]Walawalkar, R., Apt, J., Mancini, R.: Economics of electric energy storage for energy arbitrage and regulation in new york. 35(4), 2558–68
  8. [8]AESO: Historical Market Data: Pool Price. Available online (2014)
  9. [9]Carlson, C.: Wind and energy storage: potential market opportunities in alberta. Alberta Innovates Technology Futures (2012)
  10. [10]Siohansi, R., Denholm, P., Jenkin, T., Weiss, J.: Estimating the value of electricity storage in pjm: arbitrage and some welfare effects. Energy Econ 31(2) (2009)
  11. [11]Smith, M., Kohn, R., Mathur, S.K.: Bayesian semiparametric regression. Journal of business research 49(3), 229–244 (2000)DOI
  12. [12]Hyde, O., Hodnett, P.F.: An adaptable automated procedure for short-term electricity load forecasting. IEEE transactions on power systems 12(1), 84–94 (1997)DOI
  13. [13]Barlow, M.T.: A diffusion model for electricity prices. Mathematical finance 12(4), 287–298 (2002)
  14. [14]Ware, A.: Polynomial processes for power prices 26, 453–474 https://doi.org/10.1080/1350486X.2020.1715808
  15. [15]Jarrow, R., Protter, P., Sezer, D.: Credit risk models. Finance Stoch 11, 195–212 (2007)
  16. [16]Han, J.-H., Ahn, Y.-C., Lee, I.-B.: A multi-objective optimization model for sustainable electricity generation and co2 mitigation (ecgm) infrastructure design considering economic profit and financial risk. Applied energy 95, 186–195 (2012)DOI
  17. [17]Shafee, S., Dehkordi, P., Zareipour, H., Knight, A.: An economic assessment of a pricemaker energy storage facility in the alberta electricity market. Energy (Oxford) 111, 537–547 (2016)
  18. [18]He, J., Wu, Y., Yong, X., Tan, Q., Liu, F.: Bi-level optimization of a near-zero-emission integrated energy system considering electricity-hydrogen-gas nexus: A two-stage framework aiming at economic and environmental benefits. Energy conversion and management 274, 116–434 (2022)DOI
  19. [19]Harrison, J.M., Van Mieghem, J.A.: Multi-resource investment strategies: Operational hedging under demand uncertainty. European journal of operational research 113(1), 17–29 (1999)DOI
  20. [20]Hobbs, B.F., Metzler, C.B., Pang, J.-S.: Strategic gaming analysis for electric power systems: An mpec approach. IEEE Transactions on Power Systems 15(2), 638–645 (2000) https://doi.org/10.1109/59.867153 . Cited by: 712
  21. [21]Pereira, M.V., Granville, S., Fampa, M.H.C., Dix, R., Barroso, L.A.: Strategic bidding under uncertainty: A binary expansion approach. IEEE Transactions on Power Systems 20(1), 180–188 (2005) https://doi.org/10.1109/TPWRS.2004.840397 . Cited by: 221
  22. [22]Zhang, N., Leibowicz, B., Hanasusanto, G.: Optimal residential battery storage operations using robust data-driven dynamic programming. IEEE transactions on smart grid 11(2), 1771–1780 (2020)DOI
  23. [23]Gomes, I.L.R., Pousinho, H.M.I., Melício, R., Mendes, V.M.F.: Stochastic coordination of joint wind and photovoltaic systems with energy storage in day-ahead market. Energy (Oxford) 124, 310–320 (2017)DOI
  24. [24]Zheng, N., Jaworski, J., Xu, B.: Arbitraging variable efficiency energy storage using analytical stochastic dynamic programming. IEEE transactions on power systems 37(6), 4785–4795 (2022)DOI
  25. [25]Erdinç, O., Erdinç, O.: Optimization in Renewable Energy Systems : Recent Perspectives, 1st edition edn. Gale eBooks. Butterworth-Heinemann, an imprint of Elsevier, Cambridge, Massachusetts (2017 - 2017)
  26. [26]Chanpiwat, P., Oliveira, F., Gabriel, S.A.: Integrated operational planning of battery storage systems for improved efficiency in residential community energy management using multistage stochastic dual dynamic programming: A finnish case study. Energies (Basel) 18(13), 3560 (2025)DOI
  27. [27]Gilks, W., Richardson, S., Spiegelhalter, D.: Markov chain monte carlo in practice. Chapman and Hall CRC (1996)
  28. [28]Hosein, P., Lawrence, T.: Stochastic dynamic programming model for revenue optimization in social networks. 2015 IEEE 11th International Conference on Wireless and Mobile Computing, Networking and Communications (WiMob), 378–383 (2015)DOI
  29. [29]Wu, H.-H., Küçükyavuz, S.: A two-stage stochastic programming approach for influence maximization in social networks. Comput. Optim. Appl (3), 563–595 (2018) https://doi.org/10.1007/s10589-017-9958-x
  30. [30]Rahaman, I., Hosein, P.: On the problem of multi-staged impression allocation in online social networks, 65–84 (2018) https://doi.org/10.1007/978-3-319-89932-9_4
  31. [31]Lawrence, T., Hosein, P.: Stochastic dynamic programming heuristics for influence maximization- revenue optimization. Int J Data Sci Anal 8, 1–14 (2018)DOI
  32. [32]Ross, S.: Introduction to stochastic dynamic programming (1983)
  33. [33]Verweij, B.: The sample average approximation method applied to stochastic routing problems: A computational study. Comput. Optim. Appl 24, 298–333 (2003) https://doi.org/10.1023/A:1021814225969
  34. [34]Wang, X., Bickis, M.: One-armed bandit models with continuous and delayed responses. Math Meth Oper Res 58, 209–219 (2003)DOI
  35. [35]Jiang, D.R., Powell, W.B.: Optimal hour-ahead bidding in the real-time electricity market with battery storage using approximate dynamic programming. INFORMS J. on Computing 27(3), 525–543 (2015) https://doi.org/10.1287/ijoc.2015.0640
  36. [36]Nowotarski, J., Rafal, W.: Computing electricity spot price prediction intervals using quantile regression and forecast averaging. Comput Stat, 791–803 (2015)DOI

Paper details

vlnc:W_mc48tnuv
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Mathematics

Not recorded for this paper

View statement
Looking for related papers…
Contents