Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modulation level detection #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions notebooks/Modulation Detection.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Intro\n",
"\n",
"Some condensing gas boilers have the ability to *modulate*, this means that they can adjust the power of the burn. In short: while heating a building, the boiler will start of at maximum power and will gradually lower the power as the temperature of the water in the pipes rises. This allows the boiler to burn longer, at a higher efficiency. (gas boilers are more efficient at lower power)\n",
"\n",
"If you know a boiler has the capability of modulation, you can increase the efficiency ever further by adjusting the settings so it only starts its burn at a lower power. However it takes longer to get the building up to temperature. You can set your thermostat so it starts the heating cycle earlier, or a smart thermostat will automatically do this for you.\n",
"\n",
"The aim of this analysis is to use detailed gas consumption data to detect the power level at which a certain gas boiler modulates."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import opengrid as og\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt = og.plot_style()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test Dataset\n",
"\n",
"We have a large (1 month) dataset of gas consumption in 30 second resolution. If you take a closer look, you can see that a gas cycle consists of a peak, after which the boiler immediately lowers its power. We want to determine this level."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ts = og.datasets.get('gas_012017_30s')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ts_zoom = ts.truncate(before=pd.Timestamp('20170101'), after=pd.Timestamp('201701010700'))\n",
"_ = ts_zoom.plot()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Find modulation levels"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ml = og.analysis.modulation_detection(ts)\n",
"print(ml)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You get two values, the median modulation level, and the minimum modulation level.\n",
"\n",
"The median is most useful for further analysis. The minimum can be useful to cut of a curve, where the remainder would be \"all the gas that is used by the boiler\"."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ts_zoom.plot()\n",
"pd.Series(index=ts_zoom.index, data=[ml.median], name='median').plot()\n",
"pd.Series(index=ts_zoom.index, data=[ml.minimum], name='minimum').plot()\n",
"_ = plt.legend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To interpret the result even further it is useful to look at the load duration curve. Notice that the median sits right on the \"plateau\", while the minimum sits just below the knee."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ld = og.analysis.load_duration(ts)\n",
"ld.plot()\n",
"pd.Series(index=ld.index, data=[ml.median], name='median').plot()\n",
"pd.Series(index=ld.index, data=[ml.minimum], name='min').plot()\n",
"_ = plt.legend()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}