Spaces:
Sleeping
Sleeping
Added 15 categories
Browse files
app.py
CHANGED
|
@@ -1,16 +1,19 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
|
| 3 |
purchased_goods_values = ["Cement", "Plaster", "Paint", "Timber", "Concrete"]
|
| 4 |
supplier_values = ["Supplier C", "Supplier D", "Supplier E", "Supplier F", "Supplier G"]
|
| 5 |
scope_values = ["Electricity", "Natural Gas"]
|
| 6 |
material_inputs_values = ["Cotton", "Polymer", "Chemical A", "Chemical B"]
|
| 7 |
transport_values = ["Cotton", "Polymer", "Chemical A", "Chemical B"]
|
| 8 |
waste_output_values = ["Waste sent to landfill"]
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def calculate_emissions_supplier_specific(purchased_goods_data):
|
| 11 |
total_emissions = sum([qty * emission_factor for _, _, qty, emission_factor in purchased_goods_data])
|
| 12 |
st.header(f"Total Emissions for Supplier-specific Method: {total_emissions} kg CO2e")
|
| 13 |
-
|
| 14 |
|
| 15 |
def calculate_emissions_hybrid(scope1_and_scope2_data, material_inputs_data, transport_data, waste_output_data):
|
| 16 |
scope1_and_scope2_emissions = sum([float(item['Amount (kWh)']) * float(item['Emission factor (kg CO2e/kWh)']) for item in scope1_and_scope2_data])
|
|
@@ -26,7 +29,7 @@ def calculate_emissions_hybrid(scope1_and_scope2_data, material_inputs_data, tra
|
|
| 26 |
for i, item in enumerate(transport_data):
|
| 27 |
st.header(f"Emissions for Purchased Item {i + 1}: {transport_emissions_per_item[i]} kg CO2e")
|
| 28 |
|
| 29 |
-
|
| 30 |
|
| 31 |
def calculate_emissions_hybrid_pro(tshirt_data, scope_data, waste_output_data):
|
| 32 |
scope1_and_scope2_emissions = sum([float(item['Amount (kWh)']) * float(item['Emission factor (kg CO2e/kWh)']) for item in scope_data])
|
|
@@ -34,54 +37,1087 @@ def calculate_emissions_hybrid_pro(tshirt_data, scope_data, waste_output_data):
|
|
| 34 |
other_upstream_emissions = sum([float(item['Number of t-shirts purchased']) * float(item['Cradle-to-gate process emission factor (kg CO2e/per t-shirt(excluding scopes)']) for item in tshirt_data])
|
| 35 |
total_emissions = scope1_and_scope2_emissions + waste_output_emissions + other_upstream_emissions
|
| 36 |
st.header(f"Total Emissions for HybridPro Method: {total_emissions} kg CO2e")
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
num_items = st.number_input(f"**Number of {label} items**", min_value=1, step=1, key=f"{label}_num_items")
|
| 78 |
input_fields = []
|
|
|
|
| 79 |
for i in range(num_items):
|
| 80 |
st.subheader(f"{label} {i + 1}")
|
| 81 |
input_data = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
for value, heading in zip(values, headings):
|
| 83 |
-
|
|
|
|
|
|
|
| 84 |
input_fields.append(input_data)
|
|
|
|
| 85 |
return input_fields
|
| 86 |
|
| 87 |
def dynamic_input_fields_with_dropdown(label, prompt, values, headings):
|
|
@@ -107,5 +1143,31 @@ def dynamic_input_fields_with_emission_factor(label, prompt, values, headings):
|
|
| 107 |
input_fields.append(input_data)
|
| 108 |
return input_fields
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
if __name__ == "__main__":
|
| 111 |
main()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
fuel_values = ["Coal", "Natural Gas", "Oil", "Renewable Energy", "Other"]
|
| 3 |
purchased_goods_values = ["Cement", "Plaster", "Paint", "Timber", "Concrete"]
|
| 4 |
supplier_values = ["Supplier C", "Supplier D", "Supplier E", "Supplier F", "Supplier G"]
|
| 5 |
scope_values = ["Electricity", "Natural Gas"]
|
| 6 |
material_inputs_values = ["Cotton", "Polymer", "Chemical A", "Chemical B"]
|
| 7 |
transport_values = ["Cotton", "Polymer", "Chemical A", "Chemical B"]
|
| 8 |
waste_output_values = ["Waste sent to landfill"]
|
| 9 |
+
categories = ["Category 1", "Category 2", "Category 3", "Category 4", "Category 5",
|
| 10 |
+
"Category 6", "Category 7", "Category 8", "Category 9", "Category 10",
|
| 11 |
+
"Category 11", "Category 12", "Category 13", "Category 14", "Category 15"]
|
| 12 |
|
| 13 |
def calculate_emissions_supplier_specific(purchased_goods_data):
|
| 14 |
total_emissions = sum([qty * emission_factor for _, _, qty, emission_factor in purchased_goods_data])
|
| 15 |
st.header(f"Total Emissions for Supplier-specific Method: {total_emissions} kg CO2e")
|
| 16 |
+
|
| 17 |
|
| 18 |
def calculate_emissions_hybrid(scope1_and_scope2_data, material_inputs_data, transport_data, waste_output_data):
|
| 19 |
scope1_and_scope2_emissions = sum([float(item['Amount (kWh)']) * float(item['Emission factor (kg CO2e/kWh)']) for item in scope1_and_scope2_data])
|
|
|
|
| 29 |
for i, item in enumerate(transport_data):
|
| 30 |
st.header(f"Emissions for Purchased Item {i + 1}: {transport_emissions_per_item[i]} kg CO2e")
|
| 31 |
|
| 32 |
+
|
| 33 |
|
| 34 |
def calculate_emissions_hybrid_pro(tshirt_data, scope_data, waste_output_data):
|
| 35 |
scope1_and_scope2_emissions = sum([float(item['Amount (kWh)']) * float(item['Emission factor (kg CO2e/kWh)']) for item in scope_data])
|
|
|
|
| 37 |
other_upstream_emissions = sum([float(item['Number of t-shirts purchased']) * float(item['Cradle-to-gate process emission factor (kg CO2e/per t-shirt(excluding scopes)']) for item in tshirt_data])
|
| 38 |
total_emissions = scope1_and_scope2_emissions + waste_output_emissions + other_upstream_emissions
|
| 39 |
st.header(f"Total Emissions for HybridPro Method: {total_emissions} kg CO2e")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def collect_category_3_data():
|
| 43 |
+
st.header("Category 3: Fuel and Energy related activities not included in scope 1 and Scope 2")
|
| 44 |
+
|
| 45 |
+
method_options = ["Method 1: Upstream emissions of purchased fuels",
|
| 46 |
+
"Method 2: Upstream emissions of purchased electricity",
|
| 47 |
+
"Method 3: Transmission and distribution losses",
|
| 48 |
+
"Method 4: Emissions from power that is purchased and sold"]
|
| 49 |
+
selected_method = st.selectbox("Select Method", method_options)
|
| 50 |
+
|
| 51 |
+
if selected_method == "Method 1: Upstream emissions of purchased fuels":
|
| 52 |
+
fuel_data = dynamic_input_fields("Fuel Data", ["Fuel consumed (kWh)", "Upstream fuel emission factor (kg CO2e/kWh)"], ["Fuel consumed (kWh)", "Upstream fuel emission factor (kg CO2e/kWh)"])
|
| 53 |
+
calculate_emissions_category_3_method_1(fuel_data)
|
| 54 |
+
|
| 55 |
+
elif selected_method == "Method 2: Upstream emissions of purchased electricity":
|
| 56 |
+
selected_country = st.selectbox("Select country", ["Australia", "Canada", "India", "US", "Turkey"])
|
| 57 |
+
electricity_data = dynamic_input_fields("Electricity Data", ["Electricity"], ["Electricity"], country=selected_country)
|
| 58 |
+
steam_data = dynamic_input_fields("Steam Data", ["Steam"], ["Steam"], country=selected_country)
|
| 59 |
+
heating_data = dynamic_input_fields("Heating Data", ["Heating"], ["Heating"], country=selected_country)
|
| 60 |
+
cooling_data = dynamic_input_fields("Cooling Data", ["Cooling"], ["Cooling"], country=selected_country)
|
| 61 |
+
upstream_emission_factors = dynamic_input_fields("Upstream Emission Factors", ["Electricity", "Steam", "Heating", "Cooling"], ["Electricity", "Steam", "Heating", "Cooling"], country=selected_country)
|
| 62 |
+
calculate_emissions_category_3_method_2(electricity_data, steam_data, heating_data, cooling_data, upstream_emission_factors,selected_country)
|
| 63 |
+
|
| 64 |
+
elif selected_method == "Method 3: Transmission and distribution losses":
|
| 65 |
+
selected_country = st.selectbox("Select country", ["Australia", "Canada", "India", "US", "Turkey"])
|
| 66 |
+
electricity_data = dynamic_input_fields("Electricity Data", ["Electricity"], ["Electricity"], country=selected_country)
|
| 67 |
+
steam_data = dynamic_input_fields("Steam Data", ["Steam"], ["Steam"], country=selected_country)
|
| 68 |
+
heating_data = dynamic_input_fields("Heating Data", ["Heating"], ["Heating"], country=selected_country)
|
| 69 |
+
cooling_data = dynamic_input_fields("Cooling Data", ["Cooling"], ["Cooling"], country=selected_country)
|
| 70 |
+
t_and_d_loss_data = dynamic_input_fields("T&D Loss Data", ["Transmission"], ["Transmission"], country=selected_country)
|
| 71 |
+
upstream_emission_factors = dynamic_input_fields("Upstream Emission Factors", ["Electricity", "Steam", "Heating", "Cooling"], ["Electricity", "Steam", "Heating", "Cooling"], country=selected_country)
|
| 72 |
+
calculate_emissions_category_3_method_3(electricity_data,steam_data,heating_data,cooling_data,upstream_emission_factors, t_and_d_loss_data,selected_country)
|
| 73 |
+
|
| 74 |
+
elif selected_method == "Method 4: Emissions from power that is purchased and sold":
|
| 75 |
+
selected_country = st.selectbox("Select country", ["Australia", "Canada", "India", "US", "Turkey"])
|
| 76 |
+
electricity_data = dynamic_input_fields("Electricity Data", ["Electricity"], ["Electricity"],country=selected_country)
|
| 77 |
+
steam_data = dynamic_input_fields("Steam Data", ["Steam"], ["Steam"],country=selected_country)
|
| 78 |
+
heating_data = dynamic_input_fields("Heating Data", ["Heating"], ["Heating"],country=selected_country)
|
| 79 |
+
cooling_data = dynamic_input_fields("Cooling Data", ["Cooling"], ["Cooling"],country=selected_country)
|
| 80 |
+
upstream_emission_factors = dynamic_input_fields("Upstream Emission Factors", ["Electricity", "Steam", "Heating", "Cooling"], ["Country", "Electricity", "Steam", "Heating", "Cooling"], country=selected_country)
|
| 81 |
+
calculate_emissions_category_3_method_4(electricity_data,steam_data,heating_data,cooling_data,upstream_emission_factors,selected_country)
|
| 82 |
+
|
| 83 |
+
def calculate_emissions_category_3_method_1(fuel_data):
|
| 84 |
+
total_emissions = sum(
|
| 85 |
+
[
|
| 86 |
+
item["Fuel consumed (kWh)"] * (item["Upstream fuel emission factor (kg CO2e/kWh)"])
|
| 87 |
+
for item in fuel_data
|
| 88 |
+
]
|
| 89 |
+
)
|
| 90 |
+
st.header(f"Total Emissions for Upstream emissions of purchased fuels is {total_emissions} kg CO2e")
|
| 91 |
+
|
| 92 |
+
def calculate_emissions_category_3_method_2(electricity_data, steam_data, heating_data, cooling_data, upstream_emission_factor,selected_country):
|
| 93 |
+
country_electricity = next(item for item in electricity_data if item["Country"] == selected_country)["Electricity"]
|
| 94 |
+
country_steam = next(item for item in steam_data if item["Country"] == selected_country)["Steam"]
|
| 95 |
+
country_heating = next(item for item in heating_data if item["Country"] == selected_country)["Heating"]
|
| 96 |
+
country_cooling = next(item for item in cooling_data if item["Country"] == selected_country)["Cooling"]
|
| 97 |
+
country_factors = next(item for item in upstream_emission_factor if item["Country"] == selected_country)
|
| 98 |
+
|
| 99 |
+
total_emissions = (
|
| 100 |
+
country_electricity * country_factors["Electricity"]
|
| 101 |
+
+ country_steam * country_factors["Steam"]
|
| 102 |
+
+ country_heating * country_factors["Heating"]
|
| 103 |
+
+ country_cooling * country_factors["Cooling"]
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
st.header(f"Total Emissions for Upstream emissions of purchased electricity: {total_emissions} kg CO2e")
|
| 107 |
+
|
| 108 |
+
def calculate_emissions_category_3_method_3(electricity_data, steam_data, heating_data, cooling_data, upstream_emission_factors,t_and_d_loss, selected_country):
|
| 109 |
+
country_electricity = next(item for item in electricity_data if item["Country"] == selected_country)["Electricity"]
|
| 110 |
+
country_steam = next(item for item in steam_data if item["Country"] == selected_country)["Steam"]
|
| 111 |
+
country_heating = next(item for item in heating_data if item["Country"] == selected_country)["Heating"]
|
| 112 |
+
country_cooling = next(item for item in cooling_data if item["Country"] == selected_country)["Cooling"]
|
| 113 |
+
country_factors = next(item for item in upstream_emission_factors if item["Country"] == selected_country)
|
| 114 |
+
country_td = next(item for item in t_and_d_loss if item["Country"] == selected_country)
|
| 115 |
+
st.header(country_factors)
|
| 116 |
+
total_emissions = (
|
| 117 |
+
country_electricity * country_factors["Electricity"] * country_td["Transmission"]
|
| 118 |
+
+ country_steam * country_factors["Steam"] * country_td["Transmission"]
|
| 119 |
+
+ country_heating * country_factors["Heating"] * country_td["Transmission"]
|
| 120 |
+
+ country_cooling * country_factors["Cooling"] * country_td["Transmission"]
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
st.header(f"Total Emissions for Transmission and distribution losses: {total_emissions} kg CO2e")
|
| 124 |
+
|
| 125 |
+
def calculate_emissions_category_3_method_4(electricity_data, steam_data, heating_data, cooling_data, emission_factors, selected_country):
|
| 126 |
+
country_factors = next((item for item in emission_factors if item["Country"] == selected_country), None)
|
| 127 |
+
st.header(country_factors)
|
| 128 |
+
if country_factors is not None:
|
| 129 |
+
total_emissions = (
|
| 130 |
+
sum(item["Electricity"] * country_factors["Electricity"] for item in electricity_data)
|
| 131 |
+
+ sum(item["Steam"] * country_factors["Steam"] for item in steam_data)
|
| 132 |
+
+ sum(item["Heating"] * country_factors["Heating"] for item in heating_data)
|
| 133 |
+
+ sum(item["Cooling"] * country_factors["Cooling"] for item in cooling_data)
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
st.header(f"Total Emissions where power is purchased and sold: {total_emissions} kg CO2e")
|
| 137 |
+
else:
|
| 138 |
+
st.warning(f"No emission factors found for {selected_country} in emission_factors.")
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def calculate_emissions_category_4_method_1(fuel_data, electricity_data, refrigerant_data, total_fuel_spend=None, total_distance_travelled=None):
|
| 142 |
+
fuel_emissions = sum([item["Fuel consumed (liters)"] * item["Emission factor (kg CO2e/liter)"] for item in fuel_data])
|
| 143 |
+
electricity_emissions = sum([item["Quantity of electricity consumed (kWh)"] * item["Emission factor for electricity grid (kg CO2e/kWh)"] for item in electricity_data])
|
| 144 |
+
refrigerant_emissions = sum([item["Refrigerant leakage (kg)"] * item["Global warming potential for refrigerant (kg CO2e)"] for item in refrigerant_data])
|
| 145 |
+
|
| 146 |
+
if total_fuel_spend:
|
| 147 |
+
quantities_of_fuel = sum([item["Total fuel spend ($)"] / item["Average fuel price ($/liter)"] for item in fuel_data])
|
| 148 |
+
fuel_emissions_from_spending = quantities_of_fuel * sum([item["Average fuel price ($/liter)"] * item["Emission factor (kg CO2e/liter)"] for item in fuel_data])
|
| 149 |
+
total_emissions = fuel_emissions + electricity_emissions + refrigerant_emissions + fuel_emissions_from_spending
|
| 150 |
+
elif total_distance_travelled:
|
| 151 |
+
quantities_of_fuel_consumed = sum([item["Total distance travelled (km)"] * item["Fuel efficiency of vehicle (liters/km)"] for item in fuel_data])
|
| 152 |
+
fuel_emissions_from_distance = quantities_of_fuel_consumed * sum([item["Emission factor for the fuel (kg CO2e/liter)"] for item in fuel_data])
|
| 153 |
+
total_emissions = fuel_emissions + electricity_emissions + refrigerant_emissions + fuel_emissions_from_distance
|
| 154 |
+
else:
|
| 155 |
+
total_emissions = fuel_emissions + electricity_emissions + refrigerant_emissions
|
| 156 |
+
|
| 157 |
+
st.header(f"Total Emissions for Fuel-based Method: {total_emissions} kg CO2e")
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def calculate_emissions_category_4_method_2(fuel_data, average_efficiency_unladen, total_distance_travelled_unladen):
|
| 161 |
+
total_emissions_unladen = sum([item["Quantity of fuel consumed from backhaul"] * item["Emission factor for the fuel (kg CO2e/liter)"] for item in fuel_data])
|
| 162 |
+
total_emissions_unladen += sum([average_efficiency_unladen * total_distance_travelled_unladen * item["Emission factor for the fuel (kg CO2e/liter)"] for item in fuel_data])
|
| 163 |
+
|
| 164 |
+
st.header(f"Total Emissions for Unladen Backhaul: {total_emissions_unladen} kg CO2e")
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
def calculate_emissions_category_4_method_3(transport_data):
|
| 168 |
+
total_emissions_transport = sum([
|
| 169 |
+
item["Mass of goods purchased (tonnes)"] * item["Distance travelled in transport leg (km)"] * item["Emission factor of transport mode or vehicle type (kg CO2e/tonne-km)"]
|
| 170 |
+
for item in transport_data
|
| 171 |
+
])
|
| 172 |
+
|
| 173 |
+
st.header(f"Total Emissions for Transportation: {total_emissions_transport} kg CO2e")
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
def calculate_emissions_category_4_method_4(storage_data):
|
| 177 |
+
total_emissions_distribution = sum([
|
| 178 |
+
(
|
| 179 |
+
item["Fuel consumed (kWh)"] * item["Fuel emission factor (kg CO2e/kWh)"]
|
| 180 |
+
+ item["Electricity consumed (kWh)"] * item["Electricity emission factor (kg CO2e/kWh)"]
|
| 181 |
+
+ item["Refrigerant leakage (kg)"] * item["Refrigerant emission factor (kg CO2e/kg)"]
|
| 182 |
+
) * (
|
| 183 |
+
item["Volume of company A’s goods (m3)"] / item["Total volume of goods in storage facility (m3)"] if item["Total volume of goods in storage facility (m3)"] != 0 else 0
|
| 184 |
+
)
|
| 185 |
+
for item in storage_data
|
| 186 |
+
])
|
| 187 |
+
|
| 188 |
+
st.header(f"Total Emissions for Distribution: {total_emissions_distribution} kg CO2e")
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
def calculate_emissions_category_4_method_5(storage_data):
|
| 192 |
+
total_emissions_distribution = sum([
|
| 193 |
+
item["Volume of stored goods (m3)"] * item["Average number of days stored (days)"] * item["Emission factor for storage facility (kg CO2e/m3/day)"]
|
| 194 |
+
for item in storage_data
|
| 195 |
+
])
|
| 196 |
+
|
| 197 |
+
st.header(f"Total Emissions for Distribution (Method 5): {total_emissions_distribution} kg CO2e")
|
| 198 |
+
|
| 199 |
+
def calculate_emissions_category_5_method_1(waste_treatment_data):
|
| 200 |
+
total_emissions_category_5 = sum([
|
| 201 |
+
item["Allocated scope 1 and scope 2 emissions of waste treatment company"]
|
| 202 |
+
for item in waste_treatment_data
|
| 203 |
+
])
|
| 204 |
+
|
| 205 |
+
st.header(f"Total Emissions for Category 5 (Method 1): {total_emissions_category_5} kg CO2e")
|
| 206 |
+
|
| 207 |
+
def collect_category_4_method_1_data():
|
| 208 |
+
st.header("Category 4: Method 1 - Fuel-based Method")
|
| 209 |
+
|
| 210 |
+
fuel_data = dynamic_input_fields_with_emission_factor("Fuel Data", "Enter fuel data", ["Fuel consumed (liters)", "Emission factor (kg CO2e/liter)", "Total fuel spend ($)", "Average fuel price ($/liter)","Total distance travelled (km)"],
|
| 211 |
+
["Fuel consumed (liters)", "Emission factor (kg CO2e/liter)", "Total fuel spend ($)", "Average fuel price ($/liter)","Total distance travelled (km)"])
|
| 212 |
+
electricity_data = dynamic_input_fields_with_emission_factor("Electricity Data", "Enter electricity data", ["Quantity of electricity consumed (kWh)", "Emission factor for electricity grid (kg CO2e/kWh)"],
|
| 213 |
+
["Quantity of electricity consumed (kWh)", "Emission factor for electricity grid (kg CO2e/kWh)"])
|
| 214 |
+
refrigerant_data = dynamic_input_fields_with_emission_factor("Refrigerant Data", "Enter refrigerant data", ["Refrigerant leakage (kg)", "Global warming potential for refrigerant (kg CO2e)"],
|
| 215 |
+
["Refrigerant leakage (kg)", "Global warming potential for refrigerant (kg CO2e)"])
|
| 216 |
+
|
| 217 |
+
total_fuel_spend = st.checkbox("Calculate based on total fuel spend")
|
| 218 |
+
calculate_emissions_category_4_method_1(fuel_data, electricity_data, refrigerant_data, total_fuel_spend=total_fuel_spend)
|
| 219 |
+
|
| 220 |
+
def collect_category_4_method_2_data():
|
| 221 |
+
st.header("Category 4: Method 2 - Unladen Backhaul")
|
| 222 |
+
|
| 223 |
+
fuel_data = dynamic_input_fields_with_emission_factor("Fuel Data", "Enter fuel data", ["Quantity of fuel consumed from backhaul", "Emission factor for the fuel (kg CO2e/liter)"],
|
| 224 |
+
["Quantity of fuel consumed from backhaul", "Emission factor for the fuel (kg CO2e/liter)"])
|
| 225 |
+
average_efficiency_unladen = st.number_input("Average efficiency unladen", min_value=0.0, step=0.01, key="average_efficiency_unladen")
|
| 226 |
+
total_distance_travelled_unladen = st.number_input("Total distance travelled unladen (km)", min_value=0.0, step=0.01, key="total_distance_travelled_unladen")
|
| 227 |
+
|
| 228 |
+
calculate_emissions_category_4_method_2(fuel_data, average_efficiency_unladen, total_distance_travelled_unladen)
|
| 229 |
+
|
| 230 |
+
def collect_category_4_method_3_data():
|
| 231 |
+
st.header("Category 4: Method 3 - Transportation")
|
| 232 |
+
|
| 233 |
+
transport_data = dynamic_input_fields_with_emission_factor("Transport Data", "Enter transport data", ["Mass of goods purchased (tonnes)", "Distance travelled in transport leg (km)", "Emission factor of transport mode or vehicle type (kg CO2e/tonne-km)"],
|
| 234 |
+
["Mass of goods purchased (tonnes)", "Distance travelled in transport leg (km)", "Emission factor of transport mode or vehicle type (kg CO2e/tonne-km)"])
|
| 235 |
+
|
| 236 |
+
calculate_emissions_category_4_method_3(transport_data)
|
| 237 |
+
|
| 238 |
+
def collect_category_4_method_4_data():
|
| 239 |
+
st.header("Category 4: Method 4 - Distribution")
|
| 240 |
+
|
| 241 |
+
storage_data = dynamic_input_fields_with_emission_factor("Storage Data", "Enter storage data", ["Fuel consumed (kWh)", "Electricity consumed (kWh)", "Refrigerant leakage (kg)",
|
| 242 |
+
"Volume of company A’s goods (m3)", "Total volume of goods in storage facility (m3)",
|
| 243 |
+
"Fuel emission factor (kg CO2e/kWh)", "Electricity emission factor (kg CO2e/kWh)", "Refrigerant emission factor (kg CO2e/kg)"],
|
| 244 |
+
["Fuel consumed (kWh)", "Electricity consumed (kWh)", "Refrigerant leakage (kg)",
|
| 245 |
+
"Volume of company A’s goods (m3)", "Total volume of goods in storage facility (m3)",
|
| 246 |
+
"Fuel emission factor (kg CO2e/kWh)", "Electricity emission factor (kg CO2e/kWh)", "Refrigerant emission factor (kg CO2e/kg)"])
|
| 247 |
+
|
| 248 |
+
calculate_emissions_category_4_method_4(storage_data)
|
| 249 |
+
|
| 250 |
+
def collect_category_4_method_5_data():
|
| 251 |
+
st.header("Category 4: Method 5 - Distribution (Method 5)")
|
| 252 |
+
|
| 253 |
+
storage_data = dynamic_input_fields_with_emission_factor("Storage Data", "Enter storage data", ["Volume of stored goods (m3)", "Average number of days stored (days)", "Emission factor for storage facility (kg CO2e/m3/day)"],
|
| 254 |
+
["Volume of stored goods (m3)", "Average number of days stored (days)", "Emission factor for storage facility (kg CO2e/m3/day)"])
|
| 255 |
+
|
| 256 |
+
calculate_emissions_category_4_method_5(storage_data)
|
| 257 |
+
|
| 258 |
+
def get_input_category_5_method_1():
|
| 259 |
+
st.subheader("Method 1: CO2e emissions from waste generated in operations")
|
| 260 |
+
waste_treatment_data = dynamic_input_fields("Waste Treatment Provider", ["Allocated emissions"], ["Allocated scope 1 and scope 2 emissions of waste treatment company"])
|
| 261 |
+
calculate_emissions_category_5_method_1(waste_treatment_data)
|
| 262 |
+
|
| 263 |
+
def calculate_emissions_category_5_method_1(waste_treatment_data):
|
| 264 |
+
total_emissions = sum([item["Allocated emissions"] for item in waste_treatment_data])
|
| 265 |
+
st.header(f"Total Emissions for Method 1: {total_emissions} kg CO2e")
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
def get_input_category_5_method_2():
|
| 269 |
+
st.subheader("Method 2: CO2e emissions from waste generated in operations")
|
| 270 |
+
waste_type_data = dynamic_input_fields_with_emission_factor("Waste Type", "Enter waste type data",
|
| 271 |
+
["Waste produced (tonnes)", "Waste treatment", "Waste type and waste treatment specific emission factor"],
|
| 272 |
+
["Waste produced (tonnes)", "Waste treatment", "Waste type and waste treatment specific emission factor"])
|
| 273 |
+
calculate_emissions_category_5_method_2(waste_type_data)
|
| 274 |
+
|
| 275 |
+
def calculate_emissions_category_5_method_2(waste_type_data):
|
| 276 |
+
total_emissions = sum([
|
| 277 |
+
item["Waste produced (tonnes)"] * item["Waste type and waste treatment specific emission factor"]
|
| 278 |
+
for item in waste_type_data
|
| 279 |
+
])
|
| 280 |
+
st.header(f"Total Emissions for Method 2: {total_emissions} kg CO2e")
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
def get_input_category_5_method_3():
|
| 284 |
+
st.subheader("Method 3: Average Method - CO2e emissions from waste generated in operations")
|
| 285 |
+
waste_treatment_method_data = dynamic_input_fields_with_emission_factor("Waste Treatment Method", "Enter waste treatment method data",
|
| 286 |
+
["Total mass of waste (tonnes)", "Proportion (percent)", "Emission factor (kg CO2e/tonne)"],
|
| 287 |
+
["Total mass of waste (tonnes)", "Proportion (percent)", "Emission factor (kg CO2e/tonne)"])
|
| 288 |
+
calculate_emissions_category_5_method_3(waste_treatment_method_data)
|
| 289 |
+
|
| 290 |
+
def calculate_emissions_category_5_method_3(waste_treatment_method_data):
|
| 291 |
+
total_emissions = sum([
|
| 292 |
+
item["Total mass of waste (tonnes)"] * (item["Proportion (percent)"] / 100) * item["Emission factor (kg CO2e/tonne)"]
|
| 293 |
+
for item in waste_treatment_method_data
|
| 294 |
+
])
|
| 295 |
+
st.header(f"Total Emissions for Method 3: {total_emissions} kg CO2e")
|
| 296 |
+
|
| 297 |
+
def get_input_category_6_method_1():
|
| 298 |
+
st.subheader("Method 1: Distance-based Method - Business Travel Emissions")
|
| 299 |
+
road_travel_data = dynamic_input_fields_with_dropdown_int("Road Travel", "Select road travel data",
|
| 300 |
+
["Location", "Average employees per vehicle","Number of employees in group", "Car_type", "Distance (km)", "Emission factor (kg CO2e/vehicle-km)"],
|
| 301 |
+
["Location", "Average employees per vehicle", "Number of employees in group", "Car_type", "Distance (km)", "Emission factor (kg CO2e/vehicle-km)"])
|
| 302 |
+
|
| 303 |
+
air_travel_data = dynamic_input_fields_with_dropdown_int("Air Travel", "Select air travel data",
|
| 304 |
+
["Number of employees in group", "Flight type", "Distance (km)", "Emission factor (kg CO2e/passenger-km)"],
|
| 305 |
+
["Number of employees in group", "Flight type", "Distance (km)", "Emission factor (kg CO2e/passenger-km)"])
|
| 306 |
+
|
| 307 |
+
include_hotel = st.checkbox("Include Hotel Emissions (Optional)")
|
| 308 |
+
hotel_data = []
|
| 309 |
+
if include_hotel:
|
| 310 |
+
hotel_data = dynamic_input_fields("Hotel", ["Annual number of hotel nights", "Hotel emission factor (kg CO2e/night)"],
|
| 311 |
+
["Annual number of hotel nights", "Hotel emission factor (kg CO2e/night)"])
|
| 312 |
+
|
| 313 |
+
calculate_emissions_category_6_method_1(road_travel_data, air_travel_data, hotel_data)
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
def calculate_emissions_category_6_method_1(road_travel_data, air_travel_data, hotel_data):
|
| 318 |
+
road_travel_emissions = 0
|
| 319 |
+
for item in road_travel_data:
|
| 320 |
+
if item["Average employees per vehicle"] != 0:
|
| 321 |
+
road_travel_emissions += (item["Distance (km)"] / item["Average employees per vehicle"]) * item["Emission factor (kg CO2e/vehicle-km)"]
|
| 322 |
+
|
| 323 |
+
air_travel_emissions = sum([
|
| 324 |
+
item["Distance (km)"] * item["Emission factor (kg CO2e/passenger-km)"]
|
| 325 |
+
for item in air_travel_data
|
| 326 |
+
])
|
| 327 |
+
|
| 328 |
+
total_emissions = road_travel_emissions + air_travel_emissions
|
| 329 |
+
|
| 330 |
+
if hotel_data:
|
| 331 |
+
hotel_emissions = sum([
|
| 332 |
+
item["Annual number of hotel nights"] * item["Hotel emission factor (kg CO2e/night)"]
|
| 333 |
+
for item in hotel_data
|
| 334 |
+
])
|
| 335 |
+
total_emissions += hotel_emissions
|
| 336 |
+
|
| 337 |
+
st.header(f"Total Business Travel Emissions: {total_emissions} kg CO2e")
|
| 338 |
+
|
| 339 |
+
def get_input_category_7_method_1():
|
| 340 |
+
st.subheader("Method 1: Distance-based Method - Employee Travel Emissions")
|
| 341 |
+
|
| 342 |
+
employee_data = dynamic_input_fields_with_dropdown_int("Employee", "Select employee data",
|
| 343 |
+
["Rail commute (times per week)", "One way distance by rail (km)",
|
| 344 |
+
"Rail emission factor (kg CO2e/passenger-km)",
|
| 345 |
+
"Car commute (times per week)", "Car emission factor (kg CO2e/vehicle-km)",
|
| 346 |
+
"One way distance by car (km)"],
|
| 347 |
+
["Rail commute (times per week)", "One way distance by rail (km)",
|
| 348 |
+
"Rail emission factor (kg CO2e/passenger-km)",
|
| 349 |
+
"Car commute (times per week)", "Car emission factor (kg CO2e/vehicle-km)",
|
| 350 |
+
"One way distance by car (km)"])
|
| 351 |
+
|
| 352 |
+
telework_data = dynamic_input_fields_with_dropdown_int("Telework", "Select telework data",
|
| 353 |
+
["Quantities of energy consumed (kWh)", "Emission factor for energy source (kg CO2e/kWh)"],
|
| 354 |
+
["Quantities of energy consumed (kWh)", "Emission factor for energy source (kg CO2e/kWh)"])
|
| 355 |
+
|
| 356 |
+
calculate_emissions_category_7_method_1(employee_data, telework_data)
|
| 357 |
+
|
| 358 |
+
def calculate_emissions_category_7_method_1(employee_data, telework_data):
|
| 359 |
+
total_distance_rail = sum([
|
| 360 |
+
item["Rail commute (times per week)"] * 2 * 5 * item["One way distance by rail (km)"]
|
| 361 |
+
for item in employee_data
|
| 362 |
+
])
|
| 363 |
+
|
| 364 |
+
total_distance_car = sum([
|
| 365 |
+
item["Car commute (times per week)"] * 2 * 5 * item["One way distance by car (km)"]
|
| 366 |
+
for item in employee_data
|
| 367 |
+
])
|
| 368 |
+
|
| 369 |
+
total_emissions = sum([
|
| 370 |
+
(total_distance_rail * item["Rail emission factor (kg CO2e/passenger-km)"]) +
|
| 371 |
+
(total_distance_car * item["Car emission factor (kg CO2e/vehicle-km)"])
|
| 372 |
+
for item in employee_data
|
| 373 |
+
])
|
| 374 |
+
|
| 375 |
+
if telework_data:
|
| 376 |
+
total_emissions += sum([
|
| 377 |
+
item["Quantities of energy consumed (kWh)"] * item["Emission factor for energy source (kg CO2e/kWh)"]
|
| 378 |
+
for item in telework_data
|
| 379 |
+
])
|
| 380 |
+
|
| 381 |
+
st.header(f"Total Employee Travel Emissions (Method 1): {total_emissions} kg CO2e")
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
def get_input_category_7_method_2():
|
| 385 |
+
st.subheader("Method 2: Average-data Method - Employee Travel Emissions")
|
| 386 |
+
|
| 387 |
+
commute_data = dynamic_input_fields_with_dropdown_int("Commute Group", "Select commute group data",
|
| 388 |
+
["Percent of total commutes", "Average one-way distance (km)",
|
| 389 |
+
"Emission factor (kg CO2e/vehicle or passenger km)"],
|
| 390 |
+
["Percent of total commutes", "Average one-way distance (km)",
|
| 391 |
+
"Emission factor (kg CO2e/vehicle or passenger km)"])
|
| 392 |
+
|
| 393 |
+
total_employees = st.number_input("Enter the total number of employees:", min_value=1, step=1, key="total_employees")
|
| 394 |
+
|
| 395 |
+
calculate_emissions_category_7_method_2(commute_data, total_employees)
|
| 396 |
+
|
| 397 |
+
def calculate_emissions_category_7_method_2(commute_data, total_employees):
|
| 398 |
+
total_emissions = sum([
|
| 399 |
+
total_employees * (item["Percent of total commutes"] / 100) * 2 * 235 * item["Average one-way distance (km)"] *
|
| 400 |
+
item["Emission factor (kg CO2e/vehicle or passenger km)"]
|
| 401 |
+
for item in commute_data
|
| 402 |
+
])
|
| 403 |
+
|
| 404 |
+
st.header(f"Total Employee Travel Emissions (Method 2): {total_emissions} kg CO2e")
|
| 405 |
+
|
| 406 |
+
def get_input_category_8_method_1():
|
| 407 |
+
st.subheader("Method 1: Asset-specific method - Upstream Leased Assets Emissions")
|
| 408 |
+
asset_data = dynamic_input_fields("Upstream Leased Asset", ["Natural gas (kWh)", "Natural gas emission factor (kg CO2e/kWh)",
|
| 409 |
+
"Electricity (kWh)", "Electricity emission factor (kg CO2e/kWh)",
|
| 410 |
+
"Fugitive emissions", "Fugitive emission factor"],
|
| 411 |
+
["Natural gas (kWh)", "Natural gas emission factor (kg CO2e/kWh)",
|
| 412 |
+
"Electricity (kWh)", "Electricity emission factor (kg CO2e/kWh)",
|
| 413 |
+
"Fugitive emissions", "Fugitive emission factor"])
|
| 414 |
+
|
| 415 |
+
calculate_emissions_category_8_method_1(asset_data)
|
| 416 |
+
|
| 417 |
+
def calculate_emissions_category_8_method_1(asset_data):
|
| 418 |
+
total_emissions = sum([
|
| 419 |
+
(
|
| 420 |
+
item["Natural gas (kWh)"] * item["Natural gas emission factor (kg CO2e/kWh)"]
|
| 421 |
+
+ item["Electricity (kWh)"] * item["Electricity emission factor (kg CO2e/kWh)"]
|
| 422 |
+
+ item["Fugitive emissions"] * item["Fugitive emission factor"]
|
| 423 |
+
)
|
| 424 |
+
for item in asset_data
|
| 425 |
+
])
|
| 426 |
+
|
| 427 |
+
st.header(f"Total Emissions from Upstream Leased Assets (Asset-specific Method): {total_emissions} kg CO2e")
|
| 428 |
+
|
| 429 |
+
def calculate_emissions_category_8_method_2(lessor_data, leased_asset_data):
|
| 430 |
+
total_emissions = sum([
|
| 431 |
+
(
|
| 432 |
+
item["Fuel consumed (e.g., liter)"] * item["Emission factor for fuel source (e.g., kg CO2e/liter)"]
|
| 433 |
+
+ item["Refrigerant leakage (kg)"] * item["Emission factor for refrigerant (kg CO2e/kg)"]
|
| 434 |
+
+ item["Process emissions"]
|
| 435 |
+
+ item["Electricity, steam, heating, cooling consumed (e.g., kWh)"]
|
| 436 |
+
* item["Emission factor for electricity, steam, heating, cooling (e.g., kg CO2e/kWh)"]
|
| 437 |
+
)
|
| 438 |
+
for item in lessor_data
|
| 439 |
+
])
|
| 440 |
+
|
| 441 |
+
total_emissions_allocated = sum([
|
| 442 |
+
(item["Scope 1 and Scope 2 emissions of lessor (kg CO2e)"]
|
| 443 |
+
* item["Area, volume, quantity, etc., of the leased asset"]
|
| 444 |
+
/ item["Total area, volume, quantity, etc., of lessor assets"]) if item["Total area, volume, quantity, etc., of lessor assets"] != 0 else 0
|
| 445 |
+
for item in leased_asset_data
|
| 446 |
+
])
|
| 447 |
+
|
| 448 |
+
st.header(f"Total Emissions from Upstream Leased Assets (CO2e Emissions from Leased Assets Method): {total_emissions + total_emissions_allocated} kg CO2e")
|
| 449 |
+
|
| 450 |
+
def calculate_emissions_category_8_method_3(building_data):
|
| 451 |
+
total_emissions = sum([
|
| 452 |
+
item["Total floor space of building type (m2)"] * item["Average emission factor for building type (kg CO2e/m2/year)"]
|
| 453 |
+
for item in building_data
|
| 454 |
+
])
|
| 455 |
+
|
| 456 |
+
st.header(f"Total Emissions from Upstream Leased Assets (Average-data Method for Leased Buildings): {total_emissions} kg CO2e")
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
def calculate_emissions_category_8_method_4(asset_data):
|
| 460 |
+
total_emissions = sum([
|
| 461 |
+
item["Number of assets"] * item["Average emissions per asset type (kg CO2e/asset type/year)"]
|
| 462 |
+
for item in asset_data
|
| 463 |
+
])
|
| 464 |
+
|
| 465 |
+
st.header(f"Total Emissions from Upstream Leased Assets (Average-data Method for Other Leased Assets): {total_emissions} kg CO2e")
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
def get_input_category_8_method_2():
|
| 469 |
+
st.subheader("Method 2: CO2e emissions from leased assets - Upstream Leased Assets Emissions")
|
| 470 |
+
lessor_data = dynamic_input_fields("Lessor", ["Fuel consumed (e.g., liter)", "Emission factor for fuel source (e.g., kg CO2e/liter)",
|
| 471 |
+
"Refrigerant leakage (kg)", "Emission factor for refrigerant (kg CO2e/kg)",
|
| 472 |
+
"Process emissions", "Electricity, steam, heating, cooling consumed (e.g., kWh)",
|
| 473 |
+
"Emission factor for electricity, steam, heating, cooling (e.g., kg CO2e/kWh)"],
|
| 474 |
+
["Fuel consumed (e.g., liter)", "Emission factor for fuel source (e.g., kg CO2e/liter)",
|
| 475 |
+
"Refrigerant leakage (kg)", "Emission factor for refrigerant (kg CO2e/kg)",
|
| 476 |
+
"Process emissions", "Electricity, steam, heating, cooling consumed (e.g., kWh)",
|
| 477 |
+
"Emission factor for electricity, steam, heating, cooling (e.g., kg CO2e/kWh)"])
|
| 478 |
+
|
| 479 |
+
leased_asset_data = dynamic_input_fields("Leased Asset", ["Scope 1 and Scope 2 emissions of lessor (kg CO2e)",
|
| 480 |
+
"Area, volume, quantity, etc., of the leased asset",
|
| 481 |
+
"Total area, volume, quantity, etc., of lessor assets"],
|
| 482 |
+
["Scope 1 and Scope 2 emissions of lessor (kg CO2e)",
|
| 483 |
+
"Area, volume, quantity, etc., of the leased asset",
|
| 484 |
+
"Total area, volume, quantity, etc., of lessor assets"])
|
| 485 |
+
|
| 486 |
+
calculate_emissions_category_8_method_2(lessor_data, leased_asset_data)
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
def get_input_category_8_method_3():
|
| 490 |
+
st.subheader("Method 3: Average-data method for leased buildings - Upstream Leased Assets Emissions")
|
| 491 |
+
building_data = dynamic_input_fields("Building", ["Total floor space of building type (m2)",
|
| 492 |
+
"Average emission factor for building type (kg CO2e/m2/year)"],
|
| 493 |
+
["Total floor space of building type (m2)",
|
| 494 |
+
"Average emission factor for building type (kg CO2e/m2/year)"])
|
| 495 |
+
|
| 496 |
+
calculate_emissions_category_8_method_3(building_data)
|
| 497 |
+
|
| 498 |
+
|
| 499 |
+
def get_input_category_8_method_4():
|
| 500 |
+
st.subheader("Method 4: Average-data method for leased assets other than buildings - Upstream Leased Assets Emissions")
|
| 501 |
+
asset_data = dynamic_input_fields("Leased Asset", ["Number of assets", "Average emissions per asset type (kg CO2e/asset type/year)"],
|
| 502 |
+
["Number of assets", "Average emissions per asset type (kg CO2e/asset type/year)"])
|
| 503 |
+
|
| 504 |
+
calculate_emissions_category_8_method_4(asset_data)
|
| 505 |
+
|
| 506 |
+
def calculate_emissions_category_9_method_1(transportation_data):
|
| 507 |
+
total_emissions = sum([
|
| 508 |
+
item["Mass of goods sold (tonnes)"] * item["Total downstream distance transported (km)"]
|
| 509 |
+
* item["Emission factor (kg CO2e/tonne-km)"]
|
| 510 |
+
for item in transportation_data
|
| 511 |
+
])
|
| 512 |
+
|
| 513 |
+
st.header(f"Total Emissions from Downstream Transportation: {total_emissions} kg CO2e")
|
| 514 |
+
|
| 515 |
+
def get_input_category_9_method_1():
|
| 516 |
+
st.subheader("Method 1: Downstream Transportation Emissions")
|
| 517 |
+
transportation_data = dynamic_input_fields("Transportation", ["Mass of goods sold (tonnes)",
|
| 518 |
+
"Total downstream distance transported (km)",
|
| 519 |
+
"Transport mode or vehicle type",
|
| 520 |
+
"Emission factor (kg CO2e/tonne-km)"],
|
| 521 |
+
["Mass of goods sold (tonnes)",
|
| 522 |
+
"Total downstream distance transported (km)",
|
| 523 |
+
"Transport mode or vehicle type",
|
| 524 |
+
"Emission factor (kg CO2e/tonne-km)"])
|
| 525 |
+
|
| 526 |
+
calculate_emissions_category_9_method_1(transportation_data)
|
| 527 |
+
|
| 528 |
+
def get_input_category_10_method_1():
|
| 529 |
+
st.subheader("Method 1: Site-specific Method - Processing of Sold Intermediate Products")
|
| 530 |
+
|
| 531 |
+
fuel_data = dynamic_input_fields("Fuel", ["Quantity consumed (e.g., liter)", "Life cycle emission factor (kg CO2e/liter)"],
|
| 532 |
+
["Quantity consumed (e.g., liter)", "Life cycle emission factor (kg CO2e/liter)"])
|
| 533 |
+
|
| 534 |
+
electricity_data = dynamic_input_fields("Electricity", ["Quantity consumed (e.g., kWh)", "Life cycle emission factor (kg CO2e/kWh)"],
|
| 535 |
+
["Quantity consumed (e.g., kWh)", "Life cycle emission factor (kg CO2e/kWh)"])
|
| 536 |
+
|
| 537 |
+
refrigerant_data = dynamic_input_fields("Refrigerant", ["Quantity of leakage (kg)", "Global Warming Potential (kg CO2e/kg)"],
|
| 538 |
+
["Quantity of leakage (kg)", "Global Warming Potential (kg CO2e/kg)"])
|
| 539 |
|
| 540 |
+
process_emissions = st.number_input("Sum of Process Emissions (kg CO2e)", min_value=0.0, step=0.1)
|
| 541 |
|
| 542 |
+
include_waste = st.checkbox("Include Waste Emissions (Optional)")
|
| 543 |
+
waste_data = []
|
| 544 |
+
if include_waste:
|
| 545 |
+
waste_data = dynamic_input_fields("Waste", ["Mass of waste output (kg)", "Emission factor (kg CO2e/kg waste)"],
|
| 546 |
+
["Mass of waste output (kg)", "Emission factor (kg CO2e/kg waste)"])
|
| 547 |
+
|
| 548 |
+
calculate_emissions_category_10_method_1(fuel_data, electricity_data, refrigerant_data, process_emissions, waste_data)
|
| 549 |
+
|
| 550 |
+
def calculate_emissions_category_10_method_1(fuel_data, electricity_data, refrigerant_data, process_emissions, waste_data):
|
| 551 |
+
total_fuel_emissions = sum([
|
| 552 |
+
item["Quantity consumed (e.g., liter)"] * item["Life cycle emission factor (kg CO2e/liter)"]
|
| 553 |
+
for item in fuel_data
|
| 554 |
+
])
|
| 555 |
+
|
| 556 |
+
total_electricity_emissions = sum([
|
| 557 |
+
item["Quantity consumed (e.g., kWh)"] * item["Life cycle emission factor (kg CO2e/kWh)"]
|
| 558 |
+
for item in electricity_data
|
| 559 |
+
])
|
| 560 |
+
|
| 561 |
+
total_refrigerant_emissions = sum([
|
| 562 |
+
item["Quantity of leakage (kg)"] * item["Global Warming Potential (kg CO2e/kg)"]
|
| 563 |
+
for item in refrigerant_data
|
| 564 |
+
])
|
| 565 |
+
|
| 566 |
+
total_waste_emissions = 0.0
|
| 567 |
+
if waste_data:
|
| 568 |
+
total_waste_emissions = sum([
|
| 569 |
+
item["Mass of waste output (kg)"] * item["Emission factor (kg CO2e/kg waste)"]
|
| 570 |
+
for item in waste_data
|
| 571 |
+
])
|
| 572 |
+
|
| 573 |
+
total_emissions = total_fuel_emissions + total_electricity_emissions + total_refrigerant_emissions + process_emissions + total_waste_emissions
|
| 574 |
+
st.header(f"Total Emissions from Processing of Sold Intermediate Products (Method 1): {total_emissions} kg CO2e")
|
| 575 |
+
|
| 576 |
+
def get_input_category_10_method_2():
|
| 577 |
+
st.subheader("Method 2: Average-data Method - Processing of Sold Intermediate Products")
|
| 578 |
+
|
| 579 |
+
product_data = dynamic_input_fields("Intermediate Product", ["Mass of sold intermediate product (kg)", "Emission factor of processing stages (kg CO2e/kg of final product)"],
|
| 580 |
+
["Mass of sold intermediate product (kg)", "Emission factor of processing stages (kg CO2e/kg of final product)"])
|
| 581 |
+
|
| 582 |
+
calculate_emissions_category_10_method_2(product_data)
|
| 583 |
+
|
| 584 |
+
def calculate_emissions_category_10_method_2(product_data):
|
| 585 |
+
total_emissions = sum([
|
| 586 |
+
item["Mass of sold intermediate product (kg)"] * item["Emission factor of processing stages (kg CO2e/kg of final product)"]
|
| 587 |
+
for item in product_data
|
| 588 |
+
])
|
| 589 |
+
st.header(f"Total Emissions from Processing of Sold Intermediate Products (Method 2): {total_emissions} kg CO2e")
|
| 590 |
+
|
| 591 |
+
def get_input_category_11_method_1():
|
| 592 |
+
st.subheader("Method 1: Direct Use-phase Emissions from Products Consuming Energy (Fuels or Electricity) during Use")
|
| 593 |
+
|
| 594 |
+
product_data = dynamic_input_fields("Product", ["Total lifetime expected uses", "Number sold",
|
| 595 |
+
"Fuel consumed per use (kWh)", "Emission factor for fuel (kg CO2e/kWh)"],
|
| 596 |
+
["Total lifetime expected uses", "Number sold",
|
| 597 |
+
"Fuel consumed per use (kWh)", "Emission factor for fuel (kg CO2e/kWh)"])
|
| 598 |
+
|
| 599 |
+
include_electricity = st.checkbox("Include Electricity Emissions (Optional)")
|
| 600 |
+
electricity_data = []
|
| 601 |
+
if include_electricity:
|
| 602 |
+
electricity_data = dynamic_input_fields("Product Electricity", ["Electricity consumed per use (kWh)", "Emission factor for electricity (kg CO2e/kWh)"],
|
| 603 |
+
["Electricity consumed per use (kWh)", "Emission factor for electricity (kg CO2e/kWh)"])
|
| 604 |
+
|
| 605 |
+
refrigerant_data = dynamic_input_fields("Product Refrigerant", ["Refrigerant leakage per use (kg)", "Global Warming Potential (kg CO2e/kg)"],
|
| 606 |
+
["Refrigerant leakage per use (kg)", "Global Warming Potential (kg CO2e/kg)"])
|
| 607 |
+
|
| 608 |
+
calculate_emissions_category_11_method_1(product_data, electricity_data, refrigerant_data)
|
| 609 |
+
|
| 610 |
+
def calculate_emissions_category_11_method_1(product_data, electricity_data, refrigerant_data):
|
| 611 |
+
total_fuel_emissions = sum([
|
| 612 |
+
item["Total lifetime expected uses"] * item["Number sold"] * item["Fuel consumed per use (kWh)"] * item["Emission factor for fuel (kg CO2e/kWh)"]
|
| 613 |
+
for item in product_data
|
| 614 |
+
])
|
| 615 |
+
|
| 616 |
+
total_electricity_emissions = 0.0
|
| 617 |
+
if electricity_data:
|
| 618 |
+
total_electricity_emissions = sum([
|
| 619 |
+
item1["Total lifetime expected uses"] * item1["Number sold"] * item["Electricity consumed per use (kWh)"] * item["Emission factor for electricity (kg CO2e/kWh)"]
|
| 620 |
+
for item in electricity_data for item1 in product_data
|
| 621 |
+
])
|
| 622 |
+
|
| 623 |
+
total_refrigerant_emissions = sum([
|
| 624 |
+
item1["Total lifetime expected uses"] * item1["Number sold"] * item["Refrigerant leakage per use (kg)"] * item["Global Warming Potential (kg CO2e/kg)"]
|
| 625 |
+
for item in refrigerant_data for item1 in product_data
|
| 626 |
+
])
|
| 627 |
+
|
| 628 |
+
total_emissions = total_fuel_emissions + total_electricity_emissions + total_refrigerant_emissions
|
| 629 |
+
st.header(f"Total Emissions from Use of Sold Products (Method 1): {total_emissions} kg CO2e")
|
| 630 |
+
|
| 631 |
+
def get_input_category_11_method_2():
|
| 632 |
+
st.subheader("Method 2: Direct Use-phase Emissions from Combusted Fuels and Feedstocks")
|
| 633 |
+
|
| 634 |
+
fuel_data = dynamic_input_fields("Fuel/Feedstock", ["Total quantity sold (e.g., kWh)", "Combustion emission factor (kg CO2e/kWh)"],
|
| 635 |
+
["Total quantity sold (e.g., kWh)", "Combustion emission factor (kg CO2e/kWh)"])
|
| 636 |
+
|
| 637 |
+
calculate_emissions_category_11_method_2(fuel_data)
|
| 638 |
+
|
| 639 |
+
def calculate_emissions_category_11_method_2(fuel_data):
|
| 640 |
+
total_fuel_emissions = sum([
|
| 641 |
+
item["Total quantity sold (e.g., kWh)"] * item["Combustion emission factor (kg CO2e/kWh)"]
|
| 642 |
+
for item in fuel_data
|
| 643 |
+
])
|
| 644 |
+
st.header(f"Total Emissions from Use of Sold Products (Method 2): {total_fuel_emissions} kg CO2e")
|
| 645 |
+
|
| 646 |
+
def get_input_category_11_method_3():
|
| 647 |
+
st.subheader("Method 3: Direct Use-phase Emissions from Greenhouse Gases and Products Containing or Forming Greenhouse Gases")
|
| 648 |
+
|
| 649 |
+
ghg_data = dynamic_input_fields("GHG/Product Group", ["GHG contained per product", "Total Number of products sold",
|
| 650 |
+
"% of GHG released during lifetime use of product", "GWP of the GHG"],
|
| 651 |
+
["GHG contained per product", "Total Number of products sold",
|
| 652 |
+
"% of GHG released during lifetime use of product", "GWP of the GHG"])
|
| 653 |
+
|
| 654 |
+
calculate_emissions_category_11_method_3(ghg_data)
|
| 655 |
+
|
| 656 |
+
def calculate_emissions_category_11_method_3(ghg_data):
|
| 657 |
+
total_emissions = sum([
|
| 658 |
+
item["GHG contained per product"] * item["Total Number of products sold"] *
|
| 659 |
+
item["% of GHG released during lifetime use of product"] * item["GWP of the GHG"]
|
| 660 |
+
for item in ghg_data
|
| 661 |
+
])
|
| 662 |
+
st.header(f"Total Emissions from Use of Sold Products (Method 3): {total_emissions} kg CO2e")
|
| 663 |
+
|
| 664 |
+
def get_input_category_11_method_4():
|
| 665 |
+
st.subheader("Method 4: Indirect Use-phase CO2e Emissions of Products")
|
| 666 |
+
|
| 667 |
+
use_scenario_data = dynamic_input_fields("Use Scenario", ["% of total lifetime uses", "Number sold",
|
| 668 |
+
"Fuel consumed per use (e.g., kWh)", "Emission factor for fuel (e.g., kg CO2e/kWh)"],
|
| 669 |
+
["% of total lifetime uses", "Number sold",
|
| 670 |
+
"Fuel consumed per use (e.g., kWh)", "Emission factor for fuel (e.g., kg CO2e/kWh)"])
|
| 671 |
+
|
| 672 |
+
include_electricity = st.checkbox("Include Electricity Emissions (Optional)")
|
| 673 |
+
electricity_data = []
|
| 674 |
+
if include_electricity:
|
| 675 |
+
electricity_data = dynamic_input_fields("Use Scenario electricity", ["% of total lifetime uses", "Number sold",
|
| 676 |
+
"Electricity consumed per use (kWh)", "Emission factor for electricity (kg CO2e/kWh)"],
|
| 677 |
+
["% of total lifetime uses", "Number sold",
|
| 678 |
+
"Electricity consumed per use (kWh)", "Emission factor for electricity (kg CO2e/kWh)"])
|
| 679 |
+
|
| 680 |
+
refrigerant_data = dynamic_input_fields("Use Scenario refrigerant", ["% of total lifetime uses", "Number sold",
|
| 681 |
+
"Refrigerant leakage per use (kg)", "Emission factor for refrigerant (kg CO2e/kg)"],
|
| 682 |
+
["% of total lifetime uses", "Number sold",
|
| 683 |
+
"Refrigerant leakage per use (kg)", "Emission factor for refrigerant (kg CO2e/kg)"])
|
| 684 |
+
|
| 685 |
+
ghg_data = dynamic_input_fields("Use Scenario ghg data", ["% of total lifetime uses", "Number sold",
|
| 686 |
+
"GHG emitted indirectly (kg)", "GWP of the GHG"],
|
| 687 |
+
["% of total lifetime uses", "Number sold",
|
| 688 |
+
"GHG emitted indirectly (kg)", "GWP of the GHG"])
|
| 689 |
+
|
| 690 |
+
calculate_emissions_category_11_method_4(use_scenario_data, electricity_data, refrigerant_data, ghg_data)
|
| 691 |
+
|
| 692 |
+
def calculate_emissions_category_11_method_4(use_scenario_data, electricity_data, refrigerant_data, ghg_data):
|
| 693 |
+
total_fuel_emissions = sum([
|
| 694 |
+
item["% of total lifetime uses"] * item["Number sold"] * item["Fuel consumed per use (e.g., kWh)"] * item["Emission factor for fuel (e.g., kg CO2e/kWh)"]
|
| 695 |
+
for item in use_scenario_data
|
| 696 |
+
])
|
| 697 |
+
|
| 698 |
+
total_electricity_emissions = 0.0
|
| 699 |
+
if electricity_data:
|
| 700 |
+
total_electricity_emissions = sum([
|
| 701 |
+
item["% of total lifetime uses"] * item["Number sold"] * item["Electricity consumed per use (kWh)"] * item["Emission factor for electricity (kg CO2e/kWh)"]
|
| 702 |
+
for item in electricity_data
|
| 703 |
+
])
|
| 704 |
+
|
| 705 |
+
total_refrigerant_emissions = sum([
|
| 706 |
+
item["% of total lifetime uses"] * item["Number sold"] * item["Refrigerant leakage per use (kg)"] * item["Emission factor for refrigerant (kg CO2e/kg)"]
|
| 707 |
+
for item in refrigerant_data
|
| 708 |
+
])
|
| 709 |
+
|
| 710 |
+
total_ghg_emissions = sum([
|
| 711 |
+
item["% of total lifetime uses"] * item["Number sold"] * item["GHG emitted indirectly (kg)"] * item["GWP of the GHG"]
|
| 712 |
+
for item in ghg_data
|
| 713 |
+
])
|
| 714 |
+
|
| 715 |
+
total_emissions = total_fuel_emissions + total_electricity_emissions + total_refrigerant_emissions + total_ghg_emissions
|
| 716 |
+
st.header(f"Total Emissions from Use of Sold Products (Method 4): {total_emissions} kg CO2e")
|
| 717 |
+
|
| 718 |
+
def get_input_category_11_method_5():
|
| 719 |
+
st.subheader("Method 5: Use-phase CO2e Emissions of Sold Intermediate Products")
|
| 720 |
+
|
| 721 |
+
intermediate_product_data = dynamic_input_fields("Intermediate Product", ["Total intermediate products sold",
|
| 722 |
+
"Total lifetime uses of final sold product",
|
| 723 |
+
"Emissions per use of sold intermediate product (kg CO2e/use)"],
|
| 724 |
+
["Total intermediate products sold",
|
| 725 |
+
"Total lifetime uses of final sold product",
|
| 726 |
+
"Emissions per use of sold intermediate product (kg CO2e/use)"])
|
| 727 |
+
|
| 728 |
+
calculate_emissions_category_11_method_5(intermediate_product_data)
|
| 729 |
+
|
| 730 |
+
def calculate_emissions_category_11_method_5(intermediate_product_data):
|
| 731 |
+
total_emissions = sum([
|
| 732 |
+
item["Total intermediate products sold"] * item["Total lifetime uses of final sold product"] *
|
| 733 |
+
item["Emissions per use of sold intermediate product (kg CO2e/use)"]
|
| 734 |
+
for item in intermediate_product_data
|
| 735 |
+
])
|
| 736 |
+
st.header(f"Total Emissions from Use of Sold Products (Method 5): {total_emissions} kg CO2e")
|
| 737 |
+
|
| 738 |
+
def get_input_category_12_method_1():
|
| 739 |
+
st.subheader("Category 12: End-of-Life Treatment of Sold Products - Method 1: Waste-type-specific method")
|
| 740 |
+
|
| 741 |
+
waste_data = dynamic_input_fields("Waste Treatment Method", ["Total mass of sold products and packaging (kg)",
|
| 742 |
+
"Proportion of waste produced (%)",
|
| 743 |
+
"Emission factor of waste treatment method (kg CO2e/kg)"],
|
| 744 |
+
["Total mass of sold products and packaging (kg)",
|
| 745 |
+
"Proportion of waste produced (%)",
|
| 746 |
+
"Emission factor of waste treatment method (kg CO2e/kg)"])
|
| 747 |
+
|
| 748 |
+
calculate_emissions_category_12_method_1(waste_data)
|
| 749 |
+
|
| 750 |
+
def calculate_emissions_category_12_method_1(waste_data):
|
| 751 |
+
total_emissions = sum([
|
| 752 |
+
item["Total mass of sold products and packaging (kg)"] *
|
| 753 |
+
(item["Proportion of waste produced (%)"] / 100) *
|
| 754 |
+
item["Emission factor of waste treatment method (kg CO2e/kg)"]
|
| 755 |
+
for item in waste_data
|
| 756 |
+
])
|
| 757 |
+
st.header(f"Total CO2e Emissions from End-of-Life Treatment of Sold Products (Method 1): {total_emissions} kg CO2e")
|
| 758 |
+
|
| 759 |
+
def get_input_category_13():
|
| 760 |
+
st.subheader("Category 13: Downstream Leased Assets")
|
| 761 |
+
|
| 762 |
+
leased_assets_data = dynamic_input_fields("Lessee", ["Scope 1 and Scope 2 emissions (kg CO2e)",
|
| 763 |
+
"Physical area of the leased asset (e.g., area, volume)"],
|
| 764 |
+
["Scope 1 and Scope 2 emissions (kg CO2e)",
|
| 765 |
+
"Physical area of the leased asset (e.g., area, volume)"])
|
| 766 |
+
|
| 767 |
+
calculate_emissions_category_13(leased_assets_data)
|
| 768 |
+
|
| 769 |
+
def calculate_emissions_category_13(leased_assets_data):
|
| 770 |
+
total_physical_area = calculate_total_physical_area(leased_assets_data)
|
| 771 |
+
|
| 772 |
+
total_emissions = sum([
|
| 773 |
+
item["Scope 1 and Scope 2 emissions (kg CO2e)"] *
|
| 774 |
+
(item["Physical area of the leased asset (e.g., area, volume)"] / total_physical_area) if total_physical_area!=0 else 0
|
| 775 |
+
for item in leased_assets_data
|
| 776 |
+
])
|
| 777 |
+
st.header(f"Total CO2e Emissions from Leased Assets (Category 13): {total_emissions} kg CO2e")
|
| 778 |
+
|
| 779 |
+
def calculate_total_physical_area(leased_assets_data):
|
| 780 |
+
return sum([item["Physical area of the leased asset (e.g., area, volume)"] for item in leased_assets_data])
|
| 781 |
+
|
| 782 |
+
def get_input_category_14_method_1():
|
| 783 |
+
st.subheader("Category 14: Franchises - Method 1: Franchise-specific method")
|
| 784 |
+
|
| 785 |
+
franchise_data = dynamic_input_fields("Franchise", ["Scope 1 emissions (kg CO2e)", "Scope 2 emissions (kg CO2e)"],
|
| 786 |
+
["Scope 1 emissions (kg CO2e)", "Scope 2 emissions (kg CO2e)"])
|
| 787 |
+
|
| 788 |
+
calculate_emissions_category_14_method_1(franchise_data)
|
| 789 |
+
|
| 790 |
+
def calculate_emissions_category_14_method_1(franchise_data):
|
| 791 |
+
total_emissions = sum([
|
| 792 |
+
item["Scope 1 emissions (kg CO2e)"] + item["Scope 2 emissions (kg CO2e)"]
|
| 793 |
+
for item in franchise_data
|
| 794 |
+
])
|
| 795 |
+
st.header(f"Total CO2e Emissions from Franchises (Method 1): {total_emissions} kg CO2e")
|
| 796 |
+
|
| 797 |
+
def get_input_category_14_method_2():
|
| 798 |
+
st.subheader("Category 14: Franchises - Method 2: Allocating emissions from franchise buildings")
|
| 799 |
+
|
| 800 |
+
franchise_building_data = dynamic_input_fields("Franchise Building",
|
| 801 |
+
["Energy use from franchise (kWh)", "Franchise's area (m2)",
|
| 802 |
+
"Building's total area (m2)", "Building's occupancy rate"],
|
| 803 |
+
["Energy use from franchise (kWh)", "Franchise's area (m2)",
|
| 804 |
+
"Building's total area (m2)", "Building's occupancy rate"])
|
| 805 |
+
|
| 806 |
+
calculate_emissions_category_14_method_2(franchise_building_data)
|
| 807 |
+
|
| 808 |
+
def calculate_emissions_category_14_method_2(franchise_building_data):
|
| 809 |
+
total_emissions = sum([
|
| 810 |
+
item["Energy use from franchise (kWh)"] *
|
| 811 |
+
(item["Franchise's area (m2)"] / item["Building's total area (m2)"] * item["Building's occupancy rate"]) if item["Building's total area (m2)"] * item["Building's occupancy rate"] !=0 else 0
|
| 812 |
+
for item in franchise_building_data
|
| 813 |
+
])
|
| 814 |
+
st.header(f"Total CO2e Emissions from Franchises (Method 2): {total_emissions} kg CO2e")
|
| 815 |
+
|
| 816 |
+
def get_input_category_14_method_3():
|
| 817 |
+
st.subheader("Category 14: Franchises - Method 3: Extrapolating emissions from sample groups")
|
| 818 |
+
|
| 819 |
+
franchise_groups_data = dynamic_input_fields("Franchise Group", ["Total emissions from sampled franchises within group",
|
| 820 |
+
"Total number of franchises within group",
|
| 821 |
+
"Number of franchises sampled within group"],
|
| 822 |
+
["Total emissions from sampled franchises within group",
|
| 823 |
+
"Total number of franchises within group",
|
| 824 |
+
"Number of franchises sampled within group"])
|
| 825 |
+
|
| 826 |
+
calculate_emissions_category_14_method_3(franchise_groups_data)
|
| 827 |
+
|
| 828 |
+
def calculate_emissions_category_14_method_3(franchise_groups_data):
|
| 829 |
+
total_emissions = sum([
|
| 830 |
+
(item["Total emissions from sampled franchises within group"] / item["Total number of franchises within group"]) *
|
| 831 |
+
item["Number of franchises sampled within group"] if item["Total number of franchises within group"]!=0 else 0
|
| 832 |
+
for item in franchise_groups_data
|
| 833 |
+
])
|
| 834 |
+
st.header(f"Total CO2e Emissions from Franchises (Method 3): {total_emissions} kg CO2e")
|
| 835 |
+
|
| 836 |
+
def get_input_category_14_method_4():
|
| 837 |
+
st.subheader("Category 14: Franchises - Method 4: Average data method for leased buildings (if floor space data is available)")
|
| 838 |
+
|
| 839 |
+
building_types_data = dynamic_input_fields("Building Type", ["Total floor space of building type (m2)",
|
| 840 |
+
"Average emission factor for building type (kg CO2e/m2/year)"],
|
| 841 |
+
["Total floor space of building type (m2)",
|
| 842 |
+
"Average emission factor for building type (kg CO2e/m2/year)"])
|
| 843 |
+
|
| 844 |
+
calculate_emissions_category_14_method_4(building_types_data)
|
| 845 |
+
|
| 846 |
+
def calculate_emissions_category_14_method_4(building_types_data):
|
| 847 |
+
total_emissions = sum([
|
| 848 |
+
item["Total floor space of building type (m2)"] * item["Average emission factor for building type (kg CO2e/m2/year)"]
|
| 849 |
+
for item in building_types_data
|
| 850 |
+
])
|
| 851 |
+
st.header(f"Total CO2e Emissions from Franchises (Method 4): {total_emissions} kg CO2e")
|
| 852 |
+
|
| 853 |
+
def get_input_category_14_method_5():
|
| 854 |
+
st.subheader("Category 14: Franchises - Method 5: Average data method for other asset types or for leased buildings where floor space data is not available")
|
| 855 |
+
|
| 856 |
+
building_asset_types_data = dynamic_input_fields("Building/Asset Type", ["Number of buildings or assets",
|
| 857 |
+
"Average emissions per building or asset type per year (kg CO2e/building or asset type/year)"],
|
| 858 |
+
["Number of buildings or assets",
|
| 859 |
+
"Average emissions per building or asset type per year (kg CO2e/building or asset type/year)"])
|
| 860 |
+
|
| 861 |
+
calculate_emissions_category_14_method_5(building_asset_types_data)
|
| 862 |
+
|
| 863 |
+
def calculate_emissions_category_14_method_5(building_asset_types_data):
|
| 864 |
+
total_emissions = sum([
|
| 865 |
+
item["Number of buildings or assets"] * item["Average emissions per building or asset type per year (kg CO2e/building or asset type/year)"]
|
| 866 |
+
for item in building_asset_types_data
|
| 867 |
+
])
|
| 868 |
+
st.header(f"Total CO2e Emissions from Franchises (Method 5): {total_emissions} kg CO2e")
|
| 869 |
+
|
| 870 |
+
def get_input_category_15_method_1():
|
| 871 |
+
st.subheader("Category 15: Investments - Method 1: Investment-specific method for equity investments")
|
| 872 |
+
|
| 873 |
+
equity_investment_data = dynamic_input_fields("Equity Investment",
|
| 874 |
+
["Scope 1 and scope 2 emissions of investee company (tonnes CO2e)",
|
| 875 |
+
"Reporting company’s share of equity (%)"],
|
| 876 |
+
["Scope 1 and scope 2 emissions of investee company (tonnes CO2e)",
|
| 877 |
+
"Reporting company’s share of equity (%)"])
|
| 878 |
+
|
| 879 |
+
calculate_emissions_category_15_method_1(equity_investment_data)
|
| 880 |
+
|
| 881 |
+
def calculate_emissions_category_15_method_1(equity_investment_data):
|
| 882 |
+
total_emissions = sum([
|
| 883 |
+
item["Scope 1 and scope 2 emissions of investee company (tonnes CO2e)"] *
|
| 884 |
+
(item["Reporting company’s share of equity (%)"] / 100)
|
| 885 |
+
for item in equity_investment_data
|
| 886 |
+
])
|
| 887 |
+
st.header(f"Total CO2e Emissions from Investments (Method 1): {total_emissions} tonnes CO2e")
|
| 888 |
+
|
| 889 |
+
def get_input_category_15_method_2():
|
| 890 |
+
st.subheader("Category 15: Investments - Method 2: Average data method for equity investments")
|
| 891 |
+
|
| 892 |
+
equity_investment_average_data = dynamic_input_fields("Equity Investment Average Data",
|
| 893 |
+
["Investee company total revenue ($)",
|
| 894 |
+
"Emission factor for investee’s sector (kg CO2e/$ revenue)",
|
| 895 |
+
"Reporting company’s share of equity (%)"],
|
| 896 |
+
["Investee company total revenue ($)",
|
| 897 |
+
"Emission factor for investee’s sector (kg CO2e/$ revenue)",
|
| 898 |
+
"Reporting company’s share of equity (%)"])
|
| 899 |
+
|
| 900 |
+
calculate_emissions_category_15_method_2(equity_investment_average_data)
|
| 901 |
+
|
| 902 |
+
def calculate_emissions_category_15_method_2(equity_investment_average_data):
|
| 903 |
+
total_emissions = sum([
|
| 904 |
+
(item["Investee company total revenue ($)"] * item["Emission factor for investee’s sector (kg CO2e/$ revenue)"]) *
|
| 905 |
+
(item["Reporting company’s share of equity (%)"] / 100)
|
| 906 |
+
for item in equity_investment_average_data
|
| 907 |
+
])
|
| 908 |
+
st.header(f"Total CO2e Emissions from Investments (Method 2): {total_emissions} tonnes CO2e")
|
| 909 |
+
|
| 910 |
+
def get_input_category_15_method_3():
|
| 911 |
+
st.subheader("Category 15: Investments - Method 3: Project-specific method for project finance and debt investments")
|
| 912 |
+
|
| 913 |
+
project_finance_data = dynamic_input_fields("Project Finance",
|
| 914 |
+
["Scope 1 and scope 2 emissions of relevant project (tonnes CO2e)",
|
| 915 |
+
"Value of debt investment ($)", "Total project costs (total equity plus debt) ($)",
|
| 916 |
+
"Share of total project costs (%)"],
|
| 917 |
+
["Scope 1 and scope 2 emissions of relevant project (tonnes CO2e)",
|
| 918 |
+
"Value of debt investment ($)", "Total project costs (total equity plus debt) ($)",
|
| 919 |
+
"Share of total project costs (%)"])
|
| 920 |
+
|
| 921 |
+
calculate_emissions_category_15_method_3(project_finance_data)
|
| 922 |
+
|
| 923 |
+
def calculate_emissions_category_15_method_3(project_finance_data):
|
| 924 |
+
total_emissions = sum([
|
| 925 |
+
item["Scope 1 and scope 2 emissions of relevant project (tonnes CO2e)"] *
|
| 926 |
+
(item["Share of total project costs (%)"] / 100)
|
| 927 |
+
for item in project_finance_data
|
| 928 |
+
])
|
| 929 |
+
st.header(f"Total CO2e Emissions from Investments (Method 3): {total_emissions} tonnes CO2e")
|
| 930 |
+
|
| 931 |
+
def get_input_category_15_method_4():
|
| 932 |
+
st.subheader("Category 15: Investments - Method 4: Average-data method for project finance and debt investments")
|
| 933 |
+
|
| 934 |
+
project_finance_average_data = dynamic_input_fields("Project Finance Average Data",
|
| 935 |
+
["Project construction cost or project revenue in reporting year ($ million)",
|
| 936 |
+
"Emission factor of relevant construction or operating sector (kg CO2e/$ revenue)",
|
| 937 |
+
"Share of total project costs (value of debt investment / total equity plus debt) (%)"],
|
| 938 |
+
["Project construction cost or project revenue in reporting year ($ million)",
|
| 939 |
+
"Emission factor of relevant construction or operating sector (kg CO2e/$ revenue)",
|
| 940 |
+
"Share of total project costs (value of debt investment / total equity plus debt) (%)"])
|
| 941 |
+
|
| 942 |
+
calculate_emissions_category_15_method_4(project_finance_average_data)
|
| 943 |
+
|
| 944 |
+
def calculate_emissions_category_15_method_4(project_finance_average_data):
|
| 945 |
+
total_emissions = sum([
|
| 946 |
+
((item["Project construction cost or project revenue in reporting year ($ million)"] *
|
| 947 |
+
item["Emission factor of relevant construction or operating sector (kg CO2e/$ revenue)"]) *
|
| 948 |
+
item["Share of total project costs (value of debt investment / total equity plus debt) (%)"] / 100)
|
| 949 |
+
for item in project_finance_average_data
|
| 950 |
+
])
|
| 951 |
+
st.header(f"Total CO2e Emissions from Investments (Method 4): {total_emissions} tonnes CO2e")
|
| 952 |
|
| 953 |
def main():
|
| 954 |
st.title("CO2 Emission Calculator")
|
| 955 |
+
selected_category = st.selectbox("Select Category", categories)
|
| 956 |
+
|
| 957 |
+
if selected_category in ["Category 1", "Category 2"]:
|
| 958 |
+
method_options = ["Supplier Specific Method", "Hybrid Method", "HybridPro Method"]
|
| 959 |
+
method = st.selectbox("Select Method", method_options)
|
| 960 |
+
|
| 961 |
+
if method == "Supplier Specific Method":
|
| 962 |
+
st.header("Supplier Specific Method")
|
| 963 |
+
num_items = st.number_input("Number of items", min_value=1, step=1)
|
| 964 |
+
purchased_goods_data = []
|
| 965 |
+
for i in range(num_items):
|
| 966 |
+
goods = st.selectbox(f"Purchased Goods {i + 1}", purchased_goods_values, key=f"goods_{i}")
|
| 967 |
+
supplier = st.selectbox(f"Supplier {i + 1}", supplier_values, key=f"supplier_{i}")
|
| 968 |
+
qty = st.number_input(f"Qty Purchased (kg) {i + 1}", min_value=0.0, step=0.01, key=f"qty_{i}")
|
| 969 |
+
emission_factor = st.number_input(f"Supplier-specific Emission Factor (kg CO2e/kg) {i + 1}", min_value=0.0, step=0.01, key=f"emission_factor_{i}")
|
| 970 |
+
purchased_goods_data.append((goods, supplier, qty, emission_factor))
|
| 971 |
+
calculate_emissions_supplier_specific(purchased_goods_data)
|
| 972 |
+
|
| 973 |
+
elif method == "Hybrid Method":
|
| 974 |
+
st.header("Hybrid Method")
|
| 975 |
+
scope1_and_scope2_data = dynamic_input_fields_with_dropdown("Scope 1 and Scope 2 data from supplier B relating to production of purchased goods", "Enter scope 1 and scope 2 data", scope_values, ["Category","Amount (kWh)", "Emission factor (kg CO2e/kWh)"])
|
| 976 |
+
material_inputs_data = dynamic_input_fields_with_dropdown("Material inputs of purchased goods", "Enter material input data", material_inputs_values, ["Purchased Goods", "Mass purchased (kg)", "Emission factor (kg CO2e/kg)"])
|
| 977 |
+
transport_data = dynamic_input_fields_with_dropdown("Transport of material inputs to supplier B", "Enter transport data", transport_values, ["Purchased Goods", "Distance of transport (km)", "Vehicle type emission factor (kg CO2e/kg/km)"])
|
| 978 |
+
waste_output_data = dynamic_input_fields_with_emission_factor("Waste outputs by supplier B relating to production of purchased goods", "Enter waste output data", waste_output_values, ["Amount (kg)", "Emission factor (kg CO2e/kg of waste sent to landfill)"])
|
| 979 |
+
calculate_emissions_hybrid(scope1_and_scope2_data, material_inputs_data, transport_data, waste_output_data)
|
| 980 |
+
|
| 981 |
+
elif method == "HybridPro Method":
|
| 982 |
+
scope_data = dynamic_input_fields_with_dropdown("Scope 1 and Scope 2 data from supplier B", "Enter scope data", scope_values, ["Category","Amount (kWh)", "Emission factor (kg CO2e/kWh)"])
|
| 983 |
+
tshirt_data = dynamic_input_fields_with_emission_factor("T-shirts", "Enter T-shirt data", purchased_goods_values,
|
| 984 |
+
["Number of t-shirts purchased",
|
| 985 |
+
"Cradle-to-gate process emission factor (kg CO2e/per t-shirt)","Cradle-to-gate process emission factor (kg CO2e/per t-shirt(excluding scopes)"])
|
| 986 |
+
waste_output_data = dynamic_input_fields_with_emission_factor("Waste outputs by supplier B", "Enter waste output data", waste_output_values,
|
| 987 |
+
["Amount (kg)", "Emission factor (kg CO2e/kg of waste sent to landfill)"])
|
| 988 |
+
calculate_emissions_hybrid_pro(tshirt_data, scope_data, waste_output_data)
|
| 989 |
+
|
| 990 |
+
elif selected_category=="Category 3":
|
| 991 |
+
collect_category_3_data()
|
| 992 |
+
|
| 993 |
+
elif selected_category == "Category 4":
|
| 994 |
+
method_options = ["Method 1: Fuel-based Method", "Method 2: Unladen Backhaul", "Method 3: Transportation", "Method 4: Distribution", "Method 5: Distribution"]
|
| 995 |
+
selected_method = st.selectbox("Select Method for Category 4", method_options)
|
| 996 |
+
|
| 997 |
+
if selected_method == "Method 1: Fuel-based Method":
|
| 998 |
+
collect_category_4_method_1_data()
|
| 999 |
+
elif selected_method == "Method 2: Unladen Backhaul":
|
| 1000 |
+
collect_category_4_method_2_data()
|
| 1001 |
+
elif selected_method == "Method 3: Transportation":
|
| 1002 |
+
collect_category_4_method_3_data()
|
| 1003 |
+
elif selected_method == "Method 4: Distribution":
|
| 1004 |
+
collect_category_4_method_4_data()
|
| 1005 |
+
elif selected_method == "Method 5: Distribution":
|
| 1006 |
+
collect_category_4_method_5_data()
|
| 1007 |
+
|
| 1008 |
+
elif selected_category == "Category 5":
|
| 1009 |
+
method_options = ["Method 1: Waste Operations using scope", "Method 2: Waste operations using produce", "Method 3: Average Method"]
|
| 1010 |
+
selected_method = st.selectbox("Select Method for Category 5", method_options)
|
| 1011 |
+
|
| 1012 |
+
if selected_method == "Method 1: Waste Operations using scope":
|
| 1013 |
+
get_input_category_5_method_1()
|
| 1014 |
+
elif selected_method == "Method 2: Waste operations using produce":
|
| 1015 |
+
get_input_category_5_method_2()
|
| 1016 |
+
elif selected_method == "Method 3: Average Method":
|
| 1017 |
+
get_input_category_5_method_3()
|
| 1018 |
+
|
| 1019 |
+
elif selected_category == "Category 6":
|
| 1020 |
+
get_input_category_6_method_1()
|
| 1021 |
+
|
| 1022 |
+
elif selected_category == "Category 7":
|
| 1023 |
+
method_options = ["Method 1: Standard method", "Method 2: Average Method"]
|
| 1024 |
+
selected_method = st.selectbox("Select Method for Category 7", method_options)
|
| 1025 |
+
if selected_method == "Method 1: Standard method":
|
| 1026 |
+
get_input_category_7_method_1()
|
| 1027 |
+
elif selected_method == "Method 2: Average Method":
|
| 1028 |
+
get_input_category_7_method_2()
|
| 1029 |
+
|
| 1030 |
+
elif selected_category == "Category 8":
|
| 1031 |
+
method_options = ["Method 1: Asset specific", "Method 2: Leased assets", "Method 3: Average method for leased assets","Method 4: Average method for leased buildings"]
|
| 1032 |
+
selected_method = st.selectbox("Select Method for Category 8", method_options)
|
| 1033 |
+
|
| 1034 |
+
if selected_method == "Method 1: Asset specific":
|
| 1035 |
+
get_input_category_8_method_1()
|
| 1036 |
+
elif selected_method == "Method 2: Leased assets":
|
| 1037 |
+
get_input_category_8_method_2()
|
| 1038 |
+
elif selected_method == "Method 3: Average method for leased assets":
|
| 1039 |
+
get_input_category_8_method_3()
|
| 1040 |
+
elif selected_method == "Method 4: Average method for leased buildings":
|
| 1041 |
+
get_input_category_8_method_4()
|
| 1042 |
+
|
| 1043 |
+
elif selected_category == "Category 9":
|
| 1044 |
+
get_input_category_9_method_1()
|
| 1045 |
+
|
| 1046 |
+
elif selected_category == "Category 10":
|
| 1047 |
+
method_options = ["Method 1: Site-specific", "Method 2: Average specific"]
|
| 1048 |
+
selected_method = st.selectbox("Select Method for Category 10", method_options)
|
| 1049 |
+
|
| 1050 |
+
if selected_method == "Method 1: Site-specific":
|
| 1051 |
+
get_input_category_10_method_1()
|
| 1052 |
+
elif selected_method == "Method 2: Average specific":
|
| 1053 |
+
get_input_category_10_method_2()
|
| 1054 |
+
|
| 1055 |
+
elif selected_category == "Category 11":
|
| 1056 |
+
method_options = ["Method 1: Direct energy consumption", "Method 2: Combusted Fuels", "Method 3: Greenhouse gases","Method 4: Indirect use","Method 5: Sold-intermediate products"]
|
| 1057 |
+
selected_method = st.selectbox("Select Method for Category 11", method_options)
|
| 1058 |
|
| 1059 |
+
if selected_method == "Method 1: Direct energy consumption":
|
| 1060 |
+
get_input_category_11_method_1()
|
| 1061 |
+
elif selected_method == "Method 2: Combusted Fuels":
|
| 1062 |
+
get_input_category_11_method_2()
|
| 1063 |
+
elif selected_method == "Method 3: Greenhouse gases":
|
| 1064 |
+
get_input_category_11_method_3()
|
| 1065 |
+
elif selected_method == "Method 4: Indirect use":
|
| 1066 |
+
get_input_category_11_method_4()
|
| 1067 |
+
else:
|
| 1068 |
+
get_input_category_11_method_5()
|
| 1069 |
+
|
| 1070 |
+
elif selected_category == "Category 12":
|
| 1071 |
+
get_input_category_12_method_1()
|
| 1072 |
+
|
| 1073 |
+
elif selected_category == "Category 13":
|
| 1074 |
+
get_input_category_13()
|
| 1075 |
+
|
| 1076 |
+
elif selected_category == "Category 14":
|
| 1077 |
+
method_options = ["Method 1: Franchise-specific", "Method 2: Allocating emissions from franchise buildings that are not sub-metered", "Method 3: Extrapolating emissions from sample groups","Method 4: Average data method for leased buildings (if floor space data is available)","Method 5: Average data method for other asset types or for leased buildings where floor space data is not available"]
|
| 1078 |
+
selected_method = st.selectbox("Select Method for Category 14", method_options)
|
| 1079 |
+
|
| 1080 |
+
if selected_method == "Method 1: Franchise-specific":
|
| 1081 |
+
get_input_category_14_method_1()
|
| 1082 |
+
elif selected_method == "Method 2: Allocating emissions from franchise buildings that are not sub-metered":
|
| 1083 |
+
get_input_category_14_method_2()
|
| 1084 |
+
elif selected_method == "Method 3: Extrapolating emissions from sample groups":
|
| 1085 |
+
get_input_category_14_method_3()
|
| 1086 |
+
elif selected_method == "Method 4: Average data method for leased buildings (if floor space data is available)":
|
| 1087 |
+
get_input_category_14_method_4()
|
| 1088 |
+
else:
|
| 1089 |
+
get_input_category_14_method_5()
|
| 1090 |
+
|
| 1091 |
+
else:
|
| 1092 |
+
method_options = ["Method 1: Investment-specific method for calculating emissions from equity investments", "Method 2: Average data method ", "Method 3: Project-specific method for calculating emissions from project finance and debt investments with known use of proceeds","Method 4: Average-data method for calculating emissions from project finance and debt investments with known use of proceeds"]
|
| 1093 |
+
selected_method = st.selectbox("Select Method for Category 14", method_options)
|
| 1094 |
+
|
| 1095 |
+
if selected_method == "Method 1: Investment-specific method for calculating emissions from equity investments":
|
| 1096 |
+
get_input_category_15_method_1()
|
| 1097 |
+
elif selected_method == "Method 2: Average data method ":
|
| 1098 |
+
get_input_category_15_method_2()
|
| 1099 |
+
elif selected_method == "Method 3: Project-specific method for calculating emissions from project finance and debt investments with known use of proceeds":
|
| 1100 |
+
get_input_category_15_method_3()
|
| 1101 |
+
elif selected_method == "Method 4: Average-data method for calculating emissions from project finance and debt investments with known use of proceeds":
|
| 1102 |
+
get_input_category_15_method_4()
|
| 1103 |
+
|
| 1104 |
+
def dynamic_input_fields(label, values, headings, country=None):
|
| 1105 |
num_items = st.number_input(f"**Number of {label} items**", min_value=1, step=1, key=f"{label}_num_items")
|
| 1106 |
input_fields = []
|
| 1107 |
+
|
| 1108 |
for i in range(num_items):
|
| 1109 |
st.subheader(f"{label} {i + 1}")
|
| 1110 |
input_data = {}
|
| 1111 |
+
|
| 1112 |
+
if country:
|
| 1113 |
+
input_data["Country"] = country
|
| 1114 |
+
|
| 1115 |
for value, heading in zip(values, headings):
|
| 1116 |
+
key = f"{label}_{i}_{value}_{heading}"
|
| 1117 |
+
input_data[value] = st.number_input(f"{heading} {i + 1}", min_value=0.0, step=0.01, key=key)
|
| 1118 |
+
|
| 1119 |
input_fields.append(input_data)
|
| 1120 |
+
|
| 1121 |
return input_fields
|
| 1122 |
|
| 1123 |
def dynamic_input_fields_with_dropdown(label, prompt, values, headings):
|
|
|
|
| 1143 |
input_fields.append(input_data)
|
| 1144 |
return input_fields
|
| 1145 |
|
| 1146 |
+
def dynamic_input_fields_with_dropdown_int(label, prompt, values, headings):
|
| 1147 |
+
num_items = st.number_input(f"**Number of {label} items**", min_value=1, step=1, key=f"{label}_num_items")
|
| 1148 |
+
input_fields = []
|
| 1149 |
+
|
| 1150 |
+
dropdown_options = {
|
| 1151 |
+
"Location": ["US", "Aus"],
|
| 1152 |
+
"Car_type": ["Hybrid", "Gasoline", "4 wheel"],
|
| 1153 |
+
|
| 1154 |
+
}
|
| 1155 |
+
|
| 1156 |
+
for i in range(num_items):
|
| 1157 |
+
st.subheader(f"{label} {i + 1}")
|
| 1158 |
+
input_data = {}
|
| 1159 |
+
|
| 1160 |
+
for j, heading in enumerate(headings):
|
| 1161 |
+
if heading in dropdown_options:
|
| 1162 |
+
input_data[heading] = st.selectbox(f"{heading} {i + 1}", dropdown_options[heading], key=f"{label}_{i}_{heading}")
|
| 1163 |
+
else:
|
| 1164 |
+
input_data[heading] = st.number_input(f"{heading} {i + 1}", min_value=0, step=1, key=f"{label}_{i}_{heading}")
|
| 1165 |
+
|
| 1166 |
+
input_fields.append(input_data)
|
| 1167 |
+
|
| 1168 |
+
return input_fields
|
| 1169 |
+
|
| 1170 |
+
|
| 1171 |
+
|
| 1172 |
if __name__ == "__main__":
|
| 1173 |
main()
|