diff --git a/bpeng/oiltogas_savings_calculations.py b/bpeng/oiltogas_savings_calculations.py new file mode 100644 index 0000000000000000000000000000000000000000..851f429aad0be116b59b7da8d3548b7980a5fcc0 --- /dev/null +++ b/bpeng/oiltogas_savings_calculations.py @@ -0,0 +1,66 @@ +"""Function to calculate $ savings for Oil to Gas conversion""" + +NO2_CONV = 0.138 +NO4_CONV = 0.145 +NO6_CONV = 0.150 +PROPANE_CONV = 0.0916 +NATURAL_GAS_CONV = 0.1 +ELECTRICITY_CONV = 0.003412 + + +def number2(gallons): + """Convert No2 oil gallons to MMBTU""" + return gallons * NO2_CONV + + +def number4(gallons): + """Convert No4 oil gallons to MMBTU""" + return gallons * NO4_CONV + + +def number6(gallons): + """Convert No6 oil gallons to MMBTU""" + return gallons * NO6_CONV + + +def propane(gallons): + """Convert propane gallons to MMBTU""" + return gallons * PROPANE_CONV + + +def natural_gas(therms): + """Convert natural gas therms to MMBTU""" + return therms * NATURAL_GAS_CONV + + +def electricity(kwh): + """Convert electricity kWh to MMBTU""" + return kwh * ELECTRICITY_CONV + + +# call function to convert gallons to mmbtu based on the type of oil +def oil_gallons_mmbtu(): + """Convert oil gallons to MMBTU""" + # inputs + oil_type = input('Enter type (No2, No4, No6)') + gallons = input('Enter annual oil consumption in gallons') + if oil_type == "No2": + oil_mmbtu = number2(gallons) + elif oil_type == "No4": + oil_mmbtu = number4(gallons) + else: + oil_mmbtu = number6(gallons) + return oil_mmbtu + + +def savings(oil_mmbtu): + """ Calculate cost savings from oil to gas conversion""" + oil_costs = input("Enter the annual oil bill in $") + oilprice_per_mmbtu = oil_costs / oil_mmbtu + gasprice_per_therm = input("Enter the gas price in $ ($/therm)") + gasprice_per_mmbtu = gasprice_per_therm * 10 + percentage_savings = ((oilprice_per_mmbtu - gasprice_per_mmbtu) / oilprice_per_mmbtu) * 100 + cost_savings = oil_mmbtu * (oilprice_per_mmbtu - gasprice_per_mmbtu) + print('% Cost Savings:', percentage_savings) + print('$ Savings:', cost_savings) +