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.

Marginal costs and optimal uploading

Open in vLab iLab Assistant

The model setup for this example is available in the following formats:

Introduction

The best profit (BP) functionality is the modern marginal cost and optimal plant uploading functionality in SHOP. The theory is described in more detail in the BP tutorial.

Run a standard optimization

First, a SHOP model with one plant with two equal generators and a second plant with one large and three small generators is built and optimized in the regular way:

Loading...
Loading...

Calculate best profit curves

After the optimization is done, the create bp_curves command is used to create marginal cost, average cost, and best profit curves for both plants. The calculation is done for the 72 first hours, specified in the call to the command. The option “production” is given to signal that the production results from the optimization should be used as the reference production when calculating the BP curve.

The BP curves for each time step has now been calculated and saved to the best_profit_mc attribute. The attribute is a XYT that holds the best profit curve for each time step where the x-values are the production levels and the y-values are the prices. The ref_prod timeseries shows the reference production for the plant in each time step.

Several unit_combination objects have been automatically created to hold the marginal cost (MC) curves and average cost (AC) curves of each generator combination that has been considered in the best profit calculation. Note that this includes the empty combination of no units running. The unit_combination objects are automatically connected to the plant object, and can be iterated over in pyshop as shown in the code below.

The BP curves for each plant in all hours are shown in the figures below, in addition to the MC and AC curves of each unit combination. Use the slider to change which hour to display. The BP curves follow the MC curves for different unit_combinations and jumps between them given certain criteria of always having a positive regulation profit, see the BP tutorial.

Loading...
Loading...

Optimal uploading

The attributes best_profit_p and best_profit_q on the generator object shows the optimal uploading of each generator in the BP calculations. Only the plant production levels on the final BP curve is included.

The figures below show the optimal uploading of both plants for the first hour of the BP calculation. Plant1 has identical generators, and is uploaded by first starting G1, then starting G2 and uploading the generators in tandem. Note that the production level of G1 is decreased when G2 is first started. On Plant2, we can see that it is best to regulate up the large generator G1 and turning on the identical G2, G3, and G4 as the plant production increases. The smaller generators are held on more or less the same production levels while the production on G1 is increased.

Loading...
Loading...

Finally, the reference plant production and price from the BP curve in each hour is plotted in 3D:

Loading...
Loading...