Skip to content

Instantly share code, notes, and snippets.

@mackstann
Last active January 18, 2016 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mackstann/68a048d76dcf5c9012fd to your computer and use it in GitHub Desktop.
Save mackstann/68a048d76dcf5c9012fd to your computer and use it in GitHub Desktop.
ventilation_cfm = 5
minutes = 60
room_volume_cu_ft = 140
# this is for a human at rest.
o2_to_co2_cu_ft_per_minute = 0.009*2
# starting/natural conditions -- typical
# see http://www.molecularproducts.com/pdf/technical-library/A%20Guide%20to%20Breathing%20Rates%20in%20Confined%20Environments%20Technical%20Article.pdf
co2_percent_start = 0.000314
o2_percent_start = 0.2095
co2_cu_ft = room_volume_cu_ft * co2_percent_start
o2_cu_ft = room_volume_cu_ft * o2_percent_start
co2_percent = co2_percent_start
o2_percent = o2_percent_start
for i in range(minutes): # step through each minute
# account for respiration of one person
co2_cu_ft += o2_to_co2_cu_ft_per_minute
o2_cu_ft -= o2_to_co2_cu_ft_per_minute
# account for natural exfiltration
co2_cu_ft -= ventilation_cfm * co2_percent
o2_cu_ft -= ventilation_cfm * o2_percent
# account for natural infiltration
co2_cu_ft += ventilation_cfm * co2_percent_start
o2_cu_ft += ventilation_cfm * o2_percent_start
co2_percent = co2_cu_ft / room_volume_cu_ft
o2_percent = o2_cu_ft / room_volume_cu_ft
co2_ppm = int(co2_percent * 1000000)
print("{} minutes: {:0.2f}% O2; {}PPM CO2".format(i+1, o2_percent*100, co2_ppm))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment