Skip to content

Commit

Permalink
Merge branch 'main' into tredwar-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rundxdi authored Jul 5, 2024
2 parents 70b021d + 3951ab7 commit cbed644
Show file tree
Hide file tree
Showing 16 changed files with 228,803 additions and 74 deletions.
8,785 changes: 8,785 additions & 0 deletions gtep/data/5bus_jsc/DAY_AHEAD_load.csv

Large diffs are not rendered by default.

8,785 changes: 8,785 additions & 0 deletions gtep/data/5bus_jsc/DAY_AHEAD_renewables.csv

Large diffs are not rendered by default.

105,409 changes: 105,409 additions & 0 deletions gtep/data/5bus_jsc/REAL_TIME_load.csv

Large diffs are not rendered by default.

105,409 changes: 105,409 additions & 0 deletions gtep/data/5bus_jsc/REAL_TIME_renewables.csv

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions gtep/data/5bus_jsc/branch.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
UID,From Bus,To Bus,R,X,B,Cont Rating,LTE Rating,STE Rating,Tr Ratio
branch_2_3,2,3,0.00108,0.0108,0.01852,80,92,104,0
branch_1_2-c,1,2,0.00281,0.0281,0.00712,66.6,76.6,86.6,0
branch_1_4,1,4,0.00304,0.0304,0.00658,66.6,76.6,86.6,0
branch_4_10,4,10,0.00297,0.0297,0.00674,66.6,76.6,86.6,0
branch_1_10,1,10,0.00064,0.0064,0.03126,66.6,76.6,86.6,0
branch_3_4_0,3,4,0.00297,0.0297,0.00337,66.6,76.6,86.6,1.05
branch_3_4_1,3,4,0.003274425,0.03274425,0.003056689,28.4,32.7,36.9,0.952380952
6 changes: 6 additions & 0 deletions gtep/data/5bus_jsc/bus.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bus ID,Bus Name,BaseKV,Bus Type,MW Load,MVAR Load,V Mag,V Angle,Area,Zone
1,bus1,230,PV,0,0,1,0.048935018,1,1
4,bus4,230,Ref,28.5714286,9.3907143,1,0,1,1
10,bus10,230,PV,0,0,1,0.06266308,1,1
2,bus2,230,PQ,21.4285714,7.0435714,1.04407,-0.012822061,2,1
3,bus3,230,PV,21.4285714,7.0435714,1,-0.009768957,2,1
9 changes: 9 additions & 0 deletions gtep/data/5bus_jsc/gen.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
GEN UID,Bus ID,Unit Type,Fuel,MW Inj,MVAR Inj,V Setpoint p.u.,PMax MW,PMin MW,QMax MVAR,QMin MVAR,Min Down Time Hr,Min Up Time Hr,Ramp Rate MW/Min,Start Time Cold Hr,Start Time Warm Hr,Start Time Hot Hr,Start Heat Cold MBTU,Start Heat Warm MBTU,Start Heat Hot MBTU,Non Fuel Start Cost $,Fuel Price $/MMBTU,Output_pct_0,Output_pct_1,Output_pct_2,Output_pct_3,Output_pct_4,HR_avg_0,HR_incr_1,HR_incr_2,HR_incr_3,HR_incr_4
3_CT,3,CT,G,0,0,1,20,8,20,-20,1,1,3,,,1,,,51.75,0,0.75,0.4,0.6,0.8,1,,135722.5,97862.5,98072.5,107135,
10_STEAM,10,STEAM,C,0,0,1,76,30,76,-76,4,8,2,12,10,4,11383.41,10488.35,7355.42,0,1,0.394736842,0.596052632,0.798684211,1,,30166.66667,14402.61434,17182.46753,18283.66017,
4_CC,4,CC,G,0,0,1,100,10,55,-55,3,3,3.7,,,3,,,5665.23,0,0.5,0.4,0.6,0.8,1,,51019.54545,26818.18182,29550.90909,30308.18182,
4_STEAM,4,STEAM,O,0,0,1,12,5,12,-12,2,4,1,12,4,2,703.76,455.37,393.28,0,1.5,0.416666667,0.608333333,0.808333333,1,,179457.9999,124504.3483,125050,133643.478,
10_PV,10,PV,S,0,0,1,25.9,0,0,0,,,,,,,,,,0,,,,,,,,,,,
2_RTPV,2,RTPV,S,0,0,1,9.3,0,0,0,,,,,,,,,,0,,,,,,,,,,,
1_HYDRO,1,HYDRO,H,0,0,1,50,0,16,-10,,,,,,,,,,0,,,,,,,,,,,
4_WIND-c,4,WIND,W,0,0,1,120,0,0,0,,,,,,,,,,0,,,,,,,,,,,
3 changes: 3 additions & 0 deletions gtep/data/5bus_jsc/initial_status.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3_CT,10_STEAM,4_CC,4_STEAM
24,-24,24,-24,
14,0,40,0
1 change: 1 addition & 0 deletions gtep/data/5bus_jsc/reserves.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reserve Product,Requirement (MW)
7 changes: 7 additions & 0 deletions gtep/data/5bus_jsc/simulation_objects.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Simulation_Parameters,Description,DAY_AHEAD,REAL_TIME
Periods_per_Step,the number of discrete periods represented in each simulation step,24,1
Period_Resolution,seconds per period,3600,300
Date_From,simulation beginning period,01/01/2020 0:00,01/01/2020 0:00
Date_To,simulation ending period (must account for lookahed data availability),12/31/2020 0:00,12/31/2020 0:00
Look_Ahead_Periods_per_Step,the number of look ahead periods included in each optimization step,24,2
Look_Ahead_Resolution,look-ahead period resolution,3600,300
17 changes: 17 additions & 0 deletions gtep/data/5bus_jsc/timeseries_pointers.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Simulation,Category,Object,Parameter,Data File
DAY_AHEAD,Generator,1_HYDRO,PMin MW,DAY_AHEAD_renewables.csv
DAY_AHEAD,Generator,2_RTPV,PMin MW,DAY_AHEAD_renewables.csv
DAY_AHEAD,Generator,1_HYDRO,PMax MW,DAY_AHEAD_renewables.csv
DAY_AHEAD,Generator,2_RTPV,PMax MW,DAY_AHEAD_renewables.csv
DAY_AHEAD,Generator,10_PV,PMax MW,DAY_AHEAD_renewables.csv
DAY_AHEAD,Generator,4_WIND,PMax MW,DAY_AHEAD_renewables.csv
DAY_AHEAD,Area,1,MW Load,DAY_AHEAD_load.csv
DAY_AHEAD,Area,2,MW Load,DAY_AHEAD_load.csv
REAL_TIME,Generator,1_HYDRO,PMin MW,REAL_TIME_renewables.csv
REAL_TIME,Generator,2_RTPV,PMin MW,REAL_TIME_renewables.csv
REAL_TIME,Generator,1_HYDRO,PMax MW,REAL_TIME_renewables.csv
REAL_TIME,Generator,2_RTPV,PMax MW,REAL_TIME_renewables.csv
REAL_TIME,Generator,10_PV,PMax MW,REAL_TIME_renewables.csv
REAL_TIME,Generator,4_WIND,PMax MW,REAL_TIME_renewables.csv
REAL_TIME,Area,1,MW Load,REAL_TIME_load.csv
REAL_TIME,Area,2,MW Load,REAL_TIME_load.csv
54 changes: 34 additions & 20 deletions gtep/driver.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
from pyomo.environ import ConcreteModel, Var, SolverFactory, value
from pyomo.environ import units as u
from gtep.gtep_model import ExpansionPlanningModel
from gtep.gtep_data import ExpansionPlanningData
from gtep.gtep_solution import ExpansionPlanningSolution
from egret.data.model_data import ModelData
from pyomo.core import TransformationFactory
from pyomo.contrib.appsi.solvers.highs import Highs
from pyomo.contrib.appsi.solvers.gurobi import Gurobi


data_path = "./gtep/data/5bus"
data_path = "./gtep/data/WECC_Reduced_USAEE"
data_object = ExpansionPlanningData()
data_object.load_prescient(data_path)

# mod_object = ExpansionPlanningModel(
# data=data_object.md, num_reps=2, len_reps=3, num_commit=4, num_dispatch=5
# )
# mod_object.create_model()
# TransformationFactory("gdp.bound_pretransformation").apply_to(mod_object.model)
# TransformationFactory("gdp.bigm").apply_to(mod_object.model)
# # opt = SolverFactory("gurobi")
# opt = Highs()
# # mod_object.results = opt.solve(mod_object.model, tee=True)
# mod_object.results = opt.solve(mod_object.model)

sol_object = ExpansionPlanningSolution()

# sol_object.load_from_model(mod_object)
# sol_object.dump_json()
mod_object = ExpansionPlanningModel(
stages=2,
data=data_object.md,
num_reps=2,
len_reps=1,
num_commit=24,
num_dispatch=12,
)
mod_object.create_model()
TransformationFactory("gdp.bound_pretransformation").apply_to(mod_object.model)
TransformationFactory("gdp.bigm").apply_to(mod_object.model)
# opt = SolverFactory("gurobi")
# opt = Gurobi()
opt = Highs()
# mod_object.results = opt.solve(mod_object.model, tee=True)
mod_object.results = opt.solve(mod_object.model)


sol_object.import_data_object(data_object)
Expand All @@ -38,4 +36,20 @@
# sol_object.read_json("./gtep_wiggles.json")
sol_object.plot_levels(save_dir="./plots/")

# save_numerical_results = False
# if save_numerical_results:

# sol_object = ExpansionPlanningSolution()

# sol_object.load_from_model(mod_object)
# sol_object.dump_json()
# load_numerical_results = False
# if load_numerical_results:
# # sol_object.read_json("./gtep_solution.json")
# sol_object.read_json("./bigger_longer_wigglier_gtep_solution.json")
# plot_results = False
# if plot_results:
# sol_object.plot_levels(save_dir="./plots/")


pass
56 changes: 56 additions & 0 deletions gtep/driver_jsc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 4 14:56:46 2024
@author: jscelay
Test driver for IDAES-GTEP
"""

from pyomo.environ import ConcreteModel, Var, SolverFactory, value
from pyomo.environ import units as u
from gtep.gtep_model import ExpansionPlanningModel
from gtep.gtep_data import ExpansionPlanningData
from gtep.gtep_solution import ExpansionPlanningSolution
from egret.data.model_data import ModelData
from pyomo.core import TransformationFactory
from pyomo.contrib.appsi.solvers.highs import Highs
from pyomo.contrib.appsi.solvers.gurobi import Gurobi

# data_path = "./data/5bus"
data_path = "./data/5bus_jsc"
data_object = ExpansionPlanningData()
data_object.load_prescient(data_path)
# mod_object = ExpansionPlanningModel(
# data=data_object.md, num_reps=2, len_reps=1, stages=2, num_commit=24, num_dispatch=12
# )
mod_object = ExpansionPlanningModel(
data=data_object.md, num_reps=1, len_reps=1, stages=1, num_commit=24, num_dispatch=12
)
mod_object.create_model()
TransformationFactory("gdp.bound_pretransformation").apply_to(mod_object.model)
TransformationFactory("gdp.bigm").apply_to(mod_object.model)
opt = Highs()
# opt = SolverFactory("gurobi", solver_io="python")
# opt = Gurobi()
#mod_object.results = opt.solve(mod_object.model, tee=True)
mod_object.results = opt.solve(mod_object.model)


save_numerical_results = True
if save_numerical_results:

sol_object = ExpansionPlanningSolution()

sol_object.load_from_model(mod_object)
sol_object.dump_json()
load_numerical_results = True
if load_numerical_results:
sol_object.read_json("./gtep_solution_jscTest.json")
# sol_object.read_json("./gtep_solution.json")
#sol_object.read_json("./bigger_longer_wigglier_gtep_solution.json")
plot_results = True
if plot_results:
sol_object.plot_levels(save_dir="./plots/")

pass
7 changes: 6 additions & 1 deletion gtep/gtep_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ def load_prescient(self, data_path, options_dict=None):
self.load_default_data_settings()

for gen in self.md.data["elements"]["generator"]:
if "-c" in gen:
if "-c" in gen: # key/Gen UID in csv file; -c = candidate?
self.md.data["elements"]["generator"][gen]["in_service"] = False

# JSC addn
for branch in self.md.data["elements"]["branch"]:
if "-c" in branch: # key/Branch UID
self.md.data["elements"]["branch"][branch]["in_service"] = False

## NOTE: Below is only for multiple representative periods and creates a list
## of modelData objects, not just a single modelData object
Expand Down
Loading

0 comments on commit cbed644

Please sign in to comment.