Skip to content

Commit 9ff8168

Browse files
pesapstaadecker
authored andcommitted
Include energy_cost post_process
1 parent 0fcedd7 commit 9ff8168

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Standard packages
2+
import os
3+
import shutil
4+
5+
# Third-party packages
6+
import pandas as pd
7+
8+
from switch_model.wecc.get_inputs.register_post_process import register_post_process
9+
10+
11+
@register_post_process(
12+
msg="Change energy cost for storage candidate",
13+
)
14+
def post_process(config, func_config):
15+
16+
percentage = int(func_config["percentage"])/100
17+
dtype = {"GENERATION_PROJECT": str}
18+
df = pd.read_csv("generation_projects_info.csv", dtype=dtype)
19+
costs = pd.read_csv("gen_build_costs.csv", dtype=dtype)
20+
predetermined = pd.read_csv("gen_build_predetermined.csv",dtype=dtype)
21+
22+
gen_projects = df.merge(
23+
costs,
24+
on="GENERATION_PROJECT",
25+
)
26+
27+
gen_projects = gen_projects.merge(
28+
predetermined,
29+
on=["GENERATION_PROJECT", "build_year"],
30+
how="left" # Makes a left join
31+
)
32+
33+
# Get candiate technology only
34+
candidate = gen_projects.query("build_year == 2050").query("gen_tech =='Battery_Storage'")
35+
36+
# Get canidate generation project id
37+
candidate_ids = candidate["GENERATION_PROJECT"].values
38+
39+
40+
gen_cost_mwh = costs.loc[costs["GENERATION_PROJECT"].isin(candidate_ids),
41+
"gen_storage_energy_overnight_cost"].astype(float)
42+
43+
# Set to zero column that allows technology to provide reserves
44+
costs.loc[
45+
costs["GENERATION_PROJECT"].isin(candidate_ids), "gen_storage_energy_overnight_cost"
46+
] = gen_cost_mwh * percentage
47+
48+
# Save file again
49+
costs.to_csv("gen_build_costs.csv", index=False)

0 commit comments

Comments
 (0)