Skip to content

Commit

Permalink
Use rts_gmlc data package for Double Loop (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbianchi-lbl authored May 24, 2023
1 parent 08c117a commit e1ef58b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
"from prescient.simulator import Prescient\n",
"\n",
"# Import integrated ultra-supercritical power plant with energy storage model\n",
"from dispatches.case_studies.fossil_case.ultra_supercritical_plant.storage.multiperiod_double_loop_usc import MultiPeriodUsc\n",
"from dispatches_sample_data import rts_gmlc"
"from dispatches.case_studies.fossil_case.ultra_supercritical_plant.storage.multiperiod_double_loop_usc import MultiPeriodUsc"
]
},
{
Expand Down Expand Up @@ -1713,7 +1712,7 @@
"metadata": {},
"source": [
"**IMPORTANT** Before proceeding with the rest of the notebook:\n",
"1. Install the `dispatches-sample-data` package by running `pip install dispatches-sample-data` in the working conda environment\n",
"1. Install the `rts_gmlc` data package by running `pip install dispatches-rts-gmlc-data` in the working conda environment\n",
"\n",
"OR\n",
"\n",
Expand All @@ -1728,11 +1727,12 @@
"metadata": {},
"outputs": [],
"source": [
"# If installing the dispatches-sample-data\n",
"rts_gmlc_data_dir = str(rts_gmlc.source_data_path)\n",
"# If installing the `rts_gmlc` data package\n",
"from dispatches_data.api import path\n",
"rts_gmlc_data_dir = str(path(\"rts_gmlc\") / \"SourceData\")\n",
"\n",
"# If downloading the data to the local machine use the following option with appropriate path\n",
"# rts_gmlc_data_dir = \"/projects/gmihybridsys/dguittet/data/RTS-GMLC/RTS_Data/SourceData\"\n"
"# rts_gmlc_data_dir = \"/projects/gmihybridsys/dguittet/data/RTS-GMLC/RTS_Data/SourceData\""
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@
"from idaes.core.solvers import get_solver\n",
"from idaes.apps.grid_integration.model_data import ThermalGeneratorModelData\n",
"\n",
"# Import Prescient and the RTS-GMLC dataset\n",
"# Import Prescient\n",
"from prescient.simulator import Prescient\n",
"from dispatches_sample_data import rts_gmlc\n",
"\n",
"# Import nuclear flowsheet\n",
"from dispatches.case_studies.nuclear_case.nuclear_flowsheet_multiperiod_class import MultiPeriodNuclear"
Expand Down Expand Up @@ -540,12 +539,12 @@
"\n",
"**IMPORTANT** Before proceeding with the rest of the notebook:\n",
"\n",
"1. Install the `dispatches-sample-data` package by running `pip install dispatches-sample-data` in the terminal\n",
"1. Install the `rts_gmlc` data package by running `pip install dispatches-rts-gmlc-data` in the working conda environment\n",
"\n",
"OR\n",
"\n",
"1. Download the RTS-GMLC dataset from [this repository](https://github.com/GridMod/RTS-GMLC) (or directly as a zipfile [here](https://github.com/GridMod/RTS-GMLC/archive/refs/heads/master.zip)) to your local machine\n",
"2. Update the value of the `rst_gmlc_data_dir` variable in the cell below to the appropriate location of the `RTS_Data/SourceData` subfolder on your local machine."
"1. Download the RTS-GMLC dataset from [https://github.com/GridMod/RTS-GMLC] (or directly as a zipfile here) to your local machine\n",
"2. Update the value of the `rst_gmlc_data_dir` variable in the cell below to the appropriate location of the `RTS_Data/SourceData` subfolder on your local machine"
]
},
{
Expand Down Expand Up @@ -9869,8 +9868,9 @@
}
],
"source": [
"from dispatches_data.api import path\n",
"# Folder containing the RTS - GMLC data\n",
"rts_gmlc_data_dir = str(rts_gmlc.source_data_path)\n",
"rts_gmlc_data_dir = str(path(\"rts_gmlc\") / \"SourceData\")\n",
"\n",
"# Set Prescient options\n",
"options = {\n",
Expand Down Expand Up @@ -10042,7 +10042,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.7.10 ('hybrid')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"import pyomo.environ as pyo\n",
"import idaes\n",
"\n",
"from dispatches_sample_data import rts_gmlc\n",
"from dispatches_data.api import path\n",
"from dispatches.case_studies.renewables_case.wind_battery_double_loop import MultiPeriodWindBattery\n",
"from dispatches.case_studies.renewables_case.double_loop_utils import *\n",
"\n",
Expand Down Expand Up @@ -76,6 +76,7 @@
"import os\n",
"\n",
"TESTING_MODE = bool(os.environ.get(\"DISPATCHES_TESTING_MODE\", None))\n",
"rts_gmlc_source_data_path = path(\"rts_gmlc\") / \"SourceData\"\n",
"\n",
"sim_days = 7 if not TESTING_MODE else 1\n",
"start_date = \"01-02-2020\"\n",
Expand All @@ -88,7 +89,7 @@
"wind_generator = f\"{wind_bus}_WIND_1\"\n",
"\n",
"prescient_options = {\n",
" \"data_path\": rts_gmlc.source_data_path,\n",
" \"data_path\": str(rts_gmlc_source_data_path),\n",
" \"input_format\": \"rts-gmlc\",\n",
" \"simulate_out_of_sample\": True,\n",
" \"run_sced_with_persistent_forecast_errors\": True,\n",
Expand Down Expand Up @@ -1866,7 +1867,7 @@
"pd.set_option('display.max_rows', None)\n",
"plt.style.use('seaborn')\n",
"\n",
"df = double_loop_outputs_for_gen(output_dir, rts_gmlc.source_data_path)\n",
"df = double_loop_outputs_for_gen(output_dir, rts_gmlc_source_data_path)\n",
"prescient_df = df[df['Model'] == \"Prescient\"].copy()\n",
"da_bidder_df = df[df['Model'] == \"DA Bidder\"].copy()\n",
"rt_bidder_df = df[df['Model'] == \"RT Bidder\"].copy()\n",
Expand Down
4 changes: 2 additions & 2 deletions dispatches/case_studies/renewables_case/run_double_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from pyomo.common.fileutils import this_file_dir
import pandas as pd
from pathlib import Path
from dispatches_sample_data import rts_gmlc
from dispatches_data.api import path

this_file_path = Path(this_file_dir())

Expand Down Expand Up @@ -130,7 +130,7 @@
gen_capacity_factor = prescient_outputs_df[f"{wind_generator}-RTCF"].values.tolist()

# NOTE: `rts_gmlc_data_dir` should point to a directory containing RTS-GMLC scenarios
rts_gmlc_data_dir = rts_gmlc.source_data_path
rts_gmlc_data_dir = path("rts_gmlc") / "SourceData"
output_dir = Path(f"sim_{sim_id}_results")

solver = pyo.SolverFactory("xpress_direct")
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class SpecialDependencies:
"gridx-prescient>=2.2.2",
"nrel-pysam>=3.0.1",
"dispatches-data-packages >= 23.3.19",
"dispatches-rts-gmlc-data @ git+https://github.com/gmlc-dispatches/rts-gmlc-data@main",
*SPECIAL_DEPENDENCIES
],
extras_require={
Expand Down

0 comments on commit e1ef58b

Please sign in to comment.