Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The Supply and Demand of Electricity

Download the PDF
Watch Part II

To understand the wholesale electricity market, one must understand the economic principles of supply and demand. To do so, let’s start with a market example that is unrelated to the electricity market, but familiar and intuitive.

Introduction to Economics: Your Friendly Neighborhood Espresso Market

Imagine a neighborhood of cafés, all serving espresso. What a wondrous place to live! The baristas make as many espresso shots as customers buy. More specifically, at any given time, the rate at which baristas supply espresso shots (e.g., in shots per hour) is always equal to the rate at which customers demand them.

For reasons that will become apparent later, we will assume for the sake of example that all cafés serve identical espresso and offer an identical experience to customers. Because the cafés’ offerings are the same and they are conveniently located within the same neighborhood, the only thing that would set them apart in the eyes of customers is their prices.

But if a café tries to undercut its neighbors, the other cafés will follow suit if the lower price is sustainable in order to stay competitive. And if a café raises its price to increase its profit margin, others will be able to do the same. For a given time, place, and offering, there is one stable price. Different cafés may have different operating costs—perhaps a café has a more expensive supplier of espresso beans—but they tend to charge the same price per espresso shot and pocket the difference.

Customers’ demand for espresso shots is based on how much the cafés charge for each one; there will be fewer customers if the cafés charge more and vice versa. Thus, the rate at which customers buy espresso is a function of the price per espresso shot. This function is called the demand curve, which models buyer behavior in aggregate and is generally monotonically decreasing. The demand curve changes with time; for example, demand for espresso is greatest in the morning.

If the cafés have to make more espresso, they will have to purchase more espresso beans. They will have to call upon additional baristas to help, or have to pay each barista more per hour, which factors into the cost per shot. The cafés’ cost per espresso shot is reflected in the price they charge for each one. However, the cafés’ price per shot is not constant. If the cafés are overwhelmed with customers, they may charge more for each espresso shot to take advantage of the situation and make more profit per shot. The cafés may have to augment their baristas’ hourly wages with bonus pay to keep them happy. To meet the demand, the cafés may also have to bust out their older, less efficient espresso machines from their back rooms that use more espresso beans per shot. On the other hand, if the cafés are having a slow day, they may reduce their price and sacrifice some profit per espresso shot to make the most of the low demand. This is called dynamic pricing. The price is a function of the rate at which espresso shots are being sold. This price is also known as the marginal cost of supplying an additional espresso shot (per hour). The price function is called the supply curve, which models seller behavior in aggregate and is generally monotonically increasing.

A given café is willing to sell espresso at or above a certain price, and a given customer is willing to buy at or below a certain price.

The Market Clearing Process

The above principles are true not just for a neighborhood of cafés but for any capitalist market. These basic tenets of economics are the principles of supply and demand. They apply wherever a quantity QQ of a particular good is exchanged at a price PP. QQ is measured in goods per hour, and PP is measured in dollars (or any other currency) per good.

The allocation of buyers to sellers (customers to cafés) is a process called clearing the market. This determines the quantity of goods that gets exchanged in the market, Q∗Q^*, and at what price, P∗P^*. This price is known as the market price or market-clearing price. Sellers who charge a low price are able to produce at a low cost and do not price-gouge. A capitalist market rewards such sellers, giving them priority over other, less efficient ones. At the same time, a capitalist market rewards buyers who are willing to pay a high price, giving them priority over other buyers who don’t value the product as much. It follows that we can model the market clearing process by allocating an increasing quantity of goods to the buyers and sellers, starting with the buyers who are willing to pay the most and the sellers who are willing to charge the least, until the buying price equals the selling price.

We can represent this model graphically (or mathematically) by plotting the supply and demand curves as shown in Figure 1. The market-clearing price P∗P^* and quantity Q∗Q^* are dictated by the point where the two curves intersect. The area under the supply curve until a quantity QQ represents the cost CC of producing that quantity (not to be confused with the marginal cost of producing an additional unit of that quantity). The area under the demand curve until a quantity QQ represents the cumulative value delivered to buyers by that quantity, known in economics as utility, U ⁣U\!. Subject to the constraint that the quantity sold must be the same as the quantity bought, Q∗Q^* simultaneously maximizes buyer utility and minimizes seller cost. The difference U−CU - C is known in economics as surplus or welfare, W ⁣W\!. In clearing the market, welfare is maximized.

Welfare can be split into two parts: producer surplus, and consumer surplus. Producer surplus is the area above the supply curve but below P∗P^*, representing the profit earned by selling above the cost of production. Consumer surplus is the area below the demand curve but above P∗P^*, representing the extra value delivered to customers beyond what they paid for.

Supply and demand curves.

Figure 1:Supply and demand curves.

Obviously there is no regulatory body that allocates customers to cafés, no economist planted in town square finding the intersection between the supply and demand curves. Your friendly neighborhood espresso market clears itself. Cafés try to charge the highest price that the optimal number of customers are willing to pay, and customers naturally seek out the lowest price that cafés are willing to charge; the two sides generally meet somewhere in the middle.

Clearing the Wholesale Electricity Market

The principles of supply and demand are so universal that they apply to the electrical grid when operated as an electricity market. In this case, the good is not espresso shots but megawatt-hours of electricity—energy for machines, rather than for humans. The unit of measurement is not espresso shots per hour but megawatt-hours per hour—so, just megawatts (MW). In a wholesale electricity market, the rate at which electricity is supplied (the production, or generation) is always equal to the rate at which it is demanded (the consumption, or load). In the café analogy, generators are espresso machines, and loads—such as your local utility company—are customers. Everything that we’ve discussed so far in terms of cafés (and capitalist markets in general) applies to the wholesale electricity market. Even busting out less efficient espresso machines when demand for espresso is high is analogous to firing up less efficient gas-fired power plants when electricity demand is high.

We assumed before that all cafés served identical espresso. In other words, we assumed that espresso is a commodity—a good that varies little between sellers and that buyers are not picky about. Obviously this isn’t true about espresso in the real world! Examples of commodities include wheat, crude oil, and...electricity! Indeed, all electrons are created equal. Electricity may be produced from a variety of energy sources (nuclear, hydro, and so on) and travel varying distances to get to your home, but there is no differentiating between a nuclear-generated electron and a hydro-generated electron. People care about the origin and locality of their food more than that of their electricity. Yes, some people care about the environmental sustainability of their electricity—I among them—but we cannot choose between sustainable and unsustainable electrons. We can only choose to consume electricity at times of day when there is a higher proportion of sustainable electrons in the mix. But, at a given time, all electrons are equal.

Previously we discussed the market clearing process. The wholesale electricity market must be cleared like any other, but unlike a neighborhood espresso market, it cannot feasibly clear itself. There are two reasons for this.

First of all, there is no buffer between production and consumption. Let’s look at this through the lens of the café analogy. If cafés are busy, customers can feasibly wait for up to several minutes between placing their orders and receiving their espresso. Alternately, the cafés can prepare extra espresso shots while morning demand is still ramping up, to reduce customer wait times. But this does not work in the electricity market. When you turn on your kettle, you don’t have to wait even a second for power. You just take. The grid cannot ramp up in advance of everyone turning on their kettles in the morning because, traditionally, there is no way to store that extra power.

The second reason for which the electricity market cannot clear itself is that resources are pooled. When you want espresso, you go to one café and talk to one barista who fulfills your order. But when you want to turn on your electric kettle at home, you don’t call up a generator and ask them to ramp up by a couple kilowatts. There is a disconnect between the demand (you, or rather, your utility company) and the supply (the generators).

Thus, the wholesale electricity market must be administered by a regulatory body—the system operator—that monitors the demand, and tells each generator how much to supply such that the total supply exactly equals the demand at all times. It is worth it to have an ISO or similar organization different to whoever owns and operates the generators because it fosters healthy competition between the generation companies, which reduces the cost of electricity.

It is worth re-iterating that everything involved in the market clearing process is time-variant: supply curves, demand curves, quantities, and prices. Fluctuations and spikes occur in electricity prices when the demand, and thus the supply, fluctuate and spike. Frequent and large price changes are very characteristic of electricity markets and seldom observed elsewhere. When’s the last time you saw espresso prices changing by a factor of 100 within a day?

Another difference between the electricity market and other markets is the disconnect between end customers and the market prices. When you purchase espresso (or any other good), you are aware of the price at the time of purchase. However, residential and commercial grid users (and thus the utility companies through whom they purchase electricity) decide how much electricity to consume based on a crude approximation of the real-time price, such as fixed electricity rates that are higher during the day and lower at night. Such loads are described as inelastic because they are inflexible or unresponsive to the real-time price. Inelastic loads, also known as non-dispatchable loads, are modeled by a demand curve that is perfectly vertical and representative of a fixed quantity of power being bought at a given point in time. This lack of flexibility can make the price volatile, causing price spikes to occur when demand is high, or when the supply of cheap electricity is intermittent (e.g., wind or solar). Industrial consumers avoid price spikes by becoming dispatchable loads, consuming only at or below a certain price. Similarly, utility companies use demand response programs to curtail EV charging or air conditioning at times when the demand and price would otherwise be excessively high.

On the supply side, there are also dispatchable and non-dispatchable generators. We will assume all loads and generators to be dispatchable, as that is the general case and any non-dispatchable resource can be modeled as a dispatchable one. A caveat is that the non-dis­patchable power quantities that are used when clearing the market are based on predicted generation (wind, solar) and load, unlike the concrete quantities offered by a dispatchable generator.

Bids to Buy and Offers to Sell Power

Loads and generators submit bids to buy power and offers to sell power, respectively. Each bid or offer includes a list of price-quantity pairs. In a given price-quantity pair, the quantity is the maximum quantity of power that a generator is willing to sell, or that a load is willing to buy, at the corresponding price in the pair. The price is measured in dollars per MWh, also known as the marginal cost of generating an additional MWh of electricity. The quantity is measured in MW. For an offer, the price must monotonically increase as the quantity increases, and for a bid, the price must monotonically decrease as the quantity increases.

If these sound similar to supply and demand curves, it’s because they are! In an electricity market with one load and one generator, the load’s (PL,QL)(P_\mathrm{L}, Q_\mathrm{L}) pairs would define the electricity market’s demand curve and the generator’s (PG,QG)(P_\mathrm{G}, Q_\mathrm{G}) pairs would define the market’s supply curve, also known as the dispatch curve. The intersection between the supply and demand curves determines the quantity Q∗Q^* of power that will be delivered at the market-clearing price P∗P^*, which maximizes WW.

Example 1: One Generator, One Load

Consider the example shown in Figure 2. The generator says they are willing to produce up to 6 MW6 \ \mathrm{MW} at $2/MWh\$2 / \mathrm{MWh}, or up to 9 MW9 \ \mathrm{MW} at $7/MWh\$7 / \mathrm{MWh}. Note that this does not mean they are willing to produce the first 6 MW6 \ \mathrm{MW} at $2/MWh\$2 / \mathrm{MWh} and only the remaining 3 MW3 \ \mathrm{MW} at $7/MWh\$7 / \mathrm{MWh}; the generator has one price, and it changes if a certain volume is surpassed, like in the café analogy. The same principle applies on the demand side: the load says they are willing to consume up to 4 MW4 \ \mathrm{MW} at $8/MWh\$8 / \mathrm{MWh}, or up to 8 MW8 \ \mathrm{MW} at $5/MWh\$5 / \mathrm{MWh}. These price-quantity pairs form the two “staircases”—the supply and demand curves—shown in the figure. The market clears at Q∗=6 MWQ^* = 6 \ \mathrm{MW} and P∗=$5/MWhP^* = \$5 / \mathrm{MWh}. The system operator collects Q∗P∗=$30/hQ^* P^* = \$30/\mathrm{h} from the load and pays it to the generator.

Supply and demand curves formed by the price-quantity pairs of the one generator and one load of Example 1.

Figure 2:Supply and demand curves formed by the price-quantity pairs of the one generator and one load of Example 1.

Example 2: Two Generators, Two Loads

What if we have two generators, G1\mathrm{G1} and G2\mathrm{G2}, and two loads, L1\mathrm{L1} and L2\mathrm{L2}? Each generator and load has its own supply or demand curve formed by its price-quantity pairs, as shown in Figure 3. These are known as individual supply and demand curves, as they represent individual participants in the market.

Individual supply and demand curves formed by the price-quantity pairs of the two generators and two loads of Example 2.

Figure 3:Individual supply and demand curves formed by the price-quantity pairs of the two generators and two loads of Example 2.

In clearing the market, we still want to maximize W=U−CW = U - C. The total seller cost CC is the total of the areas under each generator’s individual supply curve, up to the quantity produced by each generator:

C(QG1,QG2)=∫0 QG1 ⁣ ⁣ ⁣pG1(q) dq+∫0 QG2 ⁣ ⁣ ⁣pG2(q) dqC(Q_\mathrm{G1}, Q_\mathrm{G2}) = \int_0^{\, Q_\mathrm{G1}} \!\!\! p_\mathrm{G1}(q) \, \mathrm{d} q + \int_0^{\, Q_\mathrm{G2}} \!\!\! p_\mathrm{G2}(q) \, \mathrm{d} q

And the total buyer utility UU is the total of the areas under each load’s individual demand curve, up to the quantity consumed by each load:

U(QL1,QL2)=∫0 QL1 ⁣ ⁣ ⁣pL1(q) dq+∫0 QL2 ⁣ ⁣ ⁣pL2(q) dqU(Q_\mathrm{L1}, Q_\mathrm{L2}) = \int_0^{\, Q_\mathrm{L1}} \!\!\! p_\mathrm{L1}(q) \, \mathrm{d} q + \int_0^{\, Q_\mathrm{L2}} \!\!\! p_\mathrm{L2}(q) \, \mathrm{d} q

Maximizing WW is an optimization problem known as the economic dispatch (ED) problem. The problem is subject to the constraint that the total quantity sold, QG1+QG2Q_\mathrm{G1} + Q_\mathrm{G2}, must equal the total quantity bought, QL1+QL2Q_\mathrm{L1} + Q_\mathrm{L2}. This constraint represents conservation of power flow.

 ⁣max⁡QG1, QG2, QL1, QL2W(QG1,QG2,QL1,QL2)subject toQG1+QG2=QL1+QL2\begin{aligned} & \! \max_{Q_\mathrm{G1}, \, Q_\mathrm{G2}, \, Q_\mathrm{L1}, \, Q_\mathrm{L2}} W(Q_\mathrm{G1}, Q_\mathrm{G2}, Q_\mathrm{L1}, Q_\mathrm{L2}) \\ & \text{subject to} \quad Q_\mathrm{G1} + Q_\mathrm{G2} = Q_\mathrm{L1} + Q_\mathrm{L2} \end{aligned}

This optimization problem can be simplified by splicing the generators’ and loads’ individual supply and demand curves into an aggregated supply curve and an aggregated demand curve, respectively. The aggregated demand curve can be formed by sorting the price-quantity pairs from high to low, and the aggregated supply curve can be formed by sorting them from low to high (known as merit order). The optimization problem can then be solved by finding the intersection between the aggregated supply and demand curves.

The solution to the example at hand is Q∗=11Q^* = 11, P∗=4P^* = 4. This is shown in Figure 5, and Figure 4 shows how Q∗Q^* corresponds to the individual quantities QG1∗Q_\mathrm{G1}^*, QG2∗Q_\mathrm{G2}^*, QL1∗Q_\mathrm{L1}^*, and QL2∗Q_\mathrm{L2}^*. The optimal cost, utility, and welfare are tabulated in Table 1. Resource G2\mathrm{G2} is known as the price-setting resource, or price-setter, because one of its price-quantity pairs dictated the market-clearing price.

Individual supply and demand curves of the two generators and two loads of Example 2, showing their optimal costs and utility values, respectively.

Figure 4:Individual supply and demand curves of the two generators and two loads of Example 2, showing their optimal costs and utility values, respectively.

Aggregated supply and demand curves of the two generators and two loads of Example 2, respectively, showing the resulting market-clearing price and quantity.

Figure 5:Aggregated supply and demand curves of the two generators and two loads of Example 2, respectively, showing the resulting market-clearing price and quantity.

Table 1:Optimal cost, utility, and welfare of Example 2.

CostUtilityProducer SurplusConsumer SurplusWelfare
CG1=$12.0/hC_\mathrm{G1} = \$12.0 / \mathrm{h}UL1=$52.0/hU_\mathrm{L1} = \$52.0 / \mathrm{h}SG1=$12.0/hS_\mathrm{G1} = \$12.0 / \mathrm{h}SL1=$15.0/hS_\mathrm{L1} = \$15.0 / \mathrm{h}
CG2=$20.0/hC_\mathrm{G2} = \$20.0 / \mathrm{h}UL2=$27.0/hU_\mathrm{L2} = \$27.0 / \mathrm{h}SG2=$0.0/hS_\mathrm{G2} = \$ 0.0 / \mathrm{h}SL2=$20.0/hS_\mathrm{L2} = \$20.0 / \mathrm{h}
Total:$32.0/h \$32.0 / \mathrm{h}$79.0/h \$79.0 / \mathrm{h}$12.0/h \$12.0 / \mathrm{h}$35.0/h \$35.0 / \mathrm{h}$47.0/h\$47.0 / \mathrm{h}

In the next section, we will see that the optimization cannot always be solved by splicing the generators’ and loads’ price-quantity pairs into one supply curve and one demand curve.

The Market Network

Watch Part III

We have established that for a given market, at a given time, there is one market price. However, the electrical grid is complex—more complex than this (Figure 6). For the purposes of market modeling, the grid consists of multiple pricing locations/nodes, each of which has its own market price and in that sense acts like a market. Such a setup is called nodal pricing or locational marginal pricing (LMP).

Sometimes the pricing nodes are organized into larger zones for simplicity and one price is set throughout each zone. Such a setup is called zonal pricing.

Grid infrastructure spanning Michigan, Ontario, and New York state. Copyright OpenStreetMap and Open Infrastructure Map (https://www.openstreetmap.org/copyright, https://openinframap.org/copyright).

Figure 6:Grid infrastructure spanning Michigan, Ontario, and New York state. Copyright OpenStreetMap and Open Infrastructure Map (https://www.openstreetmap.org/copyright, https://openinframap.org/copyright).

Each node is analogous to one neighborhood of cafés. But, of course, the grid is an electrical network, and power can be transferred between its nodes through long-distance transmission and distribution lines. This is as if the neighborhoods of cafés were interconnected by an intricate network of pipes! Like electricity, espresso wouldn’t even have to be made in the neighborhood in which it is consumed, and supply does not need to equal demand within a grid node. Because quantities of power can be traded between grid nodes, the entire grid must be cleared as one market to maximize the system-wide welfare W ⁣W\!. The total welfare is generally higher with trade than without, which is why trade takes place.

However, the network is leaky. Transmission and distribution lines are not ideal wires and have electrical resistance depending on their type and length. Thus, some power is lost to heat for each unit of power transferred. These transmission losses are analogous to a cost of trade between grid nodes. Power transfer between nodes is still usually necessary and beneficial. For example, it is likely to be cheaper to use nuclear power transmitted over a great distance, with some lost along the way, than to use power from a nearby gas-fired plant. We need a way to model and account for the costs of trade when clearing the market, as they will affect the optimal quantities of power and cause prices to differ between nodes. In general, each node affects all other nodes.

For the sake of simplicity when demonstrating the effect of transmission losses on the electricity market, we will assume a given transmission line to have a fixed efficiency, η\eta:

η=power outpower in=1−power lostpower in\eta = \frac{\text{power out}}{\text{power in}} = 1 - \frac{\text{power lost}}{\text{power in}}

Losing some power to heat isn’t just disadvantageous because it’s wasteful. As transmission lines heat up, they expand, elongate, and sag. If a transmission line were to sag too close to a nearby object (such as a tree), electricity will arc to the object and cause a short circuit, requiring the line to be immediately disconnected from the rest of the grid. To avoid this situation, lines are rated for a maximum electric current or power based on how quickly they can dissipate heat, just like the wiring in your home. When a line is operating at maximum power, it is said to be congested. A congested line limits the amount of electricity that can be traded between grid nodes, requiring electricity to be sourced from other generators that are potentially more expensive, and delivered to other loads that might not be willing to pay as much. Like transmission losses, transmission congestion contributes to price differences between grid nodes.

Let’s first look at an example of how transmission losses alone affect the market, then add in the effect of transmission congestion.

Example 3: One Generator Node, One Load Node

Recall the previous section’s example of two generators and two loads. Consider now that the generators G1\mathrm{G1} and G2\mathrm{G2} are located at a node A\mathrm{A}, and that the two loads L1\mathrm{L1} and L2\mathrm{L2} are located at a node B\mathrm{B}. The two nodes are connected by a transmission line with 75% efficiency. This is an unrealistically poor efficiency, for illustrative purposes. The optimization problem becomes maximizing W ⁣W\! subject to the constraint that the total quantity bought, QLQ_\mathrm{L}, must equal 75% of the total quantity sold, QGQ_\mathrm{G}, meaning that for every 1 MW generated, only 0.75 MW are delivered to the load, the rest being lost to heat. This is a linear constraint, but would be quadratic if modeling the line’s electrical resistance. Of the two quantities QGQ_\mathrm{G} and QLQ_\mathrm{L}, either can be chosen as the optimization problem’s sole decision variable, from which the other quantity can be calculated via the efficiency.

The solution to the example at hand is QG∗=9.3ˉ MWQ_\mathrm{G}^* = 9.\bar{3} \ \mathrm{MW}, QL∗=7 MWQ_\mathrm{L}^* = 7 \ \mathrm{MW}, PA∗=$4/MWhP_\mathrm{A}^* = \$4 / \mathrm{MWh}, and PB∗=$5.3ˉ/MWhP_\mathrm{B}^* = \$5.\bar{3} / \mathrm{MWh}. This is shown in Figure 7 and Figure 8. The optimal cost, utility, and welfare are tabulated in Table 2.

Network of Example 3.

Figure 7:Network of Example 3.

Determining the market-clearing prices and quantities for the two-node grid of Example 3.

Figure 8:Determining the market-clearing prices and quantities for the two-node grid of Example 3.

Table 2:Optimal cost, utility, and welfare of Example 3.

CostUtilityProducer SurplusConsumer SurplusWelfare
CG1=$12.0/hC_\mathrm{G1} = \$12. 0 / \mathrm{h}UL1=$32.0/hU_\mathrm{L1} = \$32.0 / \mathrm{h}SG1=$12.0/hS_\mathrm{G1} = \$12.0 / \mathrm{h}SL1=$11.0/hS_\mathrm{L1} = \$11. 0 / \mathrm{h}
CG2=$13.3ˉ/hC_\mathrm{G2} = \$13.\bar{3} / \mathrm{h}UL2=$27.0/hU_\mathrm{L2} = \$27.0 / \mathrm{h}SG2=$0.0/hS_\mathrm{G2} = \$ 0.0 / \mathrm{h}SL2=$10.6ˉ/hS_\mathrm{L2} = \$10.\bar{6} / \mathrm{h}
Total:$25.3ˉ/h \$25.\bar{3} / \mathrm{h}$59.0/h \$59.0 / \mathrm{h}$12.0/h \$12.0 / \mathrm{h}$21.6ˉ/h \$21.\bar{6} / \mathrm{h}$33.6ˉ/h\$33.\bar{6} / \mathrm{h}

Notice how the welfare has decreased from $47.0/h\$47.0 / \mathrm{h} in Example 2 to $33.6ˉ/h\$33.\bar{6} / \mathrm{h} in this example. The $13.3ˉ/h\$13.\bar{3} / \mathrm{h} difference is the cost of having to transfer power between the generator and load nodes via lossy transmission lines. In this example, the producer surplus happened to stay the same ($12.0/h\$12.0 / \mathrm{h}) while the consumers’ surpluses decreased with the introduction of transmission losses. So, in this example, only the consumers incurred the cost of trade. However, in general, the cost of trade is paid by both producers and consumers. This does not mean that trade is not worthwhile. On the contrary—in this example, transmission lines allowed the generator and load to find each other, and trade in general provides more optimal buying and selling opportunities for market participants.

Example 3 with Transmission Congestion

Now assume that the transmission line between nodes A\mathrm{A} and B\mathrm{B} has an 8-MW\mathrm{MW} limit, which is lower than the optimal power injection of QG∗=9.3ˉ MWQ_\mathrm{G}^* = 9.\bar{3} \ \mathrm{MW} that was previously determined for the line. With transmission congestion, the solution is now QG∗=8 MWQ_\mathrm{G}^* = 8 \ \mathrm{MW}, QL∗=6 MWQ_\mathrm{L}^* = 6 \ \mathrm{MW}, PA∗=$4/MWhP_\mathrm{A}^* = \$4 / \mathrm{MWh}, and PB∗=$8/MWhP_\mathrm{B}^* = \$8 / \mathrm{MWh}. This is shown in Figure 9. The welfare is now $31/h\$31 / \mathrm{h}, which is $2.6ˉ/h\$2.\bar{6} / \mathrm{h} lower than in the non-congested case. Indeed, congested lines generally reduce the system welfare and affect the nodal prices, this example being no exception. In this example, the loads pay QL∗PB∗=$48/hQ_\mathrm{L}^* P_\mathrm{B}^* = \$48 / \mathrm{h} but the generators are paid only QG∗PA∗=$32/hQ_\mathrm{G}^* P_\mathrm{A}^* = \$32 / \mathrm{h}. This difference is known as congestion rent, and is collected by the system operator. Brown, 2025

Determining the market-clearing prices and quantities for the two-node grid of Example 3 with a congested 8-MW line.

Figure 9:Determining the market-clearing prices and quantities for the two-node grid of Example 3 with a congested 8-MW line.

Example 4: One Generator Node, One Combined Generator/Load Node

Now consider that only generator G1\mathrm{G1} is located at node A\mathrm{A}, while generator G2\mathrm{G2} and both loads are located at node B\mathrm{B}. The optimization problem becomes maximizing W ⁣W\! subject to the constraint that 0.75 QG1+QG2=QL0.75 \, Q_\mathrm{G1} + Q_\mathrm{G2} = Q_\mathrm{L}. Any two of these three quantities can be chosen as the decision variables; we will use QG2Q_\mathrm{G2} and QLQ_\mathrm{L} arbitrarily. The optimization problem is then:

 ⁣ ⁣max⁡QG2, QLW(QG2,QL)subject to0.75 QG1+QG2=QL\begin{aligned} & \!\! \max_{Q_\mathrm{G2}, \, Q_\mathrm{L}} W(Q_\mathrm{G2}, Q_\mathrm{L}) \\ & \text{subject to} \quad 0.75 \, Q_\mathrm{G1} + Q_\mathrm{G2} = Q_\mathrm{L} \end{aligned}

We can visualize this optimization problem as the 3D surface shown in Figure 10. The parallelogram shape of the surface as viewed from above in Figure 10(b) is determined by the above constraint and by the bounds 0<QG2<10 MWh0 < Q_\mathrm{G2} < 10 \ \mathrm{MWh}.

Determining the market-clearing quantities Q_\mathrm{G2} and Q_\mathrm{L} that maximize W\! in Example 4.

Figure 10:Determining the market-clearing quantities QG2Q_\mathrm{G2} and QLQ_\mathrm{L} that maximize W ⁣W\! in Example 4.

The solution to the example at hand is QG2∗=6.5 MWQ_\mathrm{G2}^* = 6.5 \ \mathrm{MW}, QL∗=11 MWQ_\mathrm{L}^* = 11 \ \mathrm{MW}, and QG1∗=6 MWQ_\mathrm{G1}^* = 6 \ \mathrm{MW}. The market-clearing prices at the two nodes are P ⁣A∗=$3/MWhP_{\! \mathrm{A}}^* = \$3 / \mathrm{MWh} and P ⁣B∗=$4/MWhP_{\! \mathrm{B}}^* = \$4 / \mathrm{MWh}. This is shown in Figure 11 and Figure 12.

Network of Example 4.

Figure 11:Network of Example 4.

Individual supply and demand curves of generator \mathrm{G1} (at node \mathrm{A}) and generator \mathrm{G2}, load \mathrm{L1}, and load \mathrm{L2} (at node \mathrm{B}) of Example 4, showing the resulting market-clearing prices and quantities.

Figure 12:Individual supply and demand curves of generator G1\mathrm{G1} (at node A\mathrm{A}) and generator G2\mathrm{G2}, load L1\mathrm{L1}, and load L2\mathrm{L2} (at node B\mathrm{B}) of Example 4, showing the resulting market-clearing prices and quantities.

Higher-Dimensional Optimization Problems

The optimization problem of Example 4 could be formulated with as few as two decision variables, meaning that it can still be visualized easily and solved by brute force practically. However, a real electrical grid can have hundreds or thousands of nodes and decision variables, so an optimization algorithm must be used.

Optimization algorithms often require or perform better when the objective function—WW in our case—is a linear function of the decision variables. However, as can be seen in Figure 8 and Figure 10, WW is only a piecewise linear function of the decision variables. WW can be made into an entirely linear function by breaking down the decision variables QG1Q_\mathrm{G1}, QG2Q_\mathrm{G2}, and QLQ_\mathrm{L} into a decision variable for each nonzero price-quantity pair, as shown in Figure 13.

Reformulating the optimization problem of Example 4 with one decision variable for each step in the generators’ and loads’ supply and demand “staircases”.

Figure 13:Reformulating the optimization problem of Example 4 with one decision variable for each step in the generators’ and loads’ supply and demand “staircases”.

This is essentially breaking up the piecewise supply and demand curves into their constituent pieces, with one piece for each nonzero price-quantity pair. You may be concerned that this discards the price-based sort order of the pieces (ascending price for supply, descending price for demand), but it doesn’t. The maximization of WW will inherently maintain the sort order for each supply and demand curve. For example, QG1,1Q_\mathrm{G1,1} will be dispatched up to its maximum of 6.0 MW6.0 \ \mathrm{MW} before QG2,1Q_\mathrm{G2,1} is dispatched at 6.5 MW6.5 \ \mathrm{MW} because the former quantity is the cheapest (at $2.0/MWh\$2.0 / \mathrm{MWh}) and the latter quantity is the next-cheapest (at $4.0/MWh\$4.0 / \mathrm{MWh}).

Balancing Power Supply and Demand

We previously mentioned that supply always equals demand in the electricity market. Indeed, according to the law of conservation of energy, the power flowing into the grid equals the power flowing out of the grid at any given time. However, we just said that a system operator is responsible for balancing power supply and demand in the grid. Furthermore, if you are already familiar with the electrical grid and electricity market, you will often hear about balance or imbalance between power supply and demand, even though an imbalance between power in and power out is not technically possible. So, what do people really mean when they talk about imbalance between supply and demand in the grid? To answer this question, we must first understand some nuances of how the grid works.

The power transferred in the grid is driven by AC voltage, which oscillates approximately 50 or 60 times a second depending on the country. This rate of oscillation is called the grid’s frequency, and is measured in hertz (Hz). A lot of equipment connected to the grid requires a frequency very close to 50 or 60 Hz.

Most generators in the grid are synchronous electric generators spun by a turbine—a water turbine in a hydroelectric power station, a gas turbine in a gas power station, or a steam turbine in a nuclear or coal power station. The turbine must be fed with water, steam, or burning gas at a certain rate to produce a certain power output via the generator. Furthermore, a synchronous generator must be spun at a certain speed to generate AC voltage at the required frequency. A synchronous generator naturally rotates at a speed corresponding to the frequency of the grid to which it is connected. It will be important to know that a synchronous generator, like any moving object, inherently stores some kinetic energy while in operation, like a flywheel.

Consider the situation where one of the grid’s generators has just turned off, or where more load is suddenly connected to the grid. More power must instantly be supplied to the grid such that supply continues to exactly meet demand. At first, this extra power is supplied by the grid’s synchronous generators—but not by consuming more water, steam, or gas. Instead, the grid’s synchronous generators will start slowing down at a steady rate, releasing their inherent kinetic energy and converting it to the extra power required. Synchronous generators do this immediately and naturally, due to the laws of physics rather than human intervention. This behavior of synchronous generators is called inertial response and applies just as well if load is suddenly disconnected from the grid, in which case the grid’s synchronous generators will start speeding up to absorb the sudden surplus of power. The surplus powers the generator like a motor.

You may be wondering what happens when the generator spins down to zero. Don’t bother. There would be a blackout well before that occurs. The inertial response helps to balance supply and demand, but at a cost. As the grid’s generators speed up or slow down to absorb to release power as required, the grid’s frequency increases or decreases. However, grid-connected equipment often requires a grid frequency within a very specific range. The inertial response only grants the system operator a few precious seconds in which to properly adjust power generation by adjusting the rate at which water, steam, or gas is consumed. If this rate cannot be increased because all the grid’s generators are already operating at maximum power, then the system operator must curtail or shed load.

In the café analogy, customers are picky. The inertial response would be equivalent to baristas re-using coffee grounds to save time while serving a sudden influx of customers. Disgusting! Cafés must handle an influx of customers by paying their baristas more to work faster—i.e., by operating synchronous generators at a higher power setting—or by utilizing additional baristas and espresso machines—i.e., by turning on additional generators. If the cafés are already pushed to their limit, they must turn some customers away rather than continue to serve terrible-quality espresso.

So, it is appropriate (if not slightly misleading terminology) to talk about balance or imbalance between power supply and demand. What people really mean when they say that supply is not meeting electricity market demand is that the power being generated apart from the inertial response is not meeting demand. Discussing imbalance is the same as discussing under- or over-frequency.

References
  1. Brown, F., Tom; Neumann. (2025). Energy Systems, Summer Semester 2025 – Lecture 9: Complex Markets. Department of Digital Transformation in Energy Systems, Institute of Energy Technology, Technische Universität Berlin. https://nworbmot.org/courses/es-25/es-9-complex_markets.pdf