Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix transmission targets #1023

Merged
merged 3 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ def transmission_target_pos_dir_contribution_rule(mod, z, p):
:return:
"""
return sum(
mod.Transmission_Target_Energy_MW_Pos_Dir[tx, tmp]
(
mod.Transmission_Target_Energy_MW_Pos_Dir[tx, tmp]
if float(mod.contributes_net_flow_to_tx_target[tx]) == 0
else mod.Transmission_Target_Net_Energy_MW_Pos_Dir[tx, tmp]
)
* mod.hrs_in_tmp[tmp]
* mod.tmp_weight[tmp]
for (tx, tmp) in mod.TRANSMISSION_TARGET_TX_OPR_TMPS
Expand All @@ -59,7 +63,11 @@ def transmission_target_neg_dir_contribution_rule(mod, z, p):
:return:
"""
return sum(
mod.Transmission_Target_Energy_MW_Neg_Dir[tx, tmp]
(
mod.Transmission_Target_Energy_MW_Neg_Dir[tx, tmp]
if float(mod.contributes_net_flow_to_tx_target[tx]) == 0
else mod.Transmission_Target_Net_Energy_MW_Neg_Dir[tx, tmp]
)
* mod.hrs_in_tmp[tmp]
* mod.tmp_weight[tmp]
for (tx, tmp) in mod.TRANSMISSION_TARGET_TX_OPR_TMPS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,12 @@ def export_results(scenario_directory, subproblem, stage, m, d):
m.period[tmp],
m.tmp_weight[tmp],
m.hrs_in_tmp[tmp],
value(m.Transmission_Target_Energy_MW_Pos_Dir[tx, tmp]),
value(m.Transmission_Target_Energy_MW_Neg_Dir[tx, tmp]),
value(m.Transmission_Target_Energy_MW_Pos_Dir[tx, tmp])
if float(m.contributes_net_flow_to_tx_target[tx]) == 0
else value(m.Transmission_Target_Net_Energy_MW_Pos_Dir[tx, tmp]),
value(m.Transmission_Target_Energy_MW_Neg_Dir[tx, tmp])
if float(m.contributes_net_flow_to_tx_target[tx]) == 0
else value(m.Transmission_Target_Net_Energy_MW_Neg_Dir[tx, tmp]),
]
)

Expand Down Expand Up @@ -387,7 +391,6 @@ def write_model_inputs(

# Append correct values
for row in reader:
print(row)
# If tx line specified, check if BA specified or not
if row[0] in list(tx_line_zone_dict.keys()):
row.extend(tx_line_zone_dict[row[0]])
Expand All @@ -396,7 +399,6 @@ def write_model_inputs(
else:
row.extend([".", "."])
new_rows.append(row)
print(new_rows)

with open(
os.path.join(
Expand Down