Skip to content

Commit 323579a

Browse files
committed
Move the co2_factors into a csv file
1 parent 3f6c631 commit 323579a

3 files changed

Lines changed: 42 additions & 77 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
energy_carrier_name,unit,value,energy_carrier_unit,information source,CO2 per energy_carrier_unit
2+
Biodiesel,kWh_eleq/l,0.06290669,l,,0
3+
Crude_oil,kWh_eleq/kg,11.63042204,kg,,0
4+
Diesel,kWh_eleq/l,9.48030688,l,"https://epact.energy.gov/fuel-conversion-factors, conversion gallon->4.546092 l",0
5+
Electricity,kWh_eleq/kWh_el,1,kWh_el,,0
6+
Ethane,kWh_eleq/l,5.149767951,l,,0
7+
Ethanol,kWh_eleq/l,0.04242544,l,,0
8+
Gas,kWh_eleq/m3,0.00933273,l,"https://epact.energy.gov/fuel-conversion-factors, conversion gallon->4.546092 l",0
9+
Gasoline,kWh_eleq/l,8.735753974,l,,0
10+
H2,kWh_eleq/kgH2,33.47281985,kgH2,"https://epact.energy.gov/fuel-conversion-factors",0
11+
Heat,KWh_eleq/kWh_therm,1.0002163,kWh_therm,,0
12+
Kerosene,kWh_eleq/l,8.908073954,l,,0
13+
LNG,kWh_eleq/kg,12.69270292,kg,,0
14+
LPG,kWh_eleq/l,6.472821609,l,,0
15+
Natural_gas,kWh_eleq/m3,0.00933273,l,"https://epact.energy.gov/fuel-conversion-factors, conversion gallon->4.546092 l",0

prepare_package.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
os.path.join(".", pgk_data_src), os.path.join(pkg_data_folder, pkg_data_dest)
2323
)
2424
# Move the MVS parameters from the docs into the package_data folder
25-
shutil.copyfile(
26-
os.path.join(".", "docs", "MVS_parameters_list.csv"),
27-
os.path.join(pkg_data_folder, "MVS_parameters_list.csv"),
28-
)
25+
for doc_file in ("MVS_parameters_list.csv", "energy_co2_conversion_factors.csv"):
26+
shutil.copyfile(
27+
os.path.join(".", "docs", doc_file),
28+
os.path.join(pkg_data_folder, doc_file),
29+
)
2930

3031
# Rebuild the package
3132
os.system("python setup.py sdist bdist_wheel")

src/multi_vector_simulator/utils/constants.py

Lines changed: 22 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55

66
import os
7+
import pandas as pd
78
from copy import deepcopy
89

910
from multi_vector_simulator.utils.constants_json_strings import *
@@ -309,79 +310,27 @@
309310
},
310311
}
311312

312-
ENERGY_CARRIER_UNIT = "energy_carrier_unit"
313-
DEFAULT_WEIGHTS_ENERGY_CARRIERS = {
314-
"LNG": {
315-
UNIT: "kWh_eleq/kg",
316-
VALUE: 12.69270292,
317-
ENERGY_CARRIER_UNIT: "kg",
318-
},
319-
"Crude_oil": {
320-
UNIT: "kWh_eleq/kg",
321-
VALUE: 11.63042204,
322-
ENERGY_CARRIER_UNIT: "kg",
323-
},
324-
"Diesel": {
325-
UNIT: "kWh_eleq/l",
326-
VALUE: 9.48030688,
327-
ENERGY_CARRIER_UNIT: "l",
328-
}, # https://epact.energy.gov/fuel-conversion-factors, conversion gallon->4.546092 l
329-
"Kerosene": {
330-
UNIT: "kWh_eleq/l",
331-
VALUE: 8.908073954,
332-
ENERGY_CARRIER_UNIT: "l",
333-
},
334-
"Gasoline": {
335-
UNIT: "kWh_eleq/l",
336-
VALUE: 8.735753974,
337-
ENERGY_CARRIER_UNIT: "l",
338-
},
339-
"LPG": {
340-
UNIT: "kWh_eleq/l",
341-
VALUE: 6.472821609,
342-
ENERGY_CARRIER_UNIT: "l",
343-
},
344-
"Ethane": {
345-
UNIT: "kWh_eleq/l",
346-
VALUE: 5.149767951,
347-
ENERGY_CARRIER_UNIT: "l",
348-
},
349-
"H2": {
350-
UNIT: "kWh_eleq/kgH2",
351-
VALUE: 33.47281985,
352-
ENERGY_CARRIER_UNIT: "kgH2",
353-
}, # https://epact.energy.gov/fuel-conversion-factors
354-
"Electricity": {
355-
UNIT: "kWh_eleq/kWh_el",
356-
VALUE: 1,
357-
ENERGY_CARRIER_UNIT: "kWh_el",
358-
},
359-
"Biodiesel": {
360-
UNIT: "kWh_eleq/l",
361-
VALUE: 0.06290669,
362-
ENERGY_CARRIER_UNIT: "l",
363-
},
364-
"Ethanol": {
365-
UNIT: "kWh_eleq/l",
366-
VALUE: 0.04242544,
367-
ENERGY_CARRIER_UNIT: "l",
368-
},
369-
"Natural_gas": {
370-
UNIT: "kWh_eleq/m3",
371-
VALUE: 0.00933273,
372-
ENERGY_CARRIER_UNIT: "l",
373-
}, # https://epact.energy.gov/fuel-conversion-factors, conversion gallon->4.546092 l
374-
"Gas": {
375-
UNIT: "kWh_eleq/m3",
376-
VALUE: 0.00933273,
377-
ENERGY_CARRIER_UNIT: "l",
378-
}, # https://epact.energy.gov/fuel-conversion-factors, conversion gallon->4.546092 l
379-
"Heat": {
380-
UNIT: "KWh_eleq/kWh_therm",
381-
VALUE: 1.0002163,
382-
ENERGY_CARRIER_UNIT: "kWh_therm",
383-
},
384-
}
313+
WEIGHTS_ENERGY_CARRIER = "weights_energy_carrier"
314+
315+
try:
316+
energy_carriers_file = "energy_co2_conversion_factors.csv"
317+
FILE_PATH = os.path.join(
318+
os.path.dirname(
319+
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
320+
),
321+
"docs",
322+
)
323+
if os.path.exists(FILE_PATH):
324+
FILE_PATH = PACKAGE_DATA_PATH
325+
326+
df = pd.read_csv(
327+
os.path.join(FILE_PATH, "energy_co2_conversion_factors.csv"), index_col=0
328+
)
329+
330+
DEFAULT_WEIGHTS_ENERGY_CARRIERS = df.to_dict(orient="index")
331+
except FileNotFoundError:
332+
DEFAULT_WEIGHTS_ENERGY_CARRIERS = None
333+
385334

386335
# dict keys in results_json file
387336
TIMESERIES = "timeseries"

0 commit comments

Comments
 (0)