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.

Power flow

Open in vLab iLab Assistant

SHOP implements PTDF-based power flow. The busbar and ac_line objects are used to specify the grid topology of the model. The following example demonstrates a simple model with power flow and thermal production units.

Set up model

First, we initialize the model

Add busbars and set the load. The load in busbar 1 is linearly increasing over time in this example, while all other input data is constant.

Then we define one thermal unit for each busbar and connect them. The marginal cost of the thermal units is equal to the fuel_cost in this case since n_segments is set to 1. Busbar 3 has the largest thermal unit, while busbar 1 has the cheapest one. Only a small and expensive unit is located in busbar 2.

There are three AC lines that connect the busbars, and there is no power loss in the transmission. The AC line connecting busbar 2 and 3 has the lowest transmission capacity, which is specified in both directions by the max_forward_flow and max_backward_flow attributes. Note that the positive (forward) flow direction on each line is determined by the connections between the busbar and ac_line objects.

Create AC lines and connect between buses:

The we set the PTDF matrix that determines the flow on each line as a function of the net power injection in each busbar. Busbar 3 is chosen as the slack bus in this example, which means that the PTDF values for busbar 3 are all zero.

The grid topology with the PTDFs visualized for busbars 1 and 2 are shown in the figures below.

Grid topology with the PTDF for busbar 1 shown as red numbers.
Grid topology with the PTDF for busbar 2 shown as green numbers. Note that the PTDF for line 2 is negative due to the chosen positive line direction.

Run the model:

Results

First, we take a look at the production of each unit in the system. The cheapest unit located in busbar 2 does not operate at full capacity until 15 hours after optimization start, this is due to the transmission line constraints and PTDF values used in the example.

Loading...

The total net power injection in each busbar determines the flow on each line in combination with the PTDF matrix.

Loading...

The resulting flow on each power line is shown below. Note that the line between busbar 2 and 3 operates at full (reverse) capacity for all times.

Loading...

Finally, we can plot the dual value of the power balance in each busbar by retrieving the energy_price attribute, which represents the nodal price. Busbars 2 and 3 have a constant price equal to the marginal cost of their respective thermal units. This is also true for busbar 1 initially when its thermal unit operates below maximum capacity. From hour 15, the price in busbar 1 jumps up to 160 €/MWh, which is the average of the price in the other busbars. This is caused by the constrained line between busbar 2 and 3, which forces the increasing load in busbar 1 to be served by increasing the production of both the thermal unit in busbar 2 and 3 by the same amount. The marginal cost of increasing the load in busbar 1 is therefore 50% of the marginal cost of unit 2 plus 50% of the marginal cost of unit 3.

Loading...