Skip to content

Commit

Permalink
Add a single node example
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 8, 2024
1 parent 12f4f4c commit c1cd63a
Show file tree
Hide file tree
Showing 64 changed files with 728 additions and 2 deletions.
20 changes: 20 additions & 0 deletions example/single_node_with_hydro/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"general_parameters": {
"input_folder": "example/single_node_with_hydro/input",
"output_folder": "example/single_node_with_hydro/output",
"output_filename": "baseline",
"hour": 8760,
"month": 1,
"dt": 1,
"hours_in_year": 8760,
"price": 0.00
},
"hydro_parameters": {
"isinflow": true,
"error_threshold": 0.001,
"iteration_number": 1
},
"solver_parameters": {
"solver": "highs"
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added example/single_node_with_hydro/input/demand.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added example/single_node_with_hydro/input/inflow.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added example/single_node_with_hydro/input/low_gen.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added example/single_node_with_hydro/input/ramp_up.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
389 changes: 389 additions & 0 deletions example/single_node_with_hydro/main.ipynb

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
316 changes: 316 additions & 0 deletions example/single_node_with_hydro/params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,316 @@
{

"historical_capacity": {
"file_name": "historical_capacity",
"index_cols": [0],
"header_rows": [0, 1],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"capacity_factor": {
"file_name": "capacity_factor",
"index_cols": [0, 1, 2],
"header_rows": [0, 1],
"unstack_levels": [0, 1, 2],
"first_col_only": false,
"drop_na": true
},
"carbon_emission_limit": {
"file_name": "carbon_emission_limit",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": null,
"first_col_only": true,
"drop_na": true
},
"emission_factor": {
"file_name": "emission_factor",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"water_delay_time": {
"file_name": "water_delay_time",
"index_cols": null,
"header_rows": [0],
"unstack_levels": null,
"first_col_only": false,
"drop_na": false
},
"demand": {
"file_name": "demand",
"index_cols": [0, 1, 2],
"header_rows": [0],
"unstack_levels": [0, 1, 2],
"first_col_only": false,
"drop_na": true
},
"discount_factor": {
"file_name": "discount_factor",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": null,
"first_col_only": true,
"drop_na": true
},
"distance": {
"file_name": "distance",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"discharge_efficiency": {
"file_name": "discharge_efficiency",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"charge_efficiency": {
"file_name": "charge_efficiency",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"energy_to_power_ratio": {
"file_name": "energy_to_power_ratio",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": null,
"first_col_only": true,
"drop_na": true
},
"fuel_price": {
"file_name": "fuel_price",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"predefined_hydropower": {
"file_name": "predefined_hydropower",
"index_cols": [0, 1, 2],
"header_rows": [0, 1],
"unstack_levels": [0, 1, 2],
"first_col_only": false,
"drop_na": true
},
"inflow": {
"file_name": "inflow",
"index_cols": [0, 1, 2],
"header_rows": [0],
"unstack_levels": [0, 1, 2],
"first_col_only": false,
"drop_na": true
},
"initial_energy_storage_level": {
"file_name": "initial_energy_storage_level",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"lifetime": {
"file_name": "lifetime",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"new_technology_lower_bound": {
"file_name": "new_technology_lower_bound",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"new_technology_upper_bound": {
"file_name": "new_technology_upper_bound",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"ramp_down": {
"file_name": "ramp_down",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": null,
"first_col_only": true,
"drop_na": true
},
"ramp_up": {
"file_name": "ramp_up",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": null,
"first_col_only": true,
"drop_na": true
},
"reservoir_characteristics": {
"file_name": "reservoir_characteristics",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [-1],
"first_col_only": false,
"drop_na": false
},
"reservoir_storage_upper_bound": {
"file_name": "reservoir_storage_upper_bound",
"index_cols": [0, 1],
"header_rows": [0],
"unstack_levels": [0, 1],
"first_col_only": false,
"drop_na": true
},
"reservoir_storage_lower_bound": {
"file_name": "reservoir_storage_lower_bound",
"index_cols": [0, 1],
"header_rows": [0],
"unstack_levels": [0, 1],
"first_col_only": false,
"drop_na": true
},
"final_reservoir_storage_level": {
"file_name": "final_reservoir_storage_level",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"initial_reservoir_storage_level": {
"file_name": "initial_reservoir_storage_level",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"technology_fixed_OM_cost": {
"file_name": "technology_fixed_OM_cost",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"technology_investment_cost": {
"file_name": "technology_investment_cost",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"technology_portfolio": {
"file_name": "technology_portfolio",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"technology_upper_bound": {
"file_name": "technology_upper_bound",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"technology_variable_OM_cost": {
"file_name": "technology_variable_OM_cost",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"transmission_line_existing_capacity": {
"file_name": "transmission_line_existing_capacity",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"transmission_line_efficiency": {
"file_name": "transmission_line_efficiency",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"transmission_line_investment_cost": {
"file_name": "transmission_line_investment_cost",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"transmission_line_fixed_OM_cost": {
"file_name": "transmission_line_fixed_OM_cost",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"transmission_line_variable_OM_cost": {
"file_name": "transmission_line_variable_OM_cost",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"transmission_line_lifetime": {
"file_name": "transmission_line_lifetime",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": [0],
"first_col_only": false,
"drop_na": true
},
"technology_type": {
"file_name": "technology_type",
"index_cols": [0],
"header_rows": [0],
"unstack_levels": null,
"first_col_only": true,
"drop_na": true
},
"reservoir_tailrace_level_discharge_function": {
"file_name": "reservoir_tailrace_level_discharge_function",
"index_cols": null,
"header_rows": [0],
"unstack_levels": null,
"first_col_only": false,
"drop_na": false
},
"reservoir_forebay_level_volume_function": {
"file_name": "reservoir_forebay_level_volume_function",
"index_cols": null,
"header_rows": [0],
"unstack_levels": null,
"first_col_only": false,
"drop_na": false
}

}
1 change: 0 additions & 1 deletion prepshot/_model/cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def define_objective(self) -> None:
model.cost = model.cost_var + model.cost_newtech \
+ model.cost_fix + model.cost_newline - model.income
model.set_objective(model.cost, sense=poi.ObjectiveSense.Minimize)

def fuel_cost_breakdown(
self, y : int, z : str, te : str
) -> poi.ExprBuilder:
Expand Down
2 changes: 2 additions & 0 deletions prepshot/_model/investment.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def tech_up_bound_rule(
if tub != np.Inf:
lhs = model.cap_existing[y, z, te] - tub
return model.add_linear_constraint(lhs, poi.Leq, 0)
return None

def new_tech_up_bound_rule(
self, y : int, z : str, te : str
Expand All @@ -128,6 +129,7 @@ def new_tech_up_bound_rule(
if ntub != np.Inf:
lhs = model.cap_newtech[y, z, te] - ntub
return model.add_linear_constraint(lhs, poi.Leq, 0)
return None

def new_tech_low_bound_rule(
self, y : int, z : str, te : str
Expand Down
2 changes: 1 addition & 1 deletion prepshot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def calc_inv_cost_factor(
"""
check_positive(dep_period, interest_rate, year_built, year_min, year_max)
if (year_max <= year_min) or (year_max < year_built) \
if (year_max < year_min) or (year_max < year_built) \
or (year_built < year_min):
raise ValueError("Invalid year values.")

Expand Down

0 comments on commit c1cd63a

Please sign in to comment.