Skip to content

Commit be18549

Browse files
add transmission line upper/lower bound constraints
1 parent 7eb0fad commit be18549

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

prepshot/_model/transmission.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ def __init__(self, model : object) -> None:
5959
model.hour, model.month, model.year, model.zone, model.zone,
6060
rule=self.trans_up_bound_rule
6161
)
62+
model.trans_capacity_up_bound_cons = poi.make_tupledict(
63+
model.year, model.zone, model.zone,
64+
rule=self.trans_capacity_up_bound_rule
65+
)
66+
model.trans_capacity_low_bound_cons = poi.make_tupledict(
67+
model.year, model.zone, model.zone,
68+
rule=self.trans_capacity_low_bound_rule
69+
)
6270

6371
def trans_physical_rule(
6472
self, y : int, z : str, z1 : str
@@ -174,3 +182,61 @@ def trans_up_bound_rule(
174182
lhs = model.trans_export[h, m, y, z, z1] \
175183
- model.cap_lines_existing[y, z, z1]
176184
return model.add_linear_constraint(lhs, poi.Leq, 0)
185+
186+
def trans_capacity_up_bound_rule(
187+
self, y : int, z : str, z1 : str
188+
) -> poi.ConstraintIndex:
189+
"""Transmission line capacity is less than or equal to the
190+
prescribed upper bound.
191+
192+
Parameters
193+
----------
194+
h : int
195+
Hour.
196+
m : int
197+
Month.
198+
y : int
199+
Year.
200+
z : str
201+
Zone.
202+
z1 : str
203+
Zone.
204+
205+
Returns
206+
-------
207+
poi.ConstraintIndex
208+
The constraint of the model.
209+
"""
210+
model = self.model
211+
lhs = model.cap_lines_existing[y, z, z1] \
212+
- model.params['transmission_line_capacity_upper_bound'][z, z1]
213+
return model.add_linear_constraint(lhs, poi.Leq, 0)
214+
215+
def trans_capacity_low_bound_rule(
216+
self, y : int, z : str, z1 : str
217+
) -> poi.ConstraintIndex:
218+
"""Transmission line capacity is greater than or equal to the
219+
prescribed lower bound.
220+
221+
Parameters
222+
----------
223+
h : int
224+
Hour.
225+
m : int
226+
Month.
227+
y : int
228+
Year.
229+
z : str
230+
Zone.
231+
z1 : str
232+
Zone.
233+
234+
Returns
235+
-------
236+
poi.ConstraintIndex
237+
The constraint of the model.
238+
"""
239+
model = self.model
240+
lhs = model.cap_lines_existing[y, z, z1] \
241+
- model.params['transmission_line_capacity_lower_bound'][z, z1]
242+
return model.add_linear_constraint(lhs, poi.Geq, 0)

prepshot/output_data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ def extract_results_non_hydro(model : object) -> xr.Dataset:
120120
data_vars['cost'] = xr.DataArray(
121121
data = model.get_value(model.cost)
122122
)
123+
data_vars['line_capacity'] = create_data_array(
124+
model.cap_lines_existing, ['year', 'zone1', 'zone2'], 'MW', model
125+
)
123126

124127
return xr.Dataset(data_vars)
125128

8.44 KB
Binary file not shown.
8.47 KB
Binary file not shown.

0 commit comments

Comments
 (0)