Skip to content

Commit 7d0ffa8

Browse files
authored
Merge pull request #23 from Jerry-Zhuoer-Feng/master
Added technical docs
2 parents 90bb085 + 41aad71 commit 7d0ffa8

File tree

4 files changed

+169
-4
lines changed

4 files changed

+169
-4
lines changed

docs/source/technical/dispatchable.rst

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,59 @@
55
**Dispatchable/Non-dispatchable generators**
66
===============================================
77

8-
Loren ipsum
8+
**Overview**
9+
10+
Electric power systems rely on a mix of generation technologies. Broadly, these fall into two categories:
11+
* Dispatchable generators: Facilities whose output can be adjusted up or down by the system operator (e.g., natural gas, coal), subject to physical limits (ramping limits, minimum up/down times).
12+
* Non‑dispatchable generators: Units that produce energy according to an exogenous resource profile (e.g., wind turbines, solar PV), with limited or no ability for the operator to increase output beyond what nature provides.
13+
14+
**Dispatchable generators**
15+
16+
We model the operation of dispatchable generators using three variables:
17+
18+
* Dispatch variable :math:`p_{g,t}`: Power output of generator :math:`g` at time :math:`t`. More specifically, it is split into "above-min" generation :math:`p'_{g,t}` and "at-min" generation :math:`\underline{P}_g`
19+
* Commitment variable :math:`u_{g,t} \in \{0,1\}`: Binary indicator if :math:`g` is online.
20+
* Starting/Shutdown variable :math:`v_{g,t}, w_{g,t} \in \{0,1\}`: Binary indicator if :math:`g` is starting up or shutting down at time :math:`t`.
21+
22+
Each dispatchable generator is subject to constraints:
23+
24+
* Capacity: The capacity is constrainted by the minimum and maximum capacity.
25+
:math:`\underline{P}_g \times u_{g,t} \le P'_{g,t} + \underline{P}_g \le \bar{P}_g \times u_{g,t}`
26+
27+
* Ramping limit: The change in power output from :math:`t` to :math:`t+1` cannot be over the ramping limit.
28+
* Minimum up/down time: Once started or stopped, the unit remains in that state for the specified duration.
29+
* Must take: If the unit has to be included in the generation profile.
30+
31+
We then minimize the cost of generation, for which the cost of individual dispatchable generator is given by:
32+
33+
* Fixed cost: Fixed cost is a function of rated capacity and fixed cost per unit.
34+
:math:`c_{g,t}^{fixed} = \bar{P}_g \times {fixed\_cost\_per\_unit}_g \times u_{g,t}`
35+
36+
* Variable cost: Variable cost is a function of fuel cost, heat rate, and operating cost.
37+
:math:`c_{g,t}^{var} = (({fuel\_price}_g \times {heat\_rate}_g) + {opex}_g) \times p_{g,t}`
38+
39+
* Startup cost: Startup cost is a function of rated capacity and startup cost per unit.
40+
:math:`c_{g,t}^{start} = P_g^{max} \times {startup\_cost}_g \times v_{g,t}`
41+
42+
* Curtailment cost: Curtailing "must-take" thermal output is priced as the same variable rate.
43+
:math:`c_{g,t}^{curt} = (({fuel\_price}_g \times {heat\_rate}_g) + {opex}_g) \times p^curt_{g,t}`
44+
45+
**Non-dispatchable generators**
46+
47+
For non-dispatchable generators, the model's decision is to dispatch, curtail, or store the renewable energy produced. We therefore have:
48+
49+
* Dispatched :math:`pdispatch_{g,t}`
50+
* Curtailed :math:`pcurtail_{g,t}`
51+
* Charged :math:`pcharge_{g,t}`
52+
53+
Non-dispatchable generators are subject to constraints:
54+
55+
* Available capacity:
56+
:math:`pdispatch_{g,t} \le available\_capacity_{g,t}`
57+
* Energy balance:
58+
:math:`pdispatch_{g,t} + pcurtail_{g,t} + pcharge_{g,t} = available\_capacity_{g,t}`
59+
60+
We assume non-dispatchable generators do not have a fixed or start-up cost, and we get the variable cost from the contract price:
61+
62+
* Variable cost:
63+
:math:`c_{g,t}^{var} = {contract\_price}_g \times pdispatch_{g,t}`

docs/source/technical/linear_power_flow.rst

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,36 @@
55
**Linearized DC power flow**
66
================================
77

8-
Loren ipsum
8+
**Overview**
9+
10+
In alternating‐current (AC) power systems, power is transmitted at high voltages through a network of buses and transmission lines and is a crucial part of an energy system. Each line can be characterized by its series impedance (resistance and reactance). We model power flow in a by both voltage magnitudes and angles at its ends, as described by the nonlinear AC power flow equation for real power:
11+
12+
:math:`P_{ij}=V_i V_j(G_{ij}\cos{(\theta_i-\theta_j)} + B_{ij}\sin{(\theta_i-\theta_j)})-V_i^2G_{ij}`
13+
14+
where :math:`V_i` is the voltage magnitude at bus :math:`i`, :math:`\theta_i` is the voltage angle, :math:`G_{ij}` and :math:`B_{ij}` are the conductance (1 over resistance) and susceptance (1 over reactance) of the line between bus :math:`i` and bus :math:`j`.
15+
16+
The full AC equation above captures the full dynamics but is nonlinear due to the trigonometric terms and quadratic dependence on voltage magnitudes. To simplify analysis and enable efficient optimization, we use a DC power flow approximation based on:
17+
18+
* **Negligible Resistance**: Line losses due to resistance are assumed small compared to reactance for high-voltage large-scale power grids, so resistances are ignored and only reactances remain.
19+
* **Small Angle Differences**: Voltage angle differences are small enough that :math:`\sin{(\theta_i)}` approaches :math:`\theta_i`.
20+
21+
therefore we simplify the real power flow on a line as follows:
22+
23+
:math:`P_{ij}=B_{ij}(\theta_i-\theta_j)`
24+
25+
where :math:`P_{ij}` is the powerflow in a line, :math:`B_{ij}` is the line susceptance, and :math:`\theta_i` the voltage angle.
26+
27+
**Model**
28+
29+
The above formulation translates into the following in our model:
30+
31+
* Decision Variables:Our decision variables therefore include :math:`\theta_i` for each bus :math:`i`, representing the phase angle; line flows :math:`F_{ij}` as auxiliary variables representing the real power on each line.
32+
* Parameters:Constant :math:`B_{ij}` representing the line susceptance between bus :math:`i` and :math:`j`.
33+
* Flow: DC approcimation of power flow.
34+
:math:`F_{ij}=B_{ij}(\theta_i-\theta_j)`
35+
* Kirchoff's Current Law: Power Balance at each bus. :math:`P_i^{gen} - P_i^{load}` represents the net power injection (generation minus loads) at bus :math:`i`.
36+
:math:`P_i^{gen} - P_i^{load} = \sum F_{ij} - \sum F_{ji}`
37+
* Line Capacity Constraint:
38+
:math:`-F_{ij}^{max} \le F_{ij} \le F_{ij}^{max}`
39+
40+
By combining these elements: angle and flow variables, a linear flow, nodal balance equations, and capacity bounds, our code realizes the classic DC power flow model entirely within a (mixed integer) linear framework.

docs/source/technical/reservoir_model.rst

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,36 @@
55
**Reservoir model**
66
=======================
77

8-
Loren ipsum
8+
**Reservoir Dynamics**
9+
10+
Reservoir storage hinges on a simple balance: water in (inflows) minus water out (releases, spills, losses) equals the change in storage. In discrete time (daily or hourly), we enforce:
11+
:math:`S_{t+1}=S_t+I_t-R_t-E_t`
12+
13+
where :math:`S_t` is the storage, :math:`I_t` the inflow, :math:`R_t` the release, and :math:`E_t` the evaporation.
14+
15+
In optimization formulations, the balance equation becomes an equality constraint linking decision variables (release, spill) and state variables (storage). Physical limits on storage (dead storage, maximum capacity) are imposed as inequality constraints to ensure feasible reservoir levels.
16+
17+
Besides storage, elevation is also often used as a measure of the state of a reservoir. The storage-elevation relationship :math:`S = f(h)` and its inverse :math:`h = f^{-1}(S)` can be non-linear and is defined by emprical volume curve :math:`vol\_curve`.
18+
19+
**Reservoir Operations**
20+
21+
We have two core modes of operation: rule-curve scheduling and dispatch-driven re-operation:
22+
23+
* **Rule-curve scheduling**: Operators follow seasonal guidelines (rule curves) to choose releases to track a daily storage target while satisfying mass balance, spill, and min/max flow constraints. It has a deterministic target, such as daily storage or level targets derived from historical rule curves. Our optimization then minimizes the deviation from the target path.
24+
* **Dispatch-driven re-operation**: We invert a power‐dispatch target into release decisions. We adapt reservoir releases to meet daily or hourly power-generation targets from system dispatch, while still honoring mass balance and environmental rules. Our optimization there for solve for release sequence that minimizes mismatch between computed hydropower and dispatch targets, subject to mass balance, ramp-rate bounds, ecologoical minima, and turbine & grid limits. This is done based on hydropower physics, where we calculate the power :math:`P_t` from :math:`\eta` the turbine efficiency, :math:`\rho` the water density, :math:`g` the gravitational constant, :math:`H_t` the hydraulic head (water level above turbine center), and :math:`Q^{turbine}_t` the water flow through the turbine:
25+
:math:`P_t = \eta \cdot \rho \cdot g \cdot H_t \cdot Q^{turbine}_t`
26+
27+
**Environmental Flow & Hydropeaking Constraints**
28+
29+
To protect downstream ecosystems, maintain habitat, and prevent fish stranding, operations must respect minimum flow requirements and limit daily ramp‐rates (hydropeaking):
30+
31+
* Minimum enviornmental flow: We determine the minimum amount of water that should be released from a reservoir to maintain the health of the downstream ecosystem. The minimum flow is set at different percentages of the inflow, subject to how the inflow compares with the mean annual flow.
32+
* Hydropeaking: Hydropeaking is the rapid and frequent changes in river flow to optimize hydropower operation. We adjust the release based on a hydropeaking factor and the minimum environmental flow, ensuring daily changes remain within a percentage of capacity.
33+
34+
**Cascade Coordination & Basin-Level Aggregation**
35+
36+
In multi‐reservoir systems, upstream releases and spills directly become downstream inflows, creating interdependence. To manage reservoirs in a basin, we follow the modeling principles:
37+
38+
* Sequential Processing: Order reservoirs by cascade level; each reservoir receives the combined outflow of upstream units as its inflow.
39+
* Simulation: Each reservoir at level uses the aggregated inflow from all upstream nodes.
40+
* Aggregation: Sum across reservoir columns to produce basin‐level time series for water release and hydropower, enabling performance metrics and system modeling.

docs/source/technical/time_series_models.rst

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,50 @@
55
**Time series modeling**
66
=========================
77

8-
Loren ipsum
8+
**ARIMA Model**
9+
10+
ARIMA (Autoregressive Integrated Moving Average) is a foundational time-series modeling technique that combines three components:
11+
12+
* Autoregression (:math:`AR(p)`): Models the value at time t as a linear function of its own p lagged values, capturing persistence and momentum in the series.
13+
* Integration (:math:`I(d)`): Applies differencing of order d to remove trends and achieve stationarity, ensuring the series has constant mean and variance over time.
14+
* Moving Average (:math:`MA(q)`): Represents the value at time t as a linear function of q past forecast errors, capturing short-term shocks and noise.
15+
16+
**SARIMAX Model**
17+
18+
SARIMAX (Seasonal Autoregressive Integrated Moving Average with eXogenous regressors) extends the classic ARIMA framework by explicitly modeling both seasonality and the influence of external variables on the series. In SARIMAX, the observed series :math:`y_t` is first differenced :math:`d` times to achieve stationarity, similar to ARIMA; the residual structure is then captured by:
19+
20+
* Seasonality: Additional differencing and seasonal AR/MA terms at lag :math:`s` (period) to model repeating patterns (e.g., daily, weekly), by seasonally differencing :math:`D` times with period :math:`s`
21+
* Exogenous Regressors: Incorporates external variables (e.g., temperature, calendar indicators) linearly to explain known drivers of variability.
22+
23+
**Monthly SARIMAX Model**
24+
25+
We employ a per-month SARIMAX model for:
26+
27+
* Non‑Stationary Seasonality across the Year: Daily/weekly cycle shapes (peak sharpness, trough depth) change with season.
28+
* Localized Parameter Tuning: Fitting separate SARIMAX for each calendar month allows tailored (p,d,q)(P,D,Q,s) orders per month.
29+
* Improved Forecast Robustness: Month‑specific models reduce over‑ or under‑differencing risk and avoid a one‑size‑fits‑all seasonal period.
30+
31+
**Demand Model**
32+
33+
In short‑term load forecasting, SARIMAX is well suited because demand exhibits strong intra‑day/weekly cycles plus dependencies on weather and calendar effects. We equip the model with the ability to forecase the hourly electricity demand:
34+
35+
* **Step 1:** We first run an ordinary least squares (OLS) regression on user-supplied exogenous variables (such as temperature) and get the residual series. The OLS isolates the “explained” portion of demand and the residual is treated as a stationary series for further time‐series modeling.
36+
* **Step 2:** We run a Seasonal-Trend decomposition using LOESS (STL) to decompose a time series into three components: trend, season(al) and residual.
37+
* **Step 3:** We fit a Seasonal Autoregressive Integrated Moving Average with Exogenous Regressors (SARIMAX) model to capture the correlation structure, and store per-month SARIMAX models and residuals.
38+
39+
We run auto-ARIMA on the detrended, deseasonalized residuals to pick (p,d,q)(P,D,Q,s) orders that best capture autocorrelation left after regression + STL. We can then get synthetic time series by comnbining regression, drawing sample paths from each monthly SARIMAX, and adding seasonal and trend components.
40+
41+
**Solar Model**
42+
43+
Solar generation follows a deterministic diurnal "bell curve" and seasonal envelope, with high‑frequency fluctuations due to clouds and atmosphere, therefore we can also use SARIMAX to capture stochastic variability. Similarly, we would like to forecase solar irradiance/PV output. We follow a similar structure to the demand model, but:
44+
45+
* No pre-regression on exogenous weather, instead, the STL decomposition itself captures the deterministic daily/seasonal envelope and all remaining variation feeds directly into SARIMAX.
46+
* Clip output to nonnegative and force it to zero during night hours.
47+
48+
**Related Works**
49+
50+
SARIMAX is a tried-and-tested way of modeling both demand and solar irradiance as demonstrated by the following works:
51+
52+
* N. Elamin, M. Fukushige. Modeling and forecasting hourly electricity demand by SARIMAX with interactions. *Energy*. Volume 165, Part B, 2018, Pages 257-268, ISSN 0360-5442.
53+
* E. Eskandarnia and M. AlHammad, "Predication of future energy consumption using SARIMAX," *3rd Smart Cities Symposium (SCS 2020)*, 2020, pp. 657-662.
54+
* S. Vagropoulos, G. Chouliaras, E. Kardakos, C. Simoglou and A. Bakirtzis, "Comparison of SARIMAX, SARIMA, modified SARIMA and ANN-based models for short-term PV generation forecasting," *2016 IEEE International Energy Conference (ENERGYCON)*, Leuven, Belgium, 2016, pp. 1-6.

0 commit comments

Comments
 (0)