<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bertill Browne, Author at Be on the Right Side of Change</title>
	<atom:link href="https://blog.finxter.com/author/bertillbrowne/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.finxter.com/author/bertillbrowne/</link>
	<description></description>
	<lastBuildDate>Fri, 10 Sep 2021 10:52:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>

<image>
	<url>https://blog.finxter.com/wp-content/uploads/2020/08/cropped-cropped-finxter_nobackground-32x32.png</url>
	<title>Bertill Browne, Author at Be on the Right Side of Change</title>
	<link>https://blog.finxter.com/author/bertillbrowne/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Plotting a Load-Duration Curve with Python</title>
		<link>https://blog.finxter.com/plotting-a-load-duration-curve-with-python/</link>
		
		<dc:creator><![CDATA[Bertill Browne]]></dc:creator>
		<pubDate>Fri, 10 Sep 2021 10:36:27 +0000</pubDate>
				<category><![CDATA[Data Science]]></category>
		<category><![CDATA[Data Visualization]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Matplotlib]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=34985</guid>

					<description><![CDATA[<p>You can check out the code in this article in the interactive Jupyter notebook here (Google Colab). Introduction A popular query in Google is about load-duration curves. Some of the questions are: What is a load-duration curve? What is the importance of a load-duration curve? How do you calculate a load-duration curve? What is the ... <a title="Plotting a Load-Duration Curve with Python" class="read-more" href="https://blog.finxter.com/plotting-a-load-duration-curve-with-python/" aria-label="Read more about Plotting a Load-Duration Curve with Python">Read more</a></p>
<p>The post <a href="https://blog.finxter.com/plotting-a-load-duration-curve-with-python/">Plotting a Load-Duration Curve with Python</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">You can check out the code in this article in <a href="https://colab.research.google.com/drive/1utPQR3p8WQvwTFetMpmsvILD8FYW6WcT?usp=sharing" target="_blank" rel="noreferrer noopener" title="https://colab.research.google.com/drive/1utPQR3p8WQvwTFetMpmsvILD8FYW6WcT?usp=sharing">the interactive Jupyter notebook here</a> (Google Colab).</p>



<figure class="wp-block-image size-large"><a href="https://colab.research.google.com/drive/1utPQR3p8WQvwTFetMpmsvILD8FYW6WcT?usp=sharing" target="_blank" rel="noopener"><img fetchpriority="high" decoding="async" width="1024" height="335" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-22-1024x335.png" alt="" class="wp-image-35002" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-22-1024x335.png 1024w, https://blog.finxter.com/wp-content/uploads/2021/09/image-22-300x98.png 300w, https://blog.finxter.com/wp-content/uploads/2021/09/image-22-768x251.png 768w, https://blog.finxter.com/wp-content/uploads/2021/09/image-22-1536x503.png 1536w, https://blog.finxter.com/wp-content/uploads/2021/09/image-22.png 1872w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<h2 class="wp-block-heading">Introduction</h2>



<p class="wp-block-paragraph">A popular query in Google is about <strong><em>load-duration curves</em></strong>. Some of the questions are:</p>



<ol class="wp-block-list" type="1"><li>What is a load-duration curve?</li><li>What is the importance of a load-duration curve?</li><li>How do you calculate a load-duration curve?</li><li>What is the shape of a load-duration curve?</li><li>How to plot a load-duration curve?</li></ol>



<p class="wp-block-paragraph">This article will address these questions from the perspective of the electric power industry, with which I am familiar. It will also show how to calculate and <a href="https://blog.finxter.com/best-matplotlib-cheat-sheet/" title="Best Matplotlib Cheat Sheet" target="_blank" rel="noreferrer noopener">plot </a>a load-duration curve using <a href="https://blog.finxter.com/python-crash-course/" target="_blank" rel="noreferrer noopener" title="Python Programming Tutorial [+Cheat Sheets]">Python </a>and its <a href="https://blog.finxter.com/numpy-tutorial/" target="_blank" rel="noreferrer noopener" title="NumPy Tutorial – Everything You Need to Know to Get Started">NumPy</a>, <a href="https://blog.finxter.com/pandas-quickstart/" target="_blank" rel="noreferrer noopener" title="10 Minutes to Pandas (in 5 Minutes)">Pandas</a>, and <a href="https://blog.finxter.com/heatmaps-with-seaborn/" target="_blank" rel="noreferrer noopener" title="Creating Beautiful Heatmaps with Seaborn">Seaborn </a>modules.</p>



<h2 class="wp-block-heading">What is a Load-Duration Curve?</h2>



<p class="wp-block-paragraph">A load-duration curve is a plot of an electrical system’s load (demand), in units of power versus the percentage of the time for which this load or a load is greater than it existed. The load is plotted on the y-axis and the percentage of time on the x-axis. The load is not plotted in chronological order but in descending order of magnitude.</p>



<h2 class="wp-block-heading">The Shape of a Load-Duration Curve</h2>



<p class="wp-block-paragraph">The highest load is on the left of the graph, with the load decreasing towards the right and the lowest load on the far right. The resulting curve, therefore, slopes downward from the maximum load to the minimum load and is generally shaped like a reverse sigmoid function ()).</p>



<h2 class="wp-block-heading">The Importance of a Load-Duration Curve</h2>



<p class="wp-block-paragraph">Load-duration curves are plotted for daily, weekly, or annual periods and are used to conduct technical and economic analyses of an electrical system. It presents load information in an intuitive form and can be used to determine the maximum load and its duration.</p>



<p class="wp-block-paragraph">They can be used to determine the duration of a specific load, that is, the amount of time that a load was equal to or greater than a particular value. Therefore, it can be used to determine the amount of time that various generating capacities must be available. The load is greater than or equal to the minimum load 100 percent of the time. This minimum load is referred to as the baseload. The capacity to meet this load must be always available. The area under the curve represents the total energy generated in this period.</p>



<h2 class="wp-block-heading">&nbsp;How to Plot a Load-Duration Curve</h2>



<p class="wp-block-paragraph">Electric utilities usually record the system load at hourly intervals. This data can be used to develop the load duration for a selected period. The loads for each recording interval are sorted in descending order of magnitude and multiplied by the percentage of the period that the load was equal to or above this value. The load is then plotted on the y-axis and the percentage of time that it was equal to or above that value on the x-axis.</p>



<h2 class="wp-block-heading">Plotting a Load-Duration Curve Using Python</h2>



<p class="wp-block-paragraph">The above procedure is illustrated using a Google Collaboratory Notebook, using Python and its <a href="https://blog.finxter.com/numpy-tutorial/" target="_blank" rel="noreferrer noopener" title="NumPy Tutorial – Everything You Need to Know to Get Started">NumPy</a>, <a href="https://blog.finxter.com/matplotlib-full-guide/" target="_blank" rel="noreferrer noopener" title="Matplotlib — A Simple Guide with Videos">Matplotlib</a>, <a href="https://blog.finxter.com/the-pandas-plotting-module-generating-andrews-curves/" target="_blank" rel="noreferrer noopener" title="The Pandas Plotting Module: Generating Andrews Curves">Pandas</a>, and <a href="https://blog.finxter.com/how-to-change-the-figure-size-for-a-seaborn-plot/" target="_blank" rel="noreferrer noopener" title="How to Change the Figure Size for a Seaborn Plot?">Seaborn </a>modules. This will be done using made-up data. For brevity, a period of one day will be used. However, the period could be a week, a month, or a year.</p>



<p class="wp-block-paragraph">In the first cell, the required modules were loaded. The data are then loaded. These can be loaded from <code>*.csv</code> or Excel files or databases. For this illustration, a <a href="https://blog.finxter.com/python-dictionary/" target="_blank" rel="noreferrer noopener" title="Python Dictionary – The Ultimate Guide">Python dictionary</a> data structure was used. The loads and the hour at which they occurred were put in a dictionary as shown in the second cell below.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#load the required modules
import numpy
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sb</pre>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img decoding="async" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-13.png" alt="" class="wp-image-34986" width="624" height="59" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-13.png 624w, https://blog.finxter.com/wp-content/uploads/2021/09/image-13-300x28.png 300w" sizes="(max-width: 624px) 100vw, 624px" /></figure></div>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># initialise a dictionary with the load data.
load_data = {'Hour':[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], 'Load':[39.0, 39.2, 37.6, 36.8, 36.4, 36.2, 37.4, 41.4, 45.6, 48.8, 53.0, 53.6, 53.2, 54.0, 53.8, 52.8, 50.8, 44.4, 46.8, 47.4, 46.4, 44.0, 42.4, 40.6]}
print(load_data)</pre>



<div class="wp-block-image"><figure class="aligncenter size-full"><img decoding="async" width="624" height="64" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-14.png" alt="" class="wp-image-34987" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-14.png 624w, https://blog.finxter.com/wp-content/uploads/2021/09/image-14-300x31.png 300w" sizes="(max-width: 624px) 100vw, 624px" /></figure></div>



<p class="wp-block-paragraph">In the next cell, the dictionary is converted to a <a href="https://blog.finxter.com/how-to-create-a-dataframe-in-pandas/" target="_blank" rel="noreferrer noopener" title="How to Create a DataFrame in Pandas?">Pandas DataFrame</a> with the <em>hour</em> and <em>load </em>as columns. A graph of the load versus the hour is plotted using the <code>lineplot()</code> function of the Seaborn module. The load, in this case, is in chronological order and the graph is known as a (daily) load profile.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Convert dictionary to DataFrame and print it
load_df = pd.DataFrame(load_data)
print(load_df)</pre>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="624" height="264" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-15.png" alt="" class="wp-image-34988" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-15.png 624w, https://blog.finxter.com/wp-content/uploads/2021/09/image-15-300x127.png 300w" sizes="auto, (max-width: 624px) 100vw, 624px" /></figure></div>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Plot the load profile

sb.set(rc={"figure.figsize":(10, 7)})
p = sb.lineplot(x = "Hour", y = "Load", data = load_df)

plt.ylim(0, None)
plt.xlim(0, None)

p.set_title("Load Profile", fontsize = 30)
p.set_xlabel("Time (Hrs)", fontsize = 20)
p.set_ylabel("Load (MW)", fontsize = 20)

plt.show()</pre>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="624" height="352" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-16.png" alt="" class="wp-image-34989" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-16.png 624w, https://blog.finxter.com/wp-content/uploads/2021/09/image-16-300x169.png 300w" sizes="auto, (max-width: 624px) 100vw, 624px" /></figure></div>



<p class="wp-block-paragraph">The next step is to add a column with the time interval for which the loads were recorded. In this case, the loads were recorded in one-hour intervals.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Add a column for the time interval for which the loads were recorded
load_df['interval'] = 1
print(load_df)</pre>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="624" height="277" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-17.png" alt="" class="wp-image-34990" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-17.png 624w, https://blog.finxter.com/wp-content/uploads/2021/09/image-17-300x133.png 300w" sizes="auto, (max-width: 624px) 100vw, 624px" /></figure></div>



<p class="wp-block-paragraph">The next step is to rearrange the loads from being in chronological order to one of descending order of magnitude. This is done by sorting the DataFrame by the load column using the <code>sort_values()</code> function with the ascending parameter set to <code>False</code>. The <a href="https://blog.finxter.com/python-print/" target="_blank" rel="noreferrer noopener" title="Python print()">printout </a>of the DataFrame confirms that the loads are now in descending order of magnitude.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Sort the DataFrame by the loads, in descending order of magnitude
load_df_sorted = load_df.sort_values(by=['Load'], ascending = False)
print(load_df_sorted) </pre>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="624" height="282" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-18.png" alt="" class="wp-image-34991" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-18.png 624w, https://blog.finxter.com/wp-content/uploads/2021/09/image-18-300x136.png 300w" sizes="auto, (max-width: 624px) 100vw, 624px" /></figure></div>



<p class="wp-block-paragraph">The next step is to add a column with the amount of time the system load was equal to or greater than the load in each row of the DataFrame. This is achieved by applying the <code><a href="https://blog.finxter.com/numpy-cumsum/" target="_blank" rel="noreferrer noopener" title="The Ultimate Guide to NumPy Cumsum in Python">cumsum()</a></code> function to the interval column and assigning the results to a new column name duration. The <code>cumsum()</code> function calculates the cumulative sum over an axis of a Pandas DataFrame. In this case, it’s over the column axis. The printout verifies that the operation was successful.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Use the cumsum() function to to add a column with the duration 
# for which the system load is greater than or equal to each load
load_df_sorted['duration'] = load_df_sorted['interval'].cumsum()
print(load_df_sorted)</pre>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="624" height="276" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-19.png" alt="" class="wp-image-34992" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-19.png 624w, https://blog.finxter.com/wp-content/uploads/2021/09/image-19-300x133.png 300w" sizes="auto, (max-width: 624px) 100vw, 624px" /></figure></div>



<p class="wp-block-paragraph">The x-axis of the load duration curve is expressed as a percentage of the total time. So, the next step is to add a column with the duration expressed as a percentage of the total time. This is done in the next cell with the result printed out.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Calculate the percentage of time for which 
# the system load is greater than or equal to each load
load_df_sorted['percentage'] = load_df_sorted['duration']*100/24
print(load_df_sorted)</pre>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="624" height="275" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-20.png" alt="" class="wp-image-34993" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-20.png 624w, https://blog.finxter.com/wp-content/uploads/2021/09/image-20-300x132.png 300w" sizes="auto, (max-width: 624px) 100vw, 624px" /></figure></div>



<p class="wp-block-paragraph">It’s now time to plot the load duration curve. As was done for the load profile, it was plotted using the <code>lineplot()</code> function of the Seaborn module. The load is on the y-axis and the percentage on the x-axis. The plot shows a curve that slopes downward from the maximum load to the minimum load and has some resemblance to a reverse sigmoid curve.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Plot the load_duration curve (Load vs Percentage of time)
p = sb.lineplot(x = "percentage", y = "Load", data = load_df_sorted)

plt.ylim(0, None)
plt.xlim(0, None)

p.set_title("Load-Duration Curve", fontsize = 30)
p.set_xlabel("Time (%)", fontsize = 20)
p.set_ylabel("Load (MW)", fontsize = 20)

plt.show()</pre>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="624" height="346" src="https://blog.finxter.com/wp-content/uploads/2021/09/image-21.png" alt="" class="wp-image-34994" srcset="https://blog.finxter.com/wp-content/uploads/2021/09/image-21.png 624w, https://blog.finxter.com/wp-content/uploads/2021/09/image-21-300x166.png 300w" sizes="auto, (max-width: 624px) 100vw, 624px" /></figure></div>



<h2 class="wp-block-heading">Closing Comments</h2>



<p class="wp-block-paragraph">Having read this article, you now know what a load duration curve is, its importance, how it is calculated, its <a href="https://blog.finxter.com/np-shape/" target="_blank" rel="noreferrer noopener" title="np.shape()">shape</a>, and how to plot it using python and its NumPy, Pandas, and Seaborn modules. I hope that this article is a help to you.</p>



<p class="wp-block-paragraph">The full notebook with the code is available <a href="https://github.com/finxter/load_duration_curve/blob/main/load_duration.ipynb" target="_blank" rel="noreferrer noopener" title="https://github.com/finxter/load_duration_curve/blob/main/load_duration.ipynb">here</a>, on GitHub.</p>
<p>The post <a href="https://blog.finxter.com/plotting-a-load-duration-curve-with-python/">Plotting a Load-Duration Curve with Python</a> appeared first on <a href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: blog.finxter.com @ 2026-09-27 19:21:54 by W3 Total Cache
-->