Load Duration Curve#
A load duration curve shows the demand in relation to time. It is traditionally used in electric power system planning to assess the ideal generation portfolio.
1. Load packages
import pandas as pd
import numpy as np
# Import the necessaries libraries
import plotly.express as px
import plotly.offline as pyo
pyo.init_notebook_mode()
2. Read data
data_file = "caiso_load_2023_hourly.csv"
data_all = pd.read_csv(data_file)
3. Prepare data
load_chron = np.array(data_all["load.load"])
load_dur = np.flip(np.sort(load_chron))
net_load_chron = np.array(data_all["net_load"])
net_load_dur = np.flip(np.sort(net_load_chron))
data_plot = pd.DataFrame({
"datetime": pd.Series(pd.date_range(start='2023-01-01 01:00:00', end='2023-12-31 23:00:00', freq='h')),
"h_count": np.arange(1,len(load_dur)+1),
"load_chron": load_chron,
"load_dur": load_dur,
"net_load_chron": net_load_chron,
"net_load_dur": net_load_dur,
})
label_dict ={
"load_chron": "Load in MW",
"value": "Load in MW",
"datetime": "Timestamp",
"h_count": "Hour #"
}
4. Plot curves
First: chronologial load data \(x_i\)
Second: load duration durve with
fig = px.line(data_plot, x="datetime", y="load_chron", labels=label_dict)
fig.update_layout(
width=900,
height=600
)
fig.show()
fig = px.line(data_plot, x="h_count", y=["load_chron", "load_dur", "net_load_chron", "net_load_dur"], labels=label_dict)
fig.update_layout(
width=900,
height=600,
)
fig.update_traces(visible="legendonly")
fig.show()