Skip to content

Commit ad572f3

Browse files
committed
finish intro
1 parent a15a8de commit ad572f3

File tree

1 file changed

+80
-47
lines changed

1 file changed

+80
-47
lines changed

class15/class15.jl

Lines changed: 80 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -37,40 +37,62 @@ md"""
3737
md"""
3838
## Chapter Outline
3939
40-
- Transients and Transient Stability Constrained Optimal Power Flow (TSC-OPF) problem
41-
- Generator swing equations
42-
- Inverters
43-
- Dynamic load models
40+
This chapter motivates the need for optimization and control of power systems by introducing the **Economic Dispatch (ED)** and **Optimal Power Flow (OPF)** problems and analyzing the physical behaviors they capture in power system.
41+
42+
We progressively move from solving *static optimization* problems to augmenting them with *dynamic optimal control* constraints as approaches to analyze and understand power systems.
43+
44+
**Topics covered:**
45+
- **Transients and Transient Stability–Constrained OPF (TSC-OPF):**
46+
What are transients, their physical behaviors, and how they are factored into stability analysis of energy systems via the TSC-OPF formulation.
47+
48+
- **Generator Swing Equations:**
49+
The physical foundation of synchronous machines — describes how mechanical torque and electrical power control frequency and machine responses to frequency changes.
50+
51+
- **Inverter Control Models:**
52+
Grid-following vs. grid-forming inverters, and how virtual inertia control emulates synchronous generator dynamics for renewables.
53+
54+
- **Dynamic Load Models:**
55+
Representations of demand that vary with voltage and frequency instead of a fixed a quantity, influencing both stability and control.
56+
57+
> 🧭 **Overall goal:**
58+
> To connect steady-state optimization (ED/DC-OPF) with **dynamic optimal control**, illustrating how classical control laws and physics-based constraints shape modern power system operation.
4459
"""
4560

4661
# ╔═╡ f742f5f3-d9d3-4374-ac9e-17073c3a2f6d
4762
md"""
4863
# Introduction to Energy Systems
49-
## Economic Dispatch
64+
## From Economic Dispatch to Dynamic Optimal Control
5065
51-
To illustrate the fundamental concepts and problems in power system, we start with a simple economic dispatch (ED) problem on a 3-bus network.
66+
Optimal control of power systems builds on static optimization formulations like *economic dispatch* (ED) and *optimal power flow* (OPF).
67+
These problems provide the mathematical foundation for **transient stability–constrained OPF (TSC-OPF)** formulations covered later in this chapter.
5268
69+
To illustrate the key ideas, we start with the simplest case — the economic dispatch problem on a 3-bus system.
70+
71+
**Example:**
5372
- Bus 1 load: 50 MW
5473
- Bus 3 load: 75 MW
55-
- Generator 1: Capacity 100 MW, Cost \$8/MW
56-
- Generator 2: Capacity 40 MW, Cost \$2/MW
74+
- Generator 1: capacity = 100 MW, cost = \$8/MW
75+
- Generator 2: capacity = 40 MW, cost = \$2/MW
5776
5877
![3-Bus Power System Network](https://www.al-roomi.org/multimedia/Power_Flow/3BusSystem/SystemIII/Murty3BusSystem.jpg)
78+
79+
**Goal:** Minimize total generation cost while meeting total demand — the simplest form of *static* optimal control in power systems.
5980
"""
6081

82+
6183
# ╔═╡ ad8e9d79-e226-468e-9981-52b7cda7c955
6284
md"""
6385
### Quadratic Program (QP) Formulation of Economic Dispatch
6486
65-
The economic dispatch problem can generally be formulated as a quadratic program. A generic ED formulation is:
87+
Economic dispatch can be formulated as a **quadratic program**, where generation cost is convex and constraints balance supply and demand conditions.
6688
6789
```math
6890
\begin{align}
6991
\min_{p_g} \quad & \sum_{g \in \mathcal{G}} C_g(p_g) \\
7092
\text{s.t.} \quad & \sum_{g \in \mathcal{G}} p_g = \sum_{d \in \mathcal{D}} P_d \quad \text{(power balance)} \\
71-
& p_g^{\min} \leq p_g \leq p_g^{\max} \quad \forall g \in \mathcal{G} \quad \text{(capacity bounds)}
93+
& p_g^{\min} \le p_g \le p_g^{\max}, \quad \forall g \in \mathcal{G} \quad \text{(capacity limits)}
7294
\end{align}
73-
```
95+
7496
7597
7698
where:
@@ -86,14 +108,16 @@ where:
86108

87109
# ╔═╡ fc329e51-e91c-4d83-b6fe-07a3bce44d5d
88110
md"""
89-
### Exercise: Formulate the ED problem for the 3-bus network
111+
### Exercise: Formulate the ED Problem for the 3-Bus Network
90112
91-
Now let's apply this formulation to our 3-bus example. Using the 3-bus system above (with loads and cost data), write down:
113+
**Task:**
114+
Apply the generic formulation to the 3-bus system. Identify:
115+
1. The decision variables
116+
2. The objective function
117+
3. The power-balance constraint
118+
4. Generator bounds
92119
93-
- The decision variables
94-
- The objective function
95-
- Power-balance constraint
96-
- Generator bounds
120+
> 💡 *Hint:* Treat each generator’s output as a controllable decision variable. The total generation must exactly match total load.
97121
"""
98122

99123
# ╔═╡ d767175f-290d-403e-99de-d3a8f2ccb5b5
@@ -115,57 +139,65 @@ Here is the complete formulation for our 3-bus example:
115139
- Total cost: 8*85 + 2*40 = 760\$/hour
116140
- Gen 2 at maximum capacity (greedy)
117141
- Gen 1 supplies remaining demand
142+
143+
> ⚙️ Control Interpretation: This is a static control allocation problem. In later sections, we’ll extend such formulations to time-varying states and control trajectories.
118144
"""
119145

120146
# ╔═╡ c9d0e1f2-0894-4340-a18b-72f8e1204432
121147
md"""
122-
### Discussion Questions
148+
### Discussion
149+
150+
Reflect on the ED formulation:
123151
124-
Before moving forward, let's reflect on what we've learned. What do you observe from your formulation?
152+
- What type of optimization problem is this (linear, quadratic, convex)?
153+
- How does this formulation abstract away the **physical grid topology**? What kind of graph is it?
154+
- What critical physics are missing if we care about **how** power moves through lines?
125155
126-
- What kind of problem is this (linear, quadratic, etc.)?
127-
- The power network is a graph -- what type? What is missing here?
128-
- The flow is not controllable - we did not place branch constraints.
156+
> 🧭 **Bridge to next topic:**
157+
> ED models the **steady-state optimization** problem without considering power flow through lines.
158+
> The next step — **DC power flow** — adds physical coupling constraints between buses.
129159
"""
130160

131161
# ╔═╡ 9d1ea9be-2d7b-4602-8a8e-8426ea31661a
132162
md"""
133-
### What's the Problem?
163+
### Why the Simplified Model Falls Short
134164
135-
The simple ED formulation we've seen has several limitations that become apparent when we consider the physical reality of power systems:
136-
137-
- The graph should be directed: power has flow directions
138-
- Line ratings and safety are ignored in ED
139-
- Overloading lines is dangerous (thermal expansion, sag, wildfire risk)
165+
The simple ED model ignores the **network physics** that govern actual power transfer:
166+
- Power has **direction** — it flows through transmission lines governed by voltage phase angles so the graph needs to be directed.
167+
- Each line has a **thermal rating**: excessive current causes heating, sagging, or even wildfires.
140168
- What is a power line:
141-
- Metal coil that expands and heats up when current is higher.
142-
- That's why we have rating (magnitude of power flow cannot exceed this amount). Physically you can exceed it (nothing is preventing the power to flow) a bit, but there are consequences above ...
143-
- We need branch (line) constraints to ensure safe operation
169+
- Metal coil that expands and heats up when current is high.
170+
171+
In real systems, exceeding thermal limits does not immediately stop power flow — it simply becomes unsafe, which requires branch flow constraints.
172+
Thus, the next layer of realism is to introduce branch constraints → **DC power flow**.
144173
"""
145174

146175
# ╔═╡ 71ba62e6-bcc1-4e9b-91cd-a8860ba0d2b5
147176
md"""
148177
## DC Power Flow
149178
150-
To address these limitations, we extend the ED formulation to include network constraints through DC power flow. This formulation accounts for power flow directions and line limits.
179+
To make ED more realistic, we include the grid’s topology by adding branch constraints.
180+
The **DC power flow model** provides a linearized approximation of AC power flow and enforce Kirchhoff’s laws.
151181
152-
**Data:**
182+
**Parameters:**
183+
- Line reactance $x_{ij}$
184+
- Line limit $F_\ell^{\max}$
153185
- Generator set $\mathcal{G}_i$ at bus $i$ (nodal generation)
154186
- Load set $\mathcal{L}_i$ at bus $i$ (nodal load)
187+
- Generator limits $P_j^{\min}, P_j^{\max}$
155188
- Costs $C_j(P_j)$ quadratic or piecewise-linear for generator $j$
156-
- Line limits $F_\ell^{\max}$, generator bounds $P_j^{\min}, P_j^{\max}$
157189
158-
**Decision variables:**
190+
**Decision Variables:**
159191
- Generator outputs $P_j$ for $j \in \mathcal{G}_i$
160192
- Bus angles $\theta_i$ for $i \in \mathcal{N}$
161193
- Line flows $f_\ell$ for $\ell \in \mathcal{L}$
194+
195+
> 🧩 We will see later that the bus angles $\theta_i$ enter as *state variables* in the control dynamics.
162196
"""
163197

164198
# ╔═╡ 7b4800c2-133d-4793-95b1-a654a4f19558
165199
md"""
166-
### DC Power Flow Formulation
167-
168-
The DC power flow optimization problem combines economic dispatch with network physics:
200+
### DC Optimal Power Flow Formulation
169201
170202
```math
171203
\begin{align}
@@ -177,20 +209,20 @@ The DC power flow optimization problem combines economic dispatch with network p
177209
\end{align}
178210
```
179211
180-
- Reactance of line $x_{ij}$. $\frac{1}{x_{ij}} = b_{ij}$: susceptance (manufacturer specified)
181-
- Reference bus: only for modeling, you can pick any bus as the reference bus. We only care about angle differences (which carries current through lines
212+
- Reactance of line: $x_{ij}$. $\frac{1}{x_{ij}} = b_{ij}$: susceptance (specified by equipment manufacturer)
213+
- Reference bus: only for modeling, you can pick any bus as the reference bus. We only care about angle differences (which carries current through lines)
182214
- Individual bus angle has no physical meaning
183215
"""
184216

185217
# ╔═╡ 7961c1d1-3e82-49ea-8201-c5f82066d70d
186218
md"""
187-
### Exercise: Solve DCOPF (solver suggested: Ipopt)
219+
### Exercise: Solve DCOPF (suggested solver: Ipopt)
188220
189-
Let's apply the DC power flow formulation to our 3-bus network with line constraints:
221+
Let's apply the DC power flow formulation to the 3-bus network with line constraints:
190222
191223
![3-Bus Network with Constraints](https://www.al-roomi.org/multimedia/Power_Flow/3BusSystem/SystemIII/Murty3BusSystem.jpg)
192224
193-
**How did I get the numbers:**
225+
**Net generation calculations:**
194226
- Assume P1 generates 85 MW, with 50 MW of load, the net injection is 35 MW
195227
- Assume P2 generates 40 MW, with no load, net injection is 40 MW (we take upwards arrow as injection)
196228
- Bus 3 has no gen, only load
@@ -200,7 +232,7 @@ Let's apply the DC power flow formulation to our 3-bus network with line constra
200232
md"""
201233
### DCOPF Solution
202234
203-
Consult lecture slides for the solution and detailed analysis.
235+
Consult lecture slides for the solution and detailed analysis. Observe how adding line limits changes dispatch and total cost.
204236
"""
205237

206238
# ╔═╡ f72775b9-818c-4a9b-9b66-cfccd88e17ed
@@ -209,9 +241,10 @@ md"""
209241
210242
This section has introduced the fundamentals of static optimal power flow problems including economic dispatch and DC optimal power flow. Key takeaways:
211243
212-
- You will see that without thermal limits, optimal dispatch can overload lines
213-
- Reference bus is arbitrarily picked by the solver.
214-
- Real systems are AC (complex voltages/currents) -- much harder. This is just a lightweight intro so we can think about expressing real-world problems as optimization formulations without overburdening ourselves with AC physics, which we will see in transient stability section.
244+
- You observed that without thermal limits, optimal dispatch from ED can overload lines
245+
- Real systems are AC (complex voltages/currents) -- much harder. This is just a lightweight intro so we can think about expressing real-world problems as optimization formulations without burdening ourselves with AC physics, which we will see in transient stability section.
246+
247+
In the next section, we introduce transients and transient stability constraints to capture dynamic states of grid components, bringing time domain dynamics into the optimization.
215248
"""
216249

217250
# ╔═╡ 53ab9b31-78aa-49b6-9e24-df47aa80f25a

0 commit comments

Comments
 (0)