Skip to content

Commit

Permalink
PR review updates
Browse files Browse the repository at this point in the history
-Updates following @trevorb1 PR review comments
-Fixed user defined IAR bug following user defined capacities for transmission
-Added comment in main scripts that config variables defined locally are for testing purposes only
-Compared results to master which are in line with small differences possibly as a result of the changes in the config file (user defined capacities separated for transmission and powerplants)
  • Loading branch information
maartenbrinkerink committed Oct 8, 2024
1 parent c907da0 commit dcf3edb
Show file tree
Hide file tree
Showing 5 changed files with 444 additions and 441 deletions.
26 changes: 16 additions & 10 deletions workflow/scripts/osemosys_global/powerplant/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ def main(
weo_costs: pd.DataFrame,
weo_regions: pd.DataFrame,
default_op_life: pd.DataFrame,
naming_convention_tech: pd.DataFrame,
tech_code: pd.DataFrame,
tech_list: pd.DataFrame,
tech_code_dict: pd.DataFrame,
custom_res_cap: pd.DataFrame,
default_av_factors: pd.DataFrame,
):

# CALL FUNCTIONS

# return generator_table
gen_table = set_generator_table(plexos_prop, plexos_memb, op_life_dict,
gen_table = set_generator_table(plexos_prop, plexos_memb, default_op_life,
tech_code_dict, start_year, end_year)

# Calculate average technology efficiencies.
Expand Down Expand Up @@ -106,7 +108,7 @@ def main(

# Set operational life for powerplant technologies.
df_op_life = set_op_life(tech_code_dict, df_iar_final,
df_oar_final, op_life_dict, region_name)
df_oar_final, default_op_life, region_name)

# Set annual capacity investment constraints.
df_max_cap_invest, df_min_cap_invest = cap_investment_constraints(df_iar_final,
Expand All @@ -115,9 +117,7 @@ def main(
end_year,
region_name)
# Calculate residual capacity.
df_res_cap = res_capacity(gen_table, tech_list, tech_code,
DUPLICATE_TECHS, start_year,
end_year, region_name)
df_res_cap = res_capacity(gen_table, DUPLICATE_TECHS, start_year, end_year, region_name)

if custom_nodes:

Expand Down Expand Up @@ -156,7 +156,7 @@ def main(
df_cap_cost_final
) = set_user_defined_capacity(
tech_capacity,
op_life_dict,
default_op_life,
tech_set,
df_min_cap_invest,
df_max_cap_invest,
Expand All @@ -175,7 +175,7 @@ def main(
)

# Set availability factors. Occurs after set_user_defined_capacity as tech_set gets updated.
df_af_final = availability_factor(availability, tech_set,
df_af_final = availability_factor(default_av_factors, tech_set,
start_year, end_year, region_name)

# OUTPUT CSV's USED AS INPUT FOR TRANSMISSION RULE
Expand Down Expand Up @@ -238,6 +238,10 @@ def main(
if custom_nodes:
file_custom_res_cap = snakemake.input.custom_res_cap

# The below else statement defines variables if the 'powerplant/main' script is to be run locally
# outside the snakemake workflow. This is relevant for testing purposes only! User inputs when running
# the full workflow need to be defined in the config file.

else:
file_plexos = 'resources/data/PLEXOS_World_2015_Gold_V1.1.xlsx'
file_default_op_life = 'resources/data/operational_life.csv'
Expand Down Expand Up @@ -289,8 +293,10 @@ def main(
"plexos_memb": plexos_memb,
"weo_costs": weo_costs,
"weo_regions": weo_regions,
"default_op_life": op_life,
"naming_convention_tech": tech_code,
"default_op_life": op_life_dict,
"tech_code": tech_code,
"tech_list": tech_list,
"tech_code_dict": tech_code_dict,
"custom_res_cap" : custom_res_cap,
"default_av_factors": availability,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
get_years
)

def res_capacity(df_gen_base, tech_list, df_tech_code, duplicate_techs,
start_year, end_year, region_name):
def res_capacity(df_gen_base, duplicate_techs, start_year, end_year, region_name):

# ### Calculate residual capacity
res_cap_cols = [
Expand Down
Loading

0 comments on commit dcf3edb

Please sign in to comment.