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

Update DC-OPF with correct PU and additional flow limit constraints #714

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
Draft
9 changes: 9 additions & 0 deletions src/load_inputs/load_network_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ function load_network_data!(setup::Dict, path::AbstractString, inputs_nw::Dict)
setup["NetworkExpansion"] = 0
end
println("Reading DC-OPF values...")
#Adding the base quantities
# Base voltage (in kV)
line_voltage_kV_Base = to_floats(:Line_Voltage_kV_Base)
# MVA_Base (in MVA)
MVA_Base = to_floats(:MVA_Base)
# Base reactance
line_reactance_Ohms_Base = (line_voltage_kV .^ 2) ./ MVA_Base
# Transmission line voltage (in kV)
line_voltage_kV = to_floats(:Line_Voltage_kV)
# Transmission line reactance (in Ohms)
Expand All @@ -52,6 +59,8 @@ function load_network_data!(setup::Dict, path::AbstractString, inputs_nw::Dict)
# MW = (kV)^2/Ohms
inputs_nw["pDC_OPF_coeff"] = ((line_voltage_kV .^ 2) ./ line_reactance_Ohms) /
scale_factor
#Reactance in pu
inputs_nw["pu_reactance"] = line_reactance_Ohms ./ line_reactance_Ohms_Base
end

# Maximum possible flow after reinforcement for use in linear segments of piecewise approximation
Expand Down
10 changes: 9 additions & 1 deletion src/model/core/transmission/dcopf_transmission.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,16 @@ function dcopf_transmission!(EP::Model, inputs::Dict, setup::Dict)
@constraint(EP,
cPOWER_FLOW_OPF[l = 1:L, t = 1:T],
EP[:vFLOW][l,
t]==inputs["pDC_OPF_coeff"][l] *
t]==(1/inputs["pu_reactance"][l]) *
sambuddhac marked this conversation as resolved.
Show resolved Hide resolved
sum(inputs["pNet_Map"][l, z] * vANGLE[z, t] for z in 1:Z))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change


# Maximum power flows, power flow on each transmission line cannot exceed maximum capacity of the line at any hour "t"
@constraints(EP,
begin
cMaxFlow_out[l = 1:L, t = 1:T], vFLOW[l, t] <= EP[:eAvail_Trans_Cap][l]
cMaxFlow_in[l = 1:L, t = 1:T], vFLOW[l, t] >= -EP[:eAvail_Trans_Cap][l]
end)

# Bus angle limits (except slack bus)
@constraints(EP,
Expand Down
Loading