You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: class15/class15.jl
+80-47Lines changed: 80 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -37,40 +37,62 @@ md"""
37
37
md"""
38
38
## Chapter Outline
39
39
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.
44
59
"""
45
60
46
61
# ╔═╡ f742f5f3-d9d3-4374-ac9e-17073c3a2f6d
47
62
md"""
48
63
# Introduction to Energy Systems
49
-
## Economic Dispatch
64
+
## From Economic Dispatch to Dynamic Optimal Control
50
65
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.
52
68
69
+
To illustrate the key ideas, we start with the simplest case — the economic dispatch problem on a 3-bus system.
70
+
71
+
**Example:**
53
72
- Bus 1 load: 50 MW
54
73
- 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
57
76
58
77

78
+
79
+
**Goal:** Minimize total generation cost while meeting total demand — the simplest form of *static* optimal control in power systems.
59
80
"""
60
81
82
+
61
83
# ╔═╡ ad8e9d79-e226-468e-9981-52b7cda7c955
62
84
md"""
63
85
### Quadratic Program (QP) Formulation of Economic Dispatch
64
86
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.
### Exercise: Formulate the ED problem for the 3-bus network
111
+
### Exercise: Formulate the ED Problem for the 3-Bus Network
90
112
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
92
119
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.
97
121
"""
98
122
99
123
# ╔═╡ d767175f-290d-403e-99de-d3a8f2ccb5b5
@@ -115,57 +139,65 @@ Here is the complete formulation for our 3-bus example:
115
139
- Total cost: 8*85 + 2*40 = 760\$/hour
116
140
- Gen 2 at maximum capacity (greedy)
117
141
- 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.
118
144
"""
119
145
120
146
# ╔═╡ c9d0e1f2-0894-4340-a18b-72f8e1204432
121
147
md"""
122
-
### Discussion Questions
148
+
### Discussion
149
+
150
+
Reflect on the ED formulation:
123
151
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?
125
155
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.
129
159
"""
130
160
131
161
# ╔═╡ 9d1ea9be-2d7b-4602-8a8e-8426ea31661a
132
162
md"""
133
-
### What's the Problem?
163
+
### Why the Simplified Model Falls Short
134
164
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.
140
168
- 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**.
144
173
"""
145
174
146
175
# ╔═╡ 71ba62e6-bcc1-4e9b-91cd-a8860ba0d2b5
147
176
md"""
148
177
## DC Power Flow
149
178
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.
151
181
152
-
**Data:**
182
+
**Parameters:**
183
+
- Line reactance $x_{ij}$
184
+
- Line limit $F_\ell^{\max}$
153
185
- Generator set $\mathcal{G}_i$ at bus $i$ (nodal generation)
154
186
- Load set $\mathcal{L}_i$ at bus $i$ (nodal load)
187
+
- Generator limits $P_j^{\min}, P_j^{\max}$
155
188
- 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}$
157
189
158
-
**Decision variables:**
190
+
**Decision Variables:**
159
191
- Generator outputs $P_j$ for $j \in \mathcal{G}_i$
160
192
- Bus angles $\theta_i$ for $i \in \mathcal{N}$
161
193
- 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.
162
196
"""
163
197
164
198
# ╔═╡ 7b4800c2-133d-4793-95b1-a654a4f19558
165
199
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
169
201
170
202
```math
171
203
\begin{align}
@@ -177,20 +209,20 @@ The DC power flow optimization problem combines economic dispatch with network p
177
209
\end{align}
178
210
```
179
211
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)
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:
190
222
191
223

192
224
193
-
**How did I get the numbers:**
225
+
**Net generation calculations:**
194
226
- Assume P1 generates 85 MW, with 50 MW of load, the net injection is 35 MW
195
227
- Assume P2 generates 40 MW, with no load, net injection is 40 MW (we take upwards arrow as injection)
196
228
- 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
200
232
md"""
201
233
### DCOPF Solution
202
234
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.
204
236
"""
205
237
206
238
# ╔═╡ f72775b9-818c-4a9b-9b66-cfccd88e17ed
@@ -209,9 +241,10 @@ md"""
209
241
210
242
This section has introduced the fundamentals of static optimal power flow problems including economic dispatch and DC optimal power flow. Key takeaways:
211
243
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.
0 commit comments