Skip to content

Commit 0e224c5

Browse files
sambuddhaclbonaldo
authored andcommitted
Refined asymmetric flows; Debugging
1 parent 8c270ba commit 0e224c5

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/load_inputs/load_network_data.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function load_network_data!(setup::Dict, path::AbstractString, inputs_nw::Dict)
1919
inputs_nw["L"] = L
2020
L_asym = 0 # Default number of asymmetrical lines
2121
if setup["asymmetrical_trans_flow_limit"] == 1
22-
L_asym = length(as_vector(network_var, :Asymmetrical, :Network_Lines)) #Number of asymmetrical lines
22+
L_asym = length(filtered_vector(network_var, :Asymmetrical, :Network_Lines)) #Number of asymmetrical lines
2323
end
2424
println("Number of asymmetric lines: $L_asym")
2525
inputs_nw["L_asym"] = L_asym
@@ -154,8 +154,8 @@ function load_network_data!(setup::Dict, path::AbstractString, inputs_nw::Dict)
154154
inputs_nw["EXPANSION_LINES"] = findall(inputs_nw["pMax_Line_Reinforcement"] .>= 0)
155155
inputs_nw["NO_EXPANSION_LINES"] = findall(inputs_nw["pMax_Line_Reinforcement"] .< 0)
156156
if setup["asymmetrical_trans_flow_limit"] == 1
157-
inputs_nw["EXPANSION_LINES_ASYM"] = findall((inputs_nw["pMax_Line_Reinforcement_Pos"] .> 0) || (inputs_nw["pMax_Line_Reinforcement_Neg"] .> 0))
158-
inputs_nw["NO_EXPANSION_LINES_ASYM"] = findall((inputs_nw["pMax_Line_Reinforcement_Pos"] .< 0) && (inputs_nw["pMax_Line_Reinforcement_Neg"] .< 0))
157+
inputs_nw["EXPANSION_LINES_ASYM"] = findall((inputs_nw["pMax_Line_Reinforcement_Pos"] .> 0) .| (inputs_nw["pMax_Line_Reinforcement_Neg"] .> 0))
158+
inputs_nw["NO_EXPANSION_LINES_ASYM"] = findall((inputs_nw["pMax_Line_Reinforcement_Pos"] .< 0) .& (inputs_nw["pMax_Line_Reinforcement_Neg"] .< 0))
159159
end
160160
end
161161

@@ -240,7 +240,7 @@ function network_map_matrix_format_deprecation_warning()
240240
""" maxlog=1
241241
end
242242

243-
function as_vector(network_var::DataFrame, asym_column::Symbol, col::Symbol)
244-
asym_network_var = network_var[network_var[asym_col] .== 1, :]
245-
return collect(skipmissing(asym_network_var[!, col]))
243+
function filtered_vector(df::DataFrame, condition_col::Symbol, data_col::Symbol)
244+
filtered_df = df[df[!,condition_col] .== 1, :]
245+
return collect(skipmissing(filtered_df[!, data_col]))
246246
end

src/model/core/transmission/transmission.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ function transmission!(EP::Model, inputs::Dict, setup::Dict)
192192
cMaxFlow_in[l = 1:L, t = 1:T], vFLOW[l, t] >= -EP[:eAvail_Trans_Cap][l]
193193
end)
194194

195-
#if setup["asymmetrical_trans_flow_limit"] ==1
195+
if setup["asymmetrical_trans_flow_limit"] ==1
196196
# Maximum power flows, power flow on each transmission line cannot exceed maximum capacity of the line at any hour "t"
197197
@constraints(EP,
198198
begin
199199
cMaxFlow_out[l = 1:L_asym, t = 1:T], vTAUX_POS[l, t] <= EP[:eAvail_Trans_Cap_Pos][l] #Change these with Auxiliary
200200
cMaxFlow_in[l = 1:L_asym, t = 1:T], vTAUX_NEG[l, t] >= -EP[:eAvail_Trans_Cap_Neg][l] #Change these with Auxiliary
201201
end)
202-
#end
202+
end
203203

204204
# Transmission loss related constraints - linear losses as a function of absolute value
205205
if TRANS_LOSS_SEGS == 1

src/write_outputs/transmission/write_transmission_flows.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function write_transmission_flows(path::AbstractString,
88
L_asym = 0 #Default number of asymmetrical lines
99
# Number of lines in the network
1010
if setup["asymmetrical_trans_flow_limit"] == 1
11-
L_asym = inputs_nw["L_asym"] #Number of transmission lines with different capacities in two directions
11+
L_asym = inputs["L_asym"] #Number of transmission lines with different capacities in two directions
1212
end
1313
L = L_sym + L_asym
1414
# Power flows on transmission lines at each time step

0 commit comments

Comments
 (0)