Skip to content

Commit

Permalink
contingency: Fix bug for SCLOPF with lower branch constraint
Browse files Browse the repository at this point in the history
The bug only affects extendable lines, and breaks code rather than
going unnoticed.

Thanks to Clara Büttner for spotting the error and fixing it!
  • Loading branch information
nworbmot committed Jul 11, 2019
1 parent 592dfff commit 7038b76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pypsa/contingency.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def add_contingency_constraints(network,snapshots):

flow_lower.update({(branch[0],branch[1],b[0],b[1],sn) : [[(1,network.model.passive_branch_p[b[0],b[1],sn]),(sub.BODF[sub._branches.at[b,"_i"],branch_i],network.model.passive_branch_p[branch[0],branch[1],sn])],">=",-sub._fixed_branches.at[b,"s_nom"]] for b in sub._fixed_branches.index for sn in snapshots})

flow_upper.update({(branch[0],branch[1],b[0],b[1],sn) : [[(1,network.model.passive_branch_p[b[0],b[1],sn]),(sub.BODF[sub._branches.at[b,"_i"],branch_i],network.model.passive_branch_p[branch[0],branch[1],sn]),(1,network.model.passive_branch_s_nom[b[0],b[1]])],">=",0] for b in sub._extendable_branches.index for sn in snapshots})
flow_lower.update({(branch[0],branch[1],b[0],b[1],sn) : [[(1,network.model.passive_branch_p[b[0],b[1],sn]),(sub.BODF[sub._branches.at[b,"_i"],branch_i],network.model.passive_branch_p[branch[0],branch[1],sn]),(1,network.model.passive_branch_s_nom[b[0],b[1]])],">=",0] for b in sub._extendable_branches.index for sn in snapshots})


l_constraint(network.model,"contingency_flow_upper",flow_upper,branch_outage_keys,snapshots)
Expand Down

0 comments on commit 7038b76

Please sign in to comment.