In [1]:
# Import Modules
import numpy as np
import pulp
from pyspd import *
In [2]:
# Define a System Operator
operator = SystemOperator()
# Two Reserve Zones
north_island = ReserveZone("NorthIsland", operator)
south_island = ReserveZone("SouthIsland", operator)
# Define a company of interest
meridian = Company("Meridian")
# I typically define what I'm holding constant as the market
market = Company("Market")
# Define two nodes, benmore and Haywards
benmore = Node("Benmore", operator, south_island, demand=140)
haywards = Node("Haywards", operator, north_island, demand=150)
# Define a Transmission link, make it a risk setter
hvdc = Branch(operator, benmore, haywards, capacity=1000, risk=True)
In [3]:
# Define two stations and two interruptible load providers.
manapouri = Station("Manapouri", operator, benmore, meridian, capacity=400)
roxburgh = Station("Roxburgh", operator, benmore, market, capacity=400)
tiwai = InterruptibleLoad("Tiwai", operator, benmore, market)
nzst = InterruptibleLoad("NZST", operator, haywards, market)
In [4]:
# Manapouri offers
manapouri.add_reserve_offer(100, 300, 1.0)
manapouri.add_energy_offer(25, 125)
# Roxburgh
roxburgh.add_energy_offer(30, 250)
roxburgh.add_reserve_offer(15, 100, 1)
# Tiwai and NZST
tiwai.add_reserve_offer(15, 80)
nzst.add_reserve_offer(150, 500)
Out[4]:
In [5]:
# Vary the reserve price at Manapouri between 0 and 200 (the 210 won't be included)
# Vary in increments of $10/MWh
operator.create_iterator(manapouri, "energy_price", np.arange(0, 100, 10))
Out[5]:
In [6]:
# Create the Solver
lpsolver = SPDModel(operator)
# Solve the LP
lpsolver.full_run()
# Create an Analytics Function (Yes I know this is convoluted)
ana = Analytics(lpsolver)
In [7]:
ana.create_dispatch_df()
ana.final_dispatch_df
Out[7]:
In [8]:
ana.create_price_df()
ana.final_price_df
Out[8]:
In [9]:
ana.create_reserve_df()
ana.reserve_df
Out[9]:
In [14]:
# Show the increase in the South Island Reserve Price as a function of the Manapouri Energy price
ana.reserve_df["SouthIsland Reserve Price"].plot()
Out[14]:
In [22]:
# Manapouri
ana.create_master()
manapouri.calculate_profits()
manapouri.total_profit.plot()
Out[22]:
In [23]:
roxburgh.calculate_profits()
roxburgh.total_profit.plot()
Out[23]: