Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download

Jupyter notebook ETC/2016-03-25-drs-analysis.ipynb

Project: ETC Occupancy
Views: 61
Kernel: Anaconda (Python 3)

Carbon Dioxide Difference Analysis

We can infer the infiltration rate from the rate of carbon dioxide decrease.

Δ concentrationΔtâ‹…1outside concentration−inside concentration\frac{\Delta\ concentration}{\Delta t} \cdot \frac{1}{outside\ concentration - inside\ concentration}
#%matplotlib notebook %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd data = pd.read_csv('Indoor_3-3-2016.csv', skiprows=3, # ignore the first 3 rows of data sep=';', # semicolon is used to separate data values index_col=1, # use column 1 as the dates to index the data parse_dates=True) # convert the date string into a date object data.head()
inside_concentration = data['CO2'] concentration_slope = data['CO2'].diff()/data['Timestamp'].diff() concentration_slope = concentration_slope.where(concentration_slope<0, 0) infiltration_rate = concentration_slope/(inside_concentration - 400.)*3600 ax = infiltration_rate.plot() ax.set_ylim((-1,1)) ax.grid() data['CO2'].plot()
<matplotlib.axes._subplots.AxesSubplot at 0x7f6452693e10>
Image in a Jupyter notebook
infiltration_rate.describe()
count 216.000000 mean -0.122748 std 0.309181 min -3.177570 25% -0.106454 50% -0.073708 75% -0.038764 max 0.000000 dtype: float64
infiltration_rate.hist(bins=50)
TypeErrorTraceback (most recent call last) <ipython-input-12-8613ab9515bb> in <module>() ----> 1 -infiltration_rate.hist(bins=50) TypeError: bad operand type for unary -: 'AxesSubplot'
Image in a Jupyter notebook
data['CO2'].plot()
<matplotlib.axes._subplots.AxesSubplot at 0x7f644a091a20>
Image in a Jupyter notebook
time2 = '2016-02-23 12:15:00' time1 = '2016-02-23 12:45:00' rise = data['CO2'][time2] - data['CO2'][time1] run = (data['Timestamp'][time2] - data['Timestamp'][time1]) print(data['CO2'][time2]) print(rise) print('run =',run) print('slope =', rise/run) rise / run * 3600 / (data['CO2'][time2]-400)
1802 79 run = -1800 slope = -0.0438888888889
-0.11269614835948645
time2 = '2016-02-24 05:00:00' time1 = '2016-02-24 07:00:00' data[time2:time1]
time2 = '2016-02-24 05:45:00' time1 = '2016-02-24 06:15:00' rise = data['CO2'][time2] - data['CO2'][time1] run = (data['Timestamp'][time2] - data['Timestamp'][time1]) print(data['CO2'][time2]) print(rise) print('run =', run) print('slope =', rise/run) rise / run * 3600 / (data['CO2'][time2]-400)
710 14 run = -1800 slope = -0.00777777777778
-0.090322580645161285
time2 = '2016-02-23 09:15:00' time1 = '2016-02-23 08:45:00' rise = data['CO2'][time2] - data['CO2'][time1] run = (data['Timestamp'][time2] - data['Timestamp'][time1]) rise/run
-0.0016666666666666668