Skip to content

Commit 2375a79

Browse files
authored
GridPath v2026.1.0
Merge pull request #1327 from blue-marble/develop
2 parents ceedfd5 + b076b36 commit 2375a79

434 files changed

Lines changed: 3126 additions & 3635 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,35 +50,3 @@ pip install .[all]
5050
```
5151

5252
**NOTE:** If you plan to edit the GridPath code, you should install with the `-e` flag.
53-
54-
## Solver
55-
You will need a solver to use this platform. GridPath assumes you will be using Cbc (Coin-or branch and cut) by default, but you can specify a
56-
different solver.
57-
58-
59-
# Usage
60-
61-
## The gridpath_run and gridpath_run_e2e commands
62-
If you install GridPath via the setup script following the instructions above,
63-
you can use the command `gridpath_run` to run a scenario from any directory
64-
-- as long as your GridPath Python environment is enabled -- as follows:
65-
```bash
66-
gridpath_run --scenario SCENARIO_NAME --scenario_location
67-
/PATH/TO/SCENARIO
68-
```
69-
70-
If you are using the database, you can use the command `gridpath_run_e2e` to
71-
run GridPath end-to-end, i.e. get inputs for the scenario from the database,
72-
solve the scenario problem, import the results into the database, and
73-
process them. Refer to the documentation for how to build the database.
74-
75-
```bash
76-
gridpath_run_e2e --scenario SCENARIO_NAME --scenario_location
77-
/PATH/TO/SCENARIO
78-
```
79-
80-
To see usage and other optional arguments, e.g. how to specify a
81-
solver, check the help menu, e.g.:
82-
```bash
83-
gridpath_run --help
84-
```

data_toolkit/manual_adjustments.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
DISAGG_PROJECT_NAME_STR,
2626
)
2727

28-
2928
# Storage durations
3029
STORAGE_DURATION_DEFAULTS = {"BA": 1, "PS": 12}
3130
SPEC_CAP_ID_DEFAULT = 1
@@ -162,8 +161,7 @@ def add_battery_durations(
162161
relevant_projects_df = pd.read_sql(sql, conn)
163162

164163
if not relevant_projects_df.empty:
165-
spec_cap_updated_df = duckdb_conn.sql(
166-
f"""
164+
spec_cap_updated_df = duckdb_conn.sql(f"""
167165
CREATE TABLE {tech}_relevant_projects_table
168166
AS SELECT * FROM relevant_projects_df
169167
;
@@ -173,15 +171,12 @@ def add_battery_durations(
173171
WHERE (project, period) IN (SELECT (project, period) FROM {tech}_relevant_projects_table)
174172
AND specified_stor_capacity_mwh IS NULL
175173
;
176-
"""
177-
)
174+
""")
178175

179-
spec_cap_updated_df = duckdb_conn.sql(
180-
"""
176+
spec_cap_updated_df = duckdb_conn.sql("""
181177
SELECT * FROM spec_cap_table
182178
;
183-
"""
184-
).df()
179+
""").df()
185180

186181
spec_cap_updated_df.to_csv(
187182
os.path.join(csv_location, f"{subscenario_id}_" f"{subscenario_name}.csv"),

data_toolkit/project/availability/outages/create_availability_iteration_input_csvs.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,9 @@ def main(args=None):
384384

385385
db = connect_to_database(parsed_args.database)
386386

387-
projects = [
388-
i[0]
389-
for i in db.execute(
390-
"""
387+
projects = [i[0] for i in db.execute("""
391388
SELECT DISTINCT project FROM raw_data_unit_availability_params;
392-
"""
393-
).fetchall()
394-
]
389+
""").fetchall()]
395390

396391
all_files = []
397392
pool_data = []

data_toolkit/project/capacity_specified/eia860_to_project_specified_capacity_input_csvs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
4949
"""
5050

51-
5251
import csv
5352
from argparse import ArgumentParser
5453
import os.path

data_toolkit/project/create_monte_carlo_gen_input_csvs_common.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ def create_project_csv(
133133
c = conn.cursor()
134134

135135
# Get all the draws
136-
draws = c.execute(
137-
f"""
136+
draws = c.execute(f"""
138137
SELECT weather_iteration, draw_number,
139138
{timeseries_name}_year, {timeseries_name}_month,
140139
{timeseries_name}_day_of_month
@@ -143,8 +142,7 @@ def create_project_csv(
143142
AND weather_draws_id = {weather_draws_id}
144143
ORDER BY weather_iteration, draw_number
145144
;
146-
"""
147-
).fetchall()
145+
""").fetchall()
148146

149147
for weather_iteration, draw_number, year, month, day_of_month in draws:
150148
# For each project, get the weighted cap factor for each of its

data_toolkit/project/opchar/eia860_to_project_opchar_input_csvs.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
AGG_PROJECT_NAME_STR,
7272
)
7373

74-
7574
# TODO: add var costs, startup and shutdown costs, and startup fuel use
7675

7776

@@ -311,6 +310,9 @@ def make_opchar_sql_str(
311310
load_component_shift_bounds_scenario_id="NULL",
312311
efficiency_factor="NULL",
313312
energy_requirement_factor="NULL",
313+
losses_factor_in_energy_target="NULL",
314+
losses_factor_curtailment="NULL",
315+
upward_reserves_to_soc_depletion="NULL",
314316
):
315317
""" """
316318

@@ -408,7 +410,10 @@ def make_opchar_sql_str(
408410
{load_component_shift_bounds_scenario_id} AS
409411
load_component_shift_bounds_scenario_id,
410412
{efficiency_factor} AS efficiency_factor,
411-
{energy_requirement_factor} AS energy_requirement_factor
413+
{energy_requirement_factor} AS energy_requirement_factor,
414+
{losses_factor_in_energy_target} AS losses_factor_in_energy_target,
415+
{losses_factor_curtailment} AS losses_factor_curtailment,
416+
{upward_reserves_to_soc_depletion} AS upward_reserves_to_soc_depletion
412417
"""
413418

414419
return opchar_sql_str

data_toolkit/project/opchar/fuels/eia860_to_project_fuel_input_csvs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
5454
"""
5555

56-
5756
import csv
5857
from argparse import ArgumentParser
5958
import os.path

data_toolkit/project/opchar/heat_rates/eia860_to_project_heat_rate_input_csvs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,12 @@ def get_project_heat_rates(
130130
min_load_fraction,
131131
) in c.execute(sql).fetchall():
132132
c2 = conn.cursor()
133-
min_load_heat_rate_coefficient = c2.execute(
134-
f"""
133+
min_load_heat_rate_coefficient = c2.execute(f"""
135134
SELECT average_heat_rate_coefficient
136135
FROM user_defined_heat_rate_curve
137136
WHERE load_point_fraction = {min_load_fraction}
138137
;
139-
"""
140-
).fetchone()[0]
138+
""").fetchone()[0]
141139
with open(
142140
os.path.join(
143141
csv_location,

data_toolkit/project/opchar/hydro/create_hydro_iteration_input_csvs.py

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252

5353
from db.common_functions import connect_to_database
5454

55-
5655
# TODO: leap years
5756
# TODO: hydro bins -- pick bin at random, pick year from bin at random; match
5857
# month
@@ -120,24 +119,14 @@ def calculate_from_project_year_month_data(
120119
conn = connect_to_database(db_path=db_path)
121120
c = conn.cursor()
122121

123-
hydro_years = [
124-
y[0]
125-
for y in c.execute(
126-
"""
122+
hydro_years = [y[0] for y in c.execute("""
127123
SELECT DISTINCT year FROM raw_data_hydro_years;
128-
"""
129-
).fetchall()
130-
]
124+
""").fetchall()]
131125

132-
bt_horizons = [
133-
bt_h
134-
for bt_h in c.execute(
135-
"""
126+
bt_horizons = [bt_h for bt_h in c.execute("""
136127
SELECT DISTINCT balancing_type, horizon
137128
FROM user_defined_balancing_type_horizons;
138-
"""
139-
).fetchall()
140-
]
129+
""").fetchall()]
141130

142131
if overwrite:
143132
filename = get_filename(
@@ -154,15 +143,13 @@ def calculate_from_project_year_month_data(
154143
# Create hydro inputs for each year and balancing type
155144
for yr in hydro_years:
156145
for bt, h in bt_horizons:
157-
hr_start, hr_end = c.execute(
158-
f"""
146+
hr_start, hr_end = c.execute(f"""
159147
SELECT hour_ending_of_year_start, hour_ending_of_year_end
160148
FROM user_defined_balancing_type_horizons
161149
WHERE balancing_type = '{bt}'
162150
AND horizon = {h}
163151
;
164-
"""
165-
).fetchone()
152+
""").fetchone()
166153

167154
month_weights = {}
168155
total = 0
@@ -193,17 +180,15 @@ def calculate_from_project_year_month_data(
193180
weighted_avg, weighted_min, weighted_max = 0, 0, 0
194181
for month in month_weights.keys():
195182
weight = month_weights[month]
196-
avg, min, max = c.execute(
197-
f"""
183+
avg, min, max = c.execute(f"""
198184
SELECT average_power_fraction, min_power_fraction,
199185
max_power_fraction
200186
FROM raw_data_project_hydro_opchars_by_year_month
201187
WHERE project = '{prj}'
202188
AND hydro_year = {yr}
203189
AND month = {month}
204190
;
205-
"""
206-
).fetchone()
191+
""").fetchone()
207192

208193
weighted_avg += weight * avg
209194
weighted_min += weight * min
@@ -291,15 +276,10 @@ def main(args=None):
291276
db = connect_to_database(parsed_args.database)
292277

293278
c = db.cursor()
294-
projects = [
295-
prj[0]
296-
for prj in c.execute(
297-
"""
279+
projects = [prj[0] for prj in c.execute("""
298280
SELECT DISTINCT project
299281
FROM raw_data_project_hydro_opchars_by_year_month;
300-
"""
301-
).fetchall()
302-
]
282+
""").fetchall()]
303283
pool_data = tuple(
304284
[
305285
[

data_toolkit/project/opchar/var_profiles/create_sync_var_gen_input_csvs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
4545
"""
4646

47-
4847
from argparse import ArgumentParser
4948
from multiprocessing import get_context
5049
import os.path

0 commit comments

Comments
 (0)