From 2d28648c787a942ca1ab67d79dc2520e2e40a0bb Mon Sep 17 00:00:00 2001 From: areza-blocpower Date: Mon, 24 Apr 2017 15:07:20 -0400 Subject: [PATCH 1/6] add calculation of toilet and fixture water usage savings --- bpeng/ecm/low_flow.py | 83 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/bpeng/ecm/low_flow.py b/bpeng/ecm/low_flow.py index c06d296..25e309b 100644 --- a/bpeng/ecm/low_flow.py +++ b/bpeng/ecm/low_flow.py @@ -1,4 +1,85 @@ """ - This module calculates the water usage and energy savings for low flow fixtures (toilets, faucets, and showerheads) +This module calculates the water usage and energy savings for +low flow fixtures (toilets, faucets, and showerheads). The +algorithm is adapted from the EPA WaterSense calculation +method. + +https://www.epa.gov/watersense/how-watersense-calculator-works """ + +WATER_COST = .00825 # cost of water per gallon +DAYS_PER_YEAR = 365 # number of days in a year + + +def _toilet_usage_save(old_flush, new_flush, resident_count): + """ + Calculate annual savings on water usage from low-flow toilet replacement + + Args: + old_flush (float): gallons of water per flush of existing toilet + new_flush (float): gallons of water per flush of new toilet + resident_count (int): number of individuals in the building + + Returns: + float: annual dollar savings on water bill [$/year] + float: annual water savings [gallons] + """ + + flush_count = 5.05 # assumed number of flushes per day + gal_save = (old_flush - new_flush) * flush_count * resident_count * DAYS_PER_YEAR + + cost_save = gal_save * WATER_COST + + return cost_save, gal_save + + +def _heat_fix_save(old_flow, new_flow, resident_count, run_time): + """ + Calculate savings on water usage from fixtures that use hot water, such + as showerheads and faucets. + + Args: + old_flow (float): flow rate [gal/min] of existing fixture + new_flow (float): flow rate [gal/min] of new fixture + resident_count (int): number of individuals in the building + run_time (float): time [min/person] fixture is dispensing water per day + + Returns: + float: annual dollar savings on water bill [$/year] + float: annual water savings [gallons] + """ + gal_save = (new_flow - old_flow) * run_time * resident_count * DAYS_PER_YEAR + cost_save = gal_save * WATER_COST + + return gal_save, cost_save + + +def _heat_fix_energy(gallons, fuel_used, hot_ratio=.73): + """ + Calculate energy savings from fixtures that use hot water, such + as showerheads and faucets. + + Args: + gallons (float): number of gallons of water used per year + fuel_used (str): type of fuel used to heat water (electricity, natural gas, fuel oil) + + Optional + hot_ratio (float): fraction of fixture water usage assumed + to be heated, defaults to .73 + + Returns: + float: annual energy savings [$/year] + float: energy [MMBTU] used to heat water + + """ + + # FIXME: need to make conditionals for getting cost per mmbtu per fuel + # if fuel_used == elec: + + # elif fuel_used == natgas: + + # else fuel_used == oil: + + # heat_used = gallons * hot_ratio * heat_cap_h20 + # cost_save = heat_used * mmbtu_cost -- GitLab From 86458eb1e7cd8382c60246f4e7fa38a1c3a9e0dc Mon Sep 17 00:00:00 2001 From: areza-blocpower Date: Tue, 25 Apr 2017 13:15:57 -0400 Subject: [PATCH 2/6] Change function names to remove underscores --- bpeng/ecm/low_flow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bpeng/ecm/low_flow.py b/bpeng/ecm/low_flow.py index 25e309b..87e3d1e 100644 --- a/bpeng/ecm/low_flow.py +++ b/bpeng/ecm/low_flow.py @@ -12,7 +12,7 @@ WATER_COST = .00825 # cost of water per gallon DAYS_PER_YEAR = 365 # number of days in a year -def _toilet_usage_save(old_flush, new_flush, resident_count): +def toilet_usage_save(old_flush, new_flush, resident_count): """ Calculate annual savings on water usage from low-flow toilet replacement @@ -34,7 +34,7 @@ def _toilet_usage_save(old_flush, new_flush, resident_count): return cost_save, gal_save -def _heat_fix_save(old_flow, new_flow, resident_count, run_time): +def heat_fix_save(old_flow, new_flow, resident_count, run_time): """ Calculate savings on water usage from fixtures that use hot water, such as showerheads and faucets. @@ -55,7 +55,7 @@ def _heat_fix_save(old_flow, new_flow, resident_count, run_time): return gal_save, cost_save -def _heat_fix_energy(gallons, fuel_used, hot_ratio=.73): +def heat_fix_energy(gallons, fuel_used, hot_ratio=.73): """ Calculate energy savings from fixtures that use hot water, such as showerheads and faucets. -- GitLab From 6f363a4a835507ee9df19c4f543320e9006296eb Mon Sep 17 00:00:00 2001 From: areza-blocpower Date: Tue, 25 Apr 2017 16:50:43 -0400 Subject: [PATCH 3/6] Add __init__.py file to folder --- bpeng/ecm/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 bpeng/ecm/__init__.py diff --git a/bpeng/ecm/__init__.py b/bpeng/ecm/__init__.py new file mode 100644 index 0000000..e69de29 -- GitLab From 3196a3b991e92f712f22cdee94f7080dfda4c31e Mon Sep 17 00:00:00 2001 From: areza-blocpower Date: Tue, 25 Apr 2017 17:34:29 -0400 Subject: [PATCH 4/6] Add savings calculations for low flow fixtures --- bpeng/ecm/low_flow.py | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/bpeng/ecm/low_flow.py b/bpeng/ecm/low_flow.py index 87e3d1e..a051ba3 100644 --- a/bpeng/ecm/low_flow.py +++ b/bpeng/ecm/low_flow.py @@ -8,8 +8,13 @@ https://www.epa.gov/watersense/how-watersense-calculator-works """ -WATER_COST = .00825 # cost of water per gallon -DAYS_PER_YEAR = 365 # number of days in a year +WATER_COST = .00825 # cost of water per gallon +ELEC_COST = .00234 # cost of electricity per MMBTU [fake] +GAS_COST = .38 # cost of natural gas per MMBTU [fake] +OIL_COST = (.12, .32, .42) # cost of [#2, #4, #6] fuel oil per MMBTU [fake] +DAYS_PER_YEAR = 365 # number of days in a year +HEAT_CAP_H2O = 1 # [BTU] energy required to raise one pound of water 1 degree F +RHO_H2O = 8.34 # [lb/US gal] density of water, assumed at 50F def toilet_usage_save(old_flush, new_flush, resident_count): @@ -34,7 +39,7 @@ def toilet_usage_save(old_flush, new_flush, resident_count): return cost_save, gal_save -def heat_fix_save(old_flow, new_flow, resident_count, run_time): +def heated_fix_save(old_flow, new_flow, resident_count, run_time): """ Calculate savings on water usage from fixtures that use hot water, such as showerheads and faucets. @@ -55,7 +60,7 @@ def heat_fix_save(old_flow, new_flow, resident_count, run_time): return gal_save, cost_save -def heat_fix_energy(gallons, fuel_used, hot_ratio=.73): +def heat_fix_energy(gallons, fuel_used, supply_temp=120, fresh_temp=55, hot_ratio=.73): """ Calculate energy savings from fixtures that use hot water, such as showerheads and faucets. @@ -65,6 +70,8 @@ def heat_fix_energy(gallons, fuel_used, hot_ratio=.73): fuel_used (str): type of fuel used to heat water (electricity, natural gas, fuel oil) Optional + supply_temp (float): temperature of heated water supplied to building, typically 120F + fresh_temp (float): temperature of fresh water to be heated, assumed to be 55F hot_ratio (float): fraction of fixture water usage assumed to be heated, defaults to .73 @@ -74,12 +81,20 @@ def heat_fix_energy(gallons, fuel_used, hot_ratio=.73): """ - # FIXME: need to make conditionals for getting cost per mmbtu per fuel - # if fuel_used == elec: + heat_used = (supply_temp - fresh_temp) * HEAT_CAP_H2O * RHO_H2O * gallons * hot_ratio * 0.000001 - # elif fuel_used == natgas: + if fuel_used == 'elec': + cost_save = heat_used * ELEC_COST + elif fuel_used == 'natgas': + cost_save = heat_used * GAS_COST + else: + oil_type = input('Pick fuel oil type: 2 4 6 ') - # else fuel_used == oil: + if oil_type == '2': + cost_save = heat_used * OIL_COST[0] + elif oil_type == '4': + cost_save = heat_used * OIL_COST[1] + elif oil_type == '6': + cost_save = heat_used * OIL_COST[2] - # heat_used = gallons * hot_ratio * heat_cap_h20 - # cost_save = heat_used * mmbtu_cost + return cost_save, heat_used -- GitLab From 620bcc2d1328556d970860529d0eeb02729a86b0 Mon Sep 17 00:00:00 2001 From: areza-blocpower Date: Wed, 26 Apr 2017 09:43:13 -0400 Subject: [PATCH 5/6] Change returns for all functions to be cost savings, then usage savings. --- bpeng/ecm/low_flow.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bpeng/ecm/low_flow.py b/bpeng/ecm/low_flow.py index a051ba3..aaa2c57 100644 --- a/bpeng/ecm/low_flow.py +++ b/bpeng/ecm/low_flow.py @@ -10,8 +10,9 @@ https://www.epa.gov/watersense/how-watersense-calculator-works WATER_COST = .00825 # cost of water per gallon ELEC_COST = .00234 # cost of electricity per MMBTU [fake] -GAS_COST = .38 # cost of natural gas per MMBTU [fake] -OIL_COST = (.12, .32, .42) # cost of [#2, #4, #6] fuel oil per MMBTU [fake] +GAS_COST = 3.12 # cost of natural gas per MMBTU [fake] +OIL_COST = (20.09, .32, .42) # cost of [#2, #4, #6] fuel oil per MMBTU [fake] +# NOTE: Costs should eventually be pulled from elsewhere, since the prices change DAYS_PER_YEAR = 365 # number of days in a year HEAT_CAP_H2O = 1 # [BTU] energy required to raise one pound of water 1 degree F RHO_H2O = 8.34 # [lb/US gal] density of water, assumed at 50F @@ -57,7 +58,7 @@ def heated_fix_save(old_flow, new_flow, resident_count, run_time): gal_save = (new_flow - old_flow) * run_time * resident_count * DAYS_PER_YEAR cost_save = gal_save * WATER_COST - return gal_save, cost_save + return cost_save, gal_save def heat_fix_energy(gallons, fuel_used, supply_temp=120, fresh_temp=55, hot_ratio=.73): -- GitLab From 0b42d1d7155b4dede35461f850f4a3dca4ef4c1c Mon Sep 17 00:00:00 2001 From: areza-blocpower Date: Fri, 28 Apr 2017 10:10:19 -0400 Subject: [PATCH 6/6] Remove cost savings calculations. Change args to accept different granularities --- bpeng/ecm/low_flow.py | 69 +++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/bpeng/ecm/low_flow.py b/bpeng/ecm/low_flow.py index aaa2c57..7fcd6f4 100644 --- a/bpeng/ecm/low_flow.py +++ b/bpeng/ecm/low_flow.py @@ -7,37 +7,28 @@ method. https://www.epa.gov/watersense/how-watersense-calculator-works """ - -WATER_COST = .00825 # cost of water per gallon -ELEC_COST = .00234 # cost of electricity per MMBTU [fake] -GAS_COST = 3.12 # cost of natural gas per MMBTU [fake] -OIL_COST = (20.09, .32, .42) # cost of [#2, #4, #6] fuel oil per MMBTU [fake] -# NOTE: Costs should eventually be pulled from elsewhere, since the prices change DAYS_PER_YEAR = 365 # number of days in a year HEAT_CAP_H2O = 1 # [BTU] energy required to raise one pound of water 1 degree F RHO_H2O = 8.34 # [lb/US gal] density of water, assumed at 50F -def toilet_usage_save(old_flush, new_flush, resident_count): +def toilet_usage_save(old_flush, new_flush, resident_count=2.6, flush_count=5.05, day_span=365): """ Calculate annual savings on water usage from low-flow toilet replacement Args: old_flush (float): gallons of water per flush of existing toilet new_flush (float): gallons of water per flush of new toilet - resident_count (int): number of individuals in the building + resident_count (int): number of individuals in the building, defaults to 2.6 (EPA avg) + flush_count (float): number of flushes per day, defaults to 5.05 (EPA avg) + day_span (int): number of days in savings period, default gives annual Returns: - float: annual dollar savings on water bill [$/year] float: annual water savings [gallons] """ + gal_save = (old_flush - new_flush) * flush_count * resident_count * day_span - flush_count = 5.05 # assumed number of flushes per day - gal_save = (old_flush - new_flush) * flush_count * resident_count * DAYS_PER_YEAR - - cost_save = gal_save * WATER_COST - - return cost_save, gal_save + return gal_save def heated_fix_save(old_flow, new_flow, resident_count, run_time): @@ -49,53 +40,41 @@ def heated_fix_save(old_flow, new_flow, resident_count, run_time): old_flow (float): flow rate [gal/min] of existing fixture new_flow (float): flow rate [gal/min] of new fixture resident_count (int): number of individuals in the building - run_time (float): time [min/person] fixture is dispensing water per day + run_time (float): time [min/person] fixture is dispensing water Returns: - float: annual dollar savings on water bill [$/year] - float: annual water savings [gallons] + float: water savings [gallons] """ - gal_save = (new_flow - old_flow) * run_time * resident_count * DAYS_PER_YEAR - cost_save = gal_save * WATER_COST + gal_save = (new_flow - old_flow) * run_time * resident_count - return cost_save, gal_save + return gal_save -def heat_fix_energy(gallons, fuel_used, supply_temp=120, fresh_temp=55, hot_ratio=.73): +def heat_fix_energy(gallons, supply_temp=120, fresh_temp=55, hot_ratio=.73): """ Calculate energy savings from fixtures that use hot water, such as showerheads and faucets. Args: - gallons (float): number of gallons of water used per year - fuel_used (str): type of fuel used to heat water (electricity, natural gas, fuel oil) - Optional - supply_temp (float): temperature of heated water supplied to building, typically 120F - fresh_temp (float): temperature of fresh water to be heated, assumed to be 55F - hot_ratio (float): fraction of fixture water usage assumed - to be heated, defaults to .73 + gallons (float) + gallons of water used + + supply_temp (int, optional) + temperature of heated water supplied to building, typically 120F. + + fresh_temp (int, optional) + temperature of fresh water to be heated, defaults to 55F + + hot_ratio (float, optional) + fraction of fixture water usage assumed to be heated, defaults to .73 Returns: - float: annual energy savings [$/year] + float: energy [MMBTU] used to heat water """ heat_used = (supply_temp - fresh_temp) * HEAT_CAP_H2O * RHO_H2O * gallons * hot_ratio * 0.000001 - if fuel_used == 'elec': - cost_save = heat_used * ELEC_COST - elif fuel_used == 'natgas': - cost_save = heat_used * GAS_COST - else: - oil_type = input('Pick fuel oil type: 2 4 6 ') - - if oil_type == '2': - cost_save = heat_used * OIL_COST[0] - elif oil_type == '4': - cost_save = heat_used * OIL_COST[1] - elif oil_type == '6': - cost_save = heat_used * OIL_COST[2] - - return cost_save, heat_used + return heat_used -- GitLab