Skip to content

Commit

Permalink
Refined asymmetric flows; Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
sambuddhac authored and lbonaldo committed Dec 3, 2024
1 parent 8c270ba commit 0e224c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/load_inputs/load_network_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function load_network_data!(setup::Dict, path::AbstractString, inputs_nw::Dict)
inputs_nw["L"] = L
L_asym = 0 # Default number of asymmetrical lines
if setup["asymmetrical_trans_flow_limit"] == 1
L_asym = length(as_vector(network_var, :Asymmetrical, :Network_Lines)) #Number of asymmetrical lines
L_asym = length(filtered_vector(network_var, :Asymmetrical, :Network_Lines)) #Number of asymmetrical lines
end
println("Number of asymmetric lines: $L_asym")
inputs_nw["L_asym"] = L_asym
Expand Down Expand Up @@ -154,8 +154,8 @@ function load_network_data!(setup::Dict, path::AbstractString, inputs_nw::Dict)
inputs_nw["EXPANSION_LINES"] = findall(inputs_nw["pMax_Line_Reinforcement"] .>= 0)
inputs_nw["NO_EXPANSION_LINES"] = findall(inputs_nw["pMax_Line_Reinforcement"] .< 0)
if setup["asymmetrical_trans_flow_limit"] == 1
inputs_nw["EXPANSION_LINES_ASYM"] = findall((inputs_nw["pMax_Line_Reinforcement_Pos"] .> 0) || (inputs_nw["pMax_Line_Reinforcement_Neg"] .> 0))
inputs_nw["NO_EXPANSION_LINES_ASYM"] = findall((inputs_nw["pMax_Line_Reinforcement_Pos"] .< 0) && (inputs_nw["pMax_Line_Reinforcement_Neg"] .< 0))
inputs_nw["EXPANSION_LINES_ASYM"] = findall((inputs_nw["pMax_Line_Reinforcement_Pos"] .> 0) .| (inputs_nw["pMax_Line_Reinforcement_Neg"] .> 0))
inputs_nw["NO_EXPANSION_LINES_ASYM"] = findall((inputs_nw["pMax_Line_Reinforcement_Pos"] .< 0) .& (inputs_nw["pMax_Line_Reinforcement_Neg"] .< 0))
end
end

Expand Down Expand Up @@ -240,7 +240,7 @@ function network_map_matrix_format_deprecation_warning()
""" maxlog=1
end

function as_vector(network_var::DataFrame, asym_column::Symbol, col::Symbol)
asym_network_var = network_var[network_var[asym_col] .== 1, :]
return collect(skipmissing(asym_network_var[!, col]))
function filtered_vector(df::DataFrame, condition_col::Symbol, data_col::Symbol)
filtered_df = df[df[!,condition_col] .== 1, :]
return collect(skipmissing(filtered_df[!, data_col]))
end
4 changes: 2 additions & 2 deletions src/model/core/transmission/transmission.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ function transmission!(EP::Model, inputs::Dict, setup::Dict)
cMaxFlow_in[l = 1:L, t = 1:T], vFLOW[l, t] >= -EP[:eAvail_Trans_Cap][l]
end)

#if setup["asymmetrical_trans_flow_limit"] ==1
if setup["asymmetrical_trans_flow_limit"] ==1
# 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_asym, t = 1:T], vTAUX_POS[l, t] <= EP[:eAvail_Trans_Cap_Pos][l] #Change these with Auxiliary
cMaxFlow_in[l = 1:L_asym, t = 1:T], vTAUX_NEG[l, t] >= -EP[:eAvail_Trans_Cap_Neg][l] #Change these with Auxiliary
end)
#end
end

# Transmission loss related constraints - linear losses as a function of absolute value
if TRANS_LOSS_SEGS == 1
Expand Down
2 changes: 1 addition & 1 deletion src/write_outputs/transmission/write_transmission_flows.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function write_transmission_flows(path::AbstractString,
L_asym = 0 #Default number of asymmetrical lines
# Number of lines in the network
if setup["asymmetrical_trans_flow_limit"] == 1
L_asym = inputs_nw["L_asym"] #Number of transmission lines with different capacities in two directions
L_asym = inputs["L_asym"] #Number of transmission lines with different capacities in two directions
end
L = L_sym + L_asym
# Power flows on transmission lines at each time step
Expand Down

0 comments on commit 0e224c5

Please sign in to comment.