-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'backstop' into ASEAN-ClimateFinance
- Loading branch information
Showing
7 changed files
with
169 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Prints warning if backstop techs are used""" | ||
|
||
import pandas as pd | ||
import sys | ||
from pathlib import Path | ||
|
||
if __name__ == "__main__": | ||
|
||
if len(sys.argv) != 2: | ||
raise ValueError("Usage: python create_checkbackstop.py <sceanrio_name>") | ||
else: | ||
scenario = sys.argv[1] | ||
|
||
new_capacity_csv = Path("results", scenario, "results", "NewCapacity.csv") | ||
try: | ||
new_capacity = pd.read_csv(new_capacity_csv) | ||
except FileNotFoundError: | ||
sys.exit() | ||
|
||
backstop = new_capacity[new_capacity.TECHNOLOGY.str.startswith("PWRBCK")] | ||
|
||
if not backstop.empty: | ||
techs = backstop.TECHNOLOGY.unique().tolist() | ||
print("\n*****\n") | ||
print("The following Backstop Technologies are being used:\n") | ||
print(techs) | ||
print("\n*****\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
"""Sets backstop parameters""" | ||
|
||
import pandas as pd | ||
|
||
|
||
def get_backstop_data( | ||
tech_set: pd.DataFrame, year_set: pd.DataFrame, region: str | ||
) -> tuple[pd.DataFrame]: | ||
"""Gets the following backstop data | ||
- Technologies | ||
- OAR | ||
- Capital Cost | ||
- Fixed Cost | ||
- CapacityToActivity | ||
""" | ||
|
||
df = tech_set.copy() | ||
|
||
# technologies | ||
techs = df[df.VALUE.str.startswith("PWR")].copy() # pwrtrn not added yet | ||
techs["VALUE"] = "PWRBCK" + df.VALUE.str[-7:-2] | ||
techs = techs.drop_duplicates() | ||
bck_techs = techs.VALUE.to_list() | ||
|
||
# activity ratios | ||
years = year_set.VALUE.to_list() | ||
oar = pd.DataFrame( | ||
index=pd.MultiIndex.from_product( | ||
[bck_techs, years], names=["TECHNOLOGY", "YEAR"] | ||
) | ||
).reset_index() | ||
oar["REGION"] = region | ||
oar["FUEL"] = oar.TECHNOLOGY.str.replace("PWRBCK", "ELC") | ||
oar["FUEL"] = oar.FUEL + "01" | ||
oar["MODE_OF_OPERATION"] = 1 | ||
oar["VALUE"] = 1 | ||
oar = oar[["REGION", "TECHNOLOGY", "FUEL", "MODE_OF_OPERATION", "YEAR", "VALUE"]] | ||
|
||
# capital cost | ||
capex = pd.DataFrame( | ||
index=pd.MultiIndex.from_product( | ||
[bck_techs, years], names=["TECHNOLOGY", "YEAR"] | ||
) | ||
).reset_index() | ||
capex["REGION"] = region | ||
capex["VALUE"] = 999999 | ||
capex = capex[["REGION", "TECHNOLOGY", "YEAR", "VALUE"]] | ||
|
||
# fixed costs | ||
opex = pd.DataFrame( | ||
index=pd.MultiIndex.from_product( | ||
[bck_techs, years], names=["TECHNOLOGY", "YEAR"] | ||
) | ||
).reset_index() | ||
opex["REGION"] = region | ||
opex["VALUE"] = 999999 | ||
opex = opex[["REGION", "TECHNOLOGY", "YEAR", "VALUE"]] | ||
|
||
# capacity to activity | ||
capact = pd.DataFrame(index=pd.Index(bck_techs, name="TECHNOLOGY")).reset_index() | ||
capact["REGION"] = region | ||
capact["VALUE"] = 31.536 | ||
capact = capact[["REGION", "TECHNOLOGY", "VALUE"]] | ||
|
||
return techs, oar, capex, opex, capact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters