@@ -244,7 +244,7 @@ function _map_ravens2math_connectivity_node!(data_math::Dict{String,<:Any}, data
244244 # Set basic bus properties
245245 math_obj[" bus_i" ] = index
246246 math_obj[" source_id" ] = " ConnectivityNode.$name "
247- math_obj[" bus_type" ] = 1 # Default bus_type, will be modified as needed
247+ math_obj[" bus_type" ] = 4 # Default bus_type, - DISABLED
248248 math_obj[" vm_pair_lb" ] = Tuple{Any, Any, Real}[]
249249 math_obj[" vm_pair_ub" ] = Tuple{Any, Any, Real}[]
250250
@@ -529,9 +529,11 @@ function _map_ravens2math_conductor!(data_math::Dict{String,<:Any}, data_ravens:
529529 end
530530
531531 math_obj[" br_status" ] = get (ravens_obj, " Equipment.inService" , true ) == true ? 1 : 0
532- bus_data = data_math[" bus" ][string (math_obj[" t_bus" ])]
533- if (math_obj[" br_status" ] == 0 )
534- bus_data[" bus_type" ] = 4
532+ f_bus_data = data_math[" bus" ][string (math_obj[" f_bus" ])]
533+ t_bus_data = data_math[" bus" ][string (math_obj[" t_bus" ])]
534+ if (math_obj[" br_status" ] == 1 )
535+ f_bus_data[" bus_type" ] = 1
536+ t_bus_data[" bus_type" ] = 1
535537 end
536538
537539 data_math[" branch" ][" $(math_obj[" index" ]) " ] = math_obj
@@ -1391,9 +1393,7 @@ function _map_ravens2math_energy_consumer!(data_math::Dict{String,<:Any}, data_r
13911393 end
13921394
13931395 # Set bus type to PQ bus
1394- if (math_obj[" status" ] == 0 )
1395- bus_conn[" bus_type" ] = 4
1396- else
1396+ if (math_obj[" status" ] == 1 )
13971397 bus_conn[" bus_type" ] = 1
13981398 end
13991399
@@ -1460,9 +1460,7 @@ function _map_ravens2math_energy_source!(data_math::Dict{String,<:Any}, data_rav
14601460 math_obj[" gen_status" ] = haskey (ravens_obj, " Equipment.inService" ) ? ravens_obj[" Equipment.inService" ] : true
14611461 math_obj[" gen_status" ] = math_obj[" gen_status" ] == true ? 1 : 0
14621462
1463- if (math_obj[" gen_status" ] == 0 )
1464- bus_conn[" bus_type" ] = 4
1465- else
1463+ if (math_obj[" gen_status" ] == 1 )
14661464 bus_conn[" bus_type" ] = 3
14671465 end
14681466
@@ -1504,10 +1502,10 @@ function _map_ravens2math_energy_source!(data_math::Dict{String,<:Any}, data_rav
15041502 map_to = " gen.$(math_obj[" index" ]) "
15051503 if ! all (isapprox .(rs, 0 )) && ! all (isapprox .(xs, 0 ))
15061504
1507- if (math_obj[" gen_status" ] == 0 )
1508- bus_conn[" bus_type" ] = 4
1505+ if (math_obj[" gen_status" ] == 1 )
1506+ bus_conn[" bus_type" ] = 1
15091507 else
1510- bus_conn[" bus_type" ] = 1 # Virtual bus becomes the new slack bus
1508+ bus_conn[" bus_type" ] = 4 # Virtual bus becomes the new slack bus
15111509 end
15121510
15131511 bus_obj = Dict (
@@ -1619,10 +1617,9 @@ function _map_ravens2math_rotating_machine!(data_math::Dict{String,<:Any}, data_
16191617 end
16201618
16211619 # Set bus type
1622- if (status == 0 )
1623- bus_type = 4
1624- else
1625- bus_type = data_math[" bus" ][" $(math_obj[" gen_bus" ]) " ][" bus_type" ]
1620+ bus_type = 4
1621+ if (status == 1 )
1622+ bus_type = 1
16261623 end
16271624
16281625 data_math[" bus" ][" $(math_obj[" gen_bus" ]) " ][" bus_type" ] = _compute_bus_type (bus_type, status, control_mode)
@@ -1728,10 +1725,9 @@ function _map_ravens2math_power_electronics!(data_math::Dict{String,<:Any}, data
17281725 math_obj[" control_mode" ] = control_mode = Int (get (ravens_obj, " control_mode" , FREQUENCYDROOP))
17291726
17301727 # Set bus type
1731- if (status == 0 )
1732- bus_type = 4
1733- else
1734- bus_type = data_math[" bus" ][" $(math_obj[" gen_bus" ]) " ][" bus_type" ]
1728+ bus_type = 4
1729+ if (status == 1 )
1730+ bus_type = 1
17351731 end
17361732
17371733 data_math[" bus" ][" $(math_obj[" gen_bus" ]) " ][" bus_type" ] = _compute_bus_type (bus_type, status, control_mode)
@@ -1899,10 +1895,9 @@ function _map_ravens2math_power_electronics!(data_math::Dict{String,<:Any}, data
18991895 math_obj[" qs" ] = (- get (ravens_obj, " PowerElectronicsConnection.q" , 0.0 )). / (power_scale_factor)
19001896
19011897 # Set bus type
1902- if (status == 0 )
1903- bus_type = 4
1904- else
1905- bus_type = data_math[" bus" ][" $(math_obj[" storage_bus" ]) " ][" bus_type" ]
1898+ bus_type = 4
1899+ if (status == 1 )
1900+ bus_type = 1
19061901 end
19071902
19081903 data_math[" bus" ][" $(math_obj[" storage_bus" ]) " ][" bus_type" ] = _compute_bus_type (bus_type, status, control_mode)
@@ -1981,9 +1976,12 @@ function _map_ravens2math_switch!(data_math::Dict{String,<:Any}, data_ravens::Di
19811976 # Status
19821977 status = get (ravens_obj, " Equipment.inService" , true )
19831978 math_obj[" status" ] = status == true ? 1 : 0
1984- bus_data = data_math[" bus" ][string (math_obj[" t_bus" ])]
1985- if (status == 0 )
1986- bus_data[" bus_type" ] = 4
1979+
1980+ f_bus_data = data_math[" bus" ][string (math_obj[" f_bus" ])]
1981+ t_bus_data = data_math[" bus" ][string (math_obj[" t_bus" ])]
1982+ if (math_obj[" status" ] == 1 )
1983+ f_bus_data[" bus_type" ] = 1
1984+ t_bus_data[" bus_type" ] = 1
19871985 end
19881986
19891987 # State
@@ -2062,9 +2060,8 @@ function _map_ravens2math_shunt_compensator!(data_math::Dict{String,<:Any}, data
20622060
20632061 bus_info = string (math_obj[" shunt_bus" ])
20642062 bus_conn = data_math[" bus" ][bus_info]
2065- if (math_obj[" status" ] == 0 )
2066- bus_conn[" bus_type" ] = 4
2067- else
2063+
2064+ if (math_obj[" status" ] == 1 )
20682065 bus_conn[" bus_type" ] = 1
20692066 end
20702067
0 commit comments