Skip to content

Commit

Permalink
added stores as cooking techs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mwiche96 committed Jun 20, 2024
1 parent 2c33699 commit 0233362
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 0 deletions.
3 changes: 3 additions & 0 deletions natura/CITATION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Sosa Arango, Chrystian Camilo, 2020, "Protected areas (WDPA)", https://doi.org/10.7910/DVN/XIV9BL, Harvard Dataverse, V1

Khoury, C. K., Amariles, D., Soto, J. S., Diaz, M. V., Sotelo, S., Sosa, C. C., … Wiersema, J. H. (2019). Data for the calculation of an indicator of the comprehensiveness of conservation of useful wild plants. Data in Brief, 22, 90–97. https://doi.org/10.1016/j.dib.2018.11.125 doi: 10.1016/j.dib.2018.11.125
1 change: 1 addition & 0 deletions natura/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":3797032,"identifier":"DVN/XIV9BL","persistentUrl":"https://doi.org/10.7910/DVN/XIV9BL","protocol":"doi","authority":"10.7910","publisher":"Harvard Dataverse","publicationDate":"2020-04-07","storageIdentifier":"s3://10.7910/DVN/XIV9BL","datasetVersion":{"id":303412,"datasetId":3797032,"datasetPersistentId":"doi:10.7910/DVN/XIV9BL","storageIdentifier":"s3://10.7910/DVN/XIV9BL","versionNumber":1,"versionMinorNumber":3,"versionState":"RELEASED","lastUpdateTime":"2022-01-27T01:08:21Z","releaseTime":"2022-01-27T01:08:21Z","createTime":"2022-01-27T01:08:09Z","license":{"name":"CC0 1.0","uri":"http://creativecommons.org/publicdomain/zero/1.0"},"fileAccessRequest":false,"metadataBlocks":{"citation":{"displayName":"Citation Metadata","name":"citation","fields":[{"typeName":"title","multiple":false,"typeClass":"primitive","value":"Protected areas (WDPA)"},{"typeName":"author","multiple":true,"typeClass":"compound","value":[{"authorName":{"typeName":"authorName","multiple":false,"typeClass":"primitive","value":"Sosa Arango, Chrystian Camilo"},"authorAffiliation":{"typeName":"authorAffiliation","multiple":false,"typeClass":"primitive","value":"Pontificia Universidad Javeriana, Cali"}}]},{"typeName":"datasetContact","multiple":true,"typeClass":"compound","value":[{"datasetContactName":{"typeName":"datasetContactName","multiple":false,"typeClass":"primitive","value":"Sosa Arango, Chrystian Camilo"},"datasetContactAffiliation":{"typeName":"datasetContactAffiliation","multiple":false,"typeClass":"primitive","value":"Pontificia Universidad Javeriana, Cali"},"datasetContactEmail":{"typeName":"datasetContactEmail","multiple":false,"typeClass":"primitive","value":"[email protected]"}}]},{"typeName":"dsDescription","multiple":true,"typeClass":"compound","value":[{"dsDescriptionValue":{"typeName":"dsDescriptionValue","multiple":false,"typeClass":"primitive","value":"This dataset is a raster file used In the article: Data for the calculation of an indicator of the comprehensiveness of conservation of useful wild plants (Khoury et al. (2019) Ecological Indicators 98:420-429. doi: 10.1016/j.ecolind.2018.11.016). Its name is wdpa_reclass.tif and it contains protected areas rasterized from protected areas database to be used in the GapAnalysis R package."}}]},{"typeName":"subject","multiple":true,"typeClass":"controlledVocabulary","value":["Agricultural Sciences"]},{"typeName":"publication","multiple":true,"typeClass":"compound","value":[{"publicationCitation":{"typeName":"publicationCitation","multiple":false,"typeClass":"primitive","value":"Khoury, C. K., Amariles, D., Soto, J. S., Diaz, M. V., Sotelo, S., Sosa, C. C., … Wiersema, J. H. (2019). Data for the calculation of an indicator of the comprehensiveness of conservation of useful wild plants. Data in Brief, 22, 90–97. https://doi.org/10.1016/j.dib.2018.11.125 doi: 10.1016/j.dib.2018.11.125"}}]},{"typeName":"depositor","multiple":false,"typeClass":"primitive","value":"Sosa Arango, Chrystian Camilo"},{"typeName":"dateOfDeposit","multiple":false,"typeClass":"primitive","value":"2020-04-07"}]}},"files":[{"label":"wdpa_reclass.tif","restricted":false,"version":1,"datasetVersionId":303412,"dataFile":{"id":3797034,"persistentId":"doi:10.7910/DVN/XIV9BL/ER7H7E","pidURL":"https://doi.org/10.7910/DVN/XIV9BL/ER7H7E","filename":"wdpa_reclass.tif","contentType":"image/tiff","filesize":3356668,"storageIdentifier":"s3://dvn-cloud:17157cf9c3a-b7a5e5faec85","rootDataFileId":-1,"md5":"8e49e824d05b092de31a3d0808892e76","checksum":{"type":"MD5","value":"8e49e824d05b092de31a3d0808892e76"},"creationDate":"2020-04-07"}}],"citation":"Sosa Arango, Chrystian Camilo, 2020, \"Protected areas (WDPA)\", https://doi.org/10.7910/DVN/XIV9BL, Harvard Dataverse, V1"}}
Binary file added natura/natura.tiff
Binary file not shown.
12 changes: 12 additions & 0 deletions scripts/add_electricity.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,20 @@ def load_costs(tech_costs, config, elec_config, Nyears=1):
"""
Set all asset costs and other parameters.
"""
if os.path.basename(os.getcwd()) == 'pypsa-earth':
cooking = os.path.join(os.getcwd(), 'resources', config['clean_cooking']['cooking_costs'])

else:
script_directory = os.path.dirname(os.path.abspath(__file__))
root_directory = os.path.abspath(os.path.join(script_directory, '..'))
cooking = os.path.join(root_directory, 'resources', config['clean_cooking']['cooking_costs'])

cooking = pd.read_csv(cooking).set_index(["technology", "parameter"]).sort_index()

costs = pd.read_csv(tech_costs, index_col=["technology", "parameter"]).sort_index()

costs = pd.concat([costs, cooking], ignore_index=False)

# correct units to MW and EUR
costs.loc[costs.unit.str.contains("/kW"), "value"] *= 1e3
costs.unit = costs.unit.str.replace("/kW", "/MW")
Expand Down
146 changes: 146 additions & 0 deletions scripts/add_extra_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def attach_stores(n, costs, config):
elec_opts = config["electricity"]
carriers = elec_opts["extendable_carriers"]["Store"]

if config["costs"]["clean_cooking"]["enable"] == True:
carriers += config["costs"]["clean_cooking"]["fuel"]

_add_missing_carriers_from_costs(n, costs, carriers)

buses_i = n.buses.index
Expand Down Expand Up @@ -184,6 +187,149 @@ def attach_stores(n, costs, config):
marginal_cost=costs.at["battery inverter", "marginal_cost"],
)

if "heat" in carriers:
cooking_buses_i = n.madd(
"Bus", buses_i + " cooking bus", carrier="heat", **bus_sub_dict
)

if "AC" in carriers:
ac_buses_i = n.madd(
"Bus", buses_i + " electric bus", carrier="AC", **bus_sub_dict
)

n.madd(
"Store",
ac_buses_i,
bus=ac_buses_i,
carrier="AC",
e_cyclic=True,
capital_cost=costs.at["AC", "capital_cost"],
marginal_cost=costs.at["AC", "marginal_cost"],
)

n.madd(
"Link",
ac_buses_i + " electricity stove",
bus0=ac_buses_i,
bus1=cooking_buses_i,
carrier="AC",
efficiency=costs.at["AC", "efficiency"],
capital_cost=costs.at["AC", "capital_cost"],
marginal_cost=costs.at["AC", "marginal_cost"],
p_nom=0.25,
p_max_pu=1,
)

if "lpg" in carriers:
lpg_buses_i = n.madd("Bus", buses_i + " lpg bus", carrier="lpg", **bus_sub_dict)

n.madd(
"Store",
lpg_buses_i,
bus=lpg_buses_i,
carrier="lpg",
e_cyclic=False,
capital_cost=costs.at["lpg", "capital_cost"],
marginal_cost=costs.at["lpg", "marginal_cost"],
)

n.madd(
"Link",
lpg_buses_i + " lpg stove",
bus0=lpg_buses_i,
bus1=cooking_buses_i,
carrier="lpg",
efficiency=costs.at["lpg", "efficiency"],
capital_cost=costs.at["lpg", "capital_cost"],
marginal_cost=costs.at["lpg", "marginal_cost"],
p_nom=0.25,
p_max_pu=1,
)

if "pellets" in carriers:
pellets_buses_i = n.madd(
"Bus", buses_i + " pellets bus", carrier="pellets", **bus_sub_dict
)

n.madd(
"Store",
pellets_buses_i,
bus=pellets_buses_i,
carrier="pellets",
e_cyclic=False,
capital_cost=costs.at["pellets", "capital_cost"],
marginal_cost=costs.at["pellets", "marginal_cost"],
)

n.madd(
"Link",
pellets_buses_i + " pellets stove",
bus0=pellets_buses_i,
bus1=cooking_buses_i,
carrier="pellets",
efficiency=costs.at["pellets", "efficiency"],
capital_cost=costs.at["pellets", "capital_cost"],
marginal_cost=costs.at["pellets", "marginal_cost"],
p_nom=0.25,
p_max_pu=1,
)

if "firewood" in carriers:
firewood_buses_i = n.madd(
"Bus", buses_i + " firewood bus", carrier="firewood", **bus_sub_dict
)

n.madd(
"Store",
firewood_buses_i,
bus=firewood_buses_i,
carrier="firewood",
e_cyclic=False,
capital_cost=costs.at["firewood", "capital_cost"],
marginal_cost=costs.at["firewood", "marginal_cost"],
)

n.madd(
"Link",
firewood_buses_i + " firewood stove",
bus0=firewood_buses_i,
bus1=cooking_buses_i,
carrier="firewood",
efficiency=costs.at["firewood", "efficiency"],
capital_cost=costs.at["firewood", "capital_cost"],
marginal_cost=costs.at["firewood", "marginal_cost"],
p_nom=0.25,
p_max_pu=1,
)

if "charcoal" in carriers:
charcoal_buses_i = n.madd(
"Bus", buses_i + " charcoal bus", carrier="charcoal", **bus_sub_dict
)

n.madd(
"Store",
charcoal_buses_i,
bus=charcoal_buses_i,
carrier="charcoal",
e_cyclic=False,
capital_cost=costs.at["charcoal", "capital_cost"],
marginal_cost=costs.at["charcoal", "marginal_cost"],
)

n.madd(
"Link",
charcoal_buses_i + " charcoal stove",
bus0=charcoal_buses_i,
bus1=cooking_buses_i,
carrier="charcoal",
efficiency=costs.at["charcoal", "efficiency"],
capital_cost=costs.at["charcoal", "capital_cost"],
marginal_cost=costs.at["charcoal", "marginal_cost"],
p_nom=0.25,
p_max_pu=1,
)

if ("csp" in config["renewable"].keys()) and (
config["renewable"]["csp"]["csp_model"] == "advanced"
):
Expand Down

0 comments on commit 0233362

Please sign in to comment.