@@ -579,57 +579,57 @@ function _map_eng2math_switch!(data_math::Dict{String,<:Any}, data_eng::Dict{Str
579579 _apply_linecode! (eng_obj, data_eng)
580580 end
581581
582- if ! (all (isapprox .(get (eng_obj, " rs" , zeros (1 , 1 )), 0 )) && all (isapprox .(get (eng_obj, " xs" , zeros (1 , 1 )), 0 )))
583- # build virtual bus
584-
585- f_bus = deepcopy (data_math[" bus" ][" $(math_obj[" f_bus" ]) " ])
586- t_bus = deepcopy (data_math[" bus" ][" $(math_obj[" t_bus" ]) " ])
587-
588- N = length (eng_obj[" t_connections" ])
589- bus_obj = Dict {String,Any} (
590- " name" => " _virtual_bus.switch.$name " ,
591- " bus_i" => length (data_math[" bus" ])+ 1 ,
592- " bus_type" => eng_obj[" status" ] == DISABLED ? 4 : 1 ,
593- " terminals" => eng_obj[" t_connections" ], # connected to the switch on the to-side
594- " grounded" => fill (false , N), # connected to the switch on the to-side
595- " vmin" => fill (0.0 , N),
596- " vmax" => fill (Inf , N),
597- " vm_pair_lb" => Tuple{Any,Any,Real}[],
598- " vm_pair_ub" => Tuple{Any,Any,Real}[],
599- " source_id" => " switch.$name " ,
600- " index" => length (data_math[" bus" ])+ 1 ,
601- )
602-
603- math_obj[" t_bus" ] = bus_obj[" bus_i" ]
604- data_math[" bus" ][" $(bus_obj[" index" ]) " ] = bus_obj
605-
606- branch_obj = _init_math_obj (" line" , name, eng_obj, length (data_math[" branch" ])+ 1 )
607-
608- _branch_obj = Dict {String,Any} (
609- " name" => " _virtual_branch.switch.$name " ,
610- " source_id" => " switch.$name " ,
611- " f_bus" => bus_obj[" bus_i" ],
612- " t_bus" => data_math[" bus_lookup" ][eng_obj[" t_bus" ]],
613- " f_connections" => eng_obj[" t_connections" ], # the virtual branch connects to the switch on the to-side
614- " t_connections" => eng_obj[" t_connections" ], # should be identical to the switch's to-side connections
615- " br_r" => _impedance_conversion (data_eng, eng_obj, " rs" ),
616- " br_x" => _impedance_conversion (data_eng, eng_obj, " xs" ),
617- " g_fr" => _admittance_conversion (data_eng, eng_obj, " g_fr" ),
618- " g_to" => _admittance_conversion (data_eng, eng_obj, " g_to" ),
619- " b_fr" => _admittance_conversion (data_eng, eng_obj, " b_fr" ),
620- " b_to" => _admittance_conversion (data_eng, eng_obj, " b_to" ),
621- " angmin" => fill (- 10.0 , nphases),
622- " angmax" => fill ( 10.0 , nphases),
623- " c_rating_a" => fill (Inf , nphases),
624- " br_status" => eng_obj[" status" ] == DISABLED ? 0 : 1 ,
625- )
626-
627- merge! (branch_obj, _branch_obj)
628-
629- data_math[" branch" ][" $(branch_obj[" index" ]) " ] = branch_obj
630-
631- map_to = [map_to, " bus.$(bus_obj[" index" ]) " , " branch.$(branch_obj[" index" ]) " ]
632- end
582+ # if !(all(isapprox.(get(eng_obj, "rs", zeros(1, 1)), 0)) && all(isapprox.(get(eng_obj, "xs", zeros(1, 1)), 0)))
583+ # # build virtual bus
584+
585+ # f_bus = deepcopy(data_math["bus"]["$(math_obj["f_bus"])"])
586+ # t_bus = deepcopy(data_math["bus"]["$(math_obj["t_bus"])"])
587+
588+ # N = length(eng_obj["t_connections"])
589+ # bus_obj = Dict{String,Any}(
590+ # "name" => "_virtual_bus.switch.$name",
591+ # "bus_i" => length(data_math["bus"])+1,
592+ # "bus_type" => eng_obj["status"] == DISABLED ? 4 : 1,
593+ # "terminals" => eng_obj["t_connections"], # connected to the switch on the to-side
594+ # "grounded" => fill(false, N), # connected to the switch on the to-side
595+ # "vmin" => fill(0.0, N),
596+ # "vmax" => fill(Inf, N),
597+ # "vm_pair_lb" => Tuple{Any,Any,Real}[],
598+ # "vm_pair_ub" => Tuple{Any,Any,Real}[],
599+ # "source_id" => "switch.$name",
600+ # "index" => length(data_math["bus"])+1,
601+ # )
602+
603+ # math_obj["t_bus"] = bus_obj["bus_i"]
604+ # data_math["bus"]["$(bus_obj["index"])"] = bus_obj
605+
606+ # branch_obj = _init_math_obj("line", name, eng_obj, length(data_math["branch"])+1)
607+
608+ # _branch_obj = Dict{String,Any}(
609+ # "name" => "_virtual_branch.switch.$name",
610+ # "source_id" => "switch.$name",
611+ # "f_bus" => bus_obj["bus_i"],
612+ # "t_bus" => data_math["bus_lookup"][eng_obj["t_bus"]],
613+ # "f_connections" => eng_obj["t_connections"], # the virtual branch connects to the switch on the to-side
614+ # "t_connections" => eng_obj["t_connections"], # should be identical to the switch's to-side connections
615+ # "br_r" => _impedance_conversion(data_eng, eng_obj, "rs"),
616+ # "br_x" => _impedance_conversion(data_eng, eng_obj, "xs"),
617+ # "g_fr" => _admittance_conversion(data_eng, eng_obj, "g_fr"),
618+ # "g_to" => _admittance_conversion(data_eng, eng_obj, "g_to"),
619+ # "b_fr" => _admittance_conversion(data_eng, eng_obj, "b_fr"),
620+ # "b_to" => _admittance_conversion(data_eng, eng_obj, "b_to"),
621+ # "angmin" => fill(-10.0, nphases),
622+ # "angmax" => fill( 10.0, nphases),
623+ # "c_rating_a" => fill(Inf, nphases),
624+ # "br_status" => eng_obj["status"] == DISABLED ? 0 : 1,
625+ # )
626+
627+ # merge!(branch_obj, _branch_obj)
628+
629+ # data_math["branch"]["$(branch_obj["index"])"] = branch_obj
630+
631+ # map_to = [map_to, "bus.$(bus_obj["index"])", "branch.$(branch_obj["index"])"]
632+ # end
633633
634634 data_math[" switch" ][" $(math_obj[" index" ]) " ] = math_obj
635635
0 commit comments