From 4c1142b9fa9a1861062203d1745d98dc14ddef5d Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Tue, 9 Jul 2024 15:37:34 -0700 Subject: [PATCH 1/3] add MTHVDC system --- src/library/psi_library.jl | 252 ++++++++++++++++++++++++++++++++++ src/system_descriptor_data.jl | 7 + 2 files changed, 259 insertions(+) diff --git a/src/library/psi_library.jl b/src/library/psi_library.jl index 213b637..8179c11 100644 --- a/src/library/psi_library.jl +++ b/src/library/psi_library.jl @@ -1545,3 +1545,255 @@ function build_HVDC_TWO_RTO_RTS_5Min_sys(; kwargs...) new_sys = _duplicate_system(main_sys_RT, deepcopy(main_sys_RT), true) return new_sys end + +function build_MTHVDC_two_RTS_DA_sys_noForecast(; kwargs...) + sys_rts = build_RTS_GMLC_DA_sys_noForecast(; kwargs...) + sys = _duplicate_system(sys_rts, deepcopy(sys_rts), false) + # Remove AC connection + ac_interconnection = first(PSY.get_components(PSY.MonitoredLine, sys)) + PSY.remove_component!(sys, ac_interconnection) + + ### Add DC Buses ### + # 7T DC Buses + T7_numbers_150kV = [701, 702, 703] + T7_numbers_300kV = [704, 705, 706, 707] + for number in T7_numbers_150kV + dcbus = PSY.DCBus(; + number = number, + name = string(number), + magnitude = 1.0, + voltage_limits = (min = 0.9, max = 1.1), + base_voltage = 150.0, + ) + PSY.add_component!(sys, dcbus) + end + for number in T7_numbers_300kV + dcbus = PSY.DCBus(; + number = number, + name = string(number), + magnitude = 1.0, + voltage_limits = (min = 0.9, max = 1.1), + base_voltage = 300.0, + ) + PSY.add_component!(sys, dcbus) + end + + T9_numbers_300kV = 901:1:909 + for number in T9_numbers_300kV + dcbus = PSY.DCBus(; + number = number, + name = string(number), + magnitude = 1.0, + voltage_limits = (min = 0.9, max = 1.1), + base_voltage = 300.0, + ) + PSY.add_component!(sys, dcbus) + end + + ### Add DC Lines ### + #7T Lines + T7_bus_arcs = [ + ("701", "703"), + ("702", "703"), + ("704", "705"), + ("704", "706"), + ("704", "707"), + ("705", "707"), + ("706", "707"), + ] + T7_r = [0.0352, 0.0352, 0.1242, 0.1242, 0.1242, 0.1242, 0.0248] + limit = 1.0 # All lines have a maximum flow of 100 MW + + for (ix, bus_tuple) in enumerate(T7_bus_arcs) + bus_from = bus_tuple[1] + bus_to = bus_tuple[2] + dcline = PSY.TModelHVDCLine(; + name = "$(bus_from)_$(bus_to)", + available = true, + active_power_flow = 0.0, + arc = PSY.Arc( + PSY.get_component(PSY.DCBus, sys, bus_from), + PSY.get_component(PSY.DCBus, sys, bus_to), + ), + r = T7_r[ix], + l = 0.0, + c = 0.0, + active_power_limits_from = (min = 0.0, max = limit), + active_power_limits_to = (min = 0.0, max = limit), + ) + PSY.add_component!(sys, dcline) + end + + #9T Lines + T9_bus_arcs = [ + ("901", "903"), + ("901", "904"), + ("902", "903"), + ("902", "906"), + ("902", "909"), + ("903", "905"), + ("904", "905"), + ("904", "907"), + ("905", "907"), + ("906", "907"), + ("906", "908"), + ("908", "909"), + ] + + T9_r = [ + 0.0352, + 0.0828, + 0.0352, + 0.0828, + 0.0828, + 0.1656, + 0.1242, + 0.1242, + 0.1242, + 0.0248, + 0.0828, + 0.0828, + ] + + for (ix, bus_tuple) in enumerate(T9_bus_arcs) + bus_from = bus_tuple[1] + bus_to = bus_tuple[2] + dcline = PSY.TModelHVDCLine(; + name = "$(bus_from)_$(bus_to)", + available = true, + active_power_flow = 0.0, + arc = PSY.Arc( + PSY.get_component(PSY.DCBus, sys, bus_from), + PSY.get_component(PSY.DCBus, sys, bus_to), + ), + r = T9_r[ix], + l = 0.0, + c = 0.0, + active_power_limits_from = (min = 0.0, max = limit), + active_power_limits_to = (min = 0.0, max = limit), + ) + PSY.add_component!(sys, dcline) + end + + ### Add IPCs ### + + # Base Data # + S_base = 100 # MVA + V_base = [150, 150, 150, 300, 300, 300, 300] # kV + Z_base = V_base .^ 2 / S_base + + # Converter Loss Data + a_pu = [1.103, 1.103, 2.206, 1.103, 2.206, 1.103, 2.206] / S_base + b_pu = [0.887, 0.887, 0.887, 1.8, 1.8, 1.8, 1.8] ./ V_base + c_pu = + 0.5 * [ + 2.885 + 4.371, + 2.885 + 4.371, + 1.442 + 2.185, + 5.94 + 9.0, + 11.88 + 18.0, + 5.94 + 9.0, + 11.88 + 18.0, + ] ./ Z_base + + # P Limit in pu + P_limit_7T = [1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 1.0] + + # Same data for all converters in 9T: Equal to the DC6 converter + a_pu_9T = a_pu[6] + b_pu_9T = b_pu[6] + c_pu_9T = c_pu[6] + P_limit_9T = 2.0 + + # There are 16 IPCs to connect + # For 7T we will use: + # 701 with 107 + # 702 with 10204 (Twin) + # 703 with 10301 (Twin) + # 704 with 113 + # 705 with 123 + # 706 with 10215 (Twin) + # 707 with 10217 (Twin) + + # For 9T we will use: + # 901 with 107 + # 902 with 10204 (Twin) + # 903 with 10301 (Twin) + # 904 with 104 + # 905 with 118 + # 906 with 10215 (Twin) + # 907 with 10217 (Twin) + # 908 with 10219 (Twin) + # 909 with 10206 (Twin) + + function get_bus_by_number(sys, number) + return first(PSY.get_components(x -> x.number == number, PSY.Bus, sys)) + end + + # For 7T system + bus_arcs_7T = [ + (701, 107), + (702, 10204), + (703, 10301), + (704, 113), + (705, 123), + (706, 10215), + (707, 10217), + ] + + bus_arcs_9T = [ + (901, 107), + (902, 10204), + (903, 10301), + (904, 104), + (905, 118), + (906, 10215), + (907, 10217), + (908, 10219), + (909, 10206), + ] + + for (ix, bus_tuple) in enumerate(bus_arcs_7T) + dcbus = get_bus_by_number(sys, bus_tuple[1]) + acbus = get_bus_by_number(sys, bus_tuple[2]) + ipc = PSY.InterconnectingConverter(; + name = "$(bus_tuple[2])_$(bus_tuple[1])", + available = true, + bus = acbus, + dc_bus = dcbus, + active_power = 0.0, + rating = 1.0, + active_power_limits = (min = 0.0, max = 1.0), + base_power = P_limit_7T[ix], + loss_function = PSY.QuadraticCurve( + c_pu[ix], + b_pu[ix], + a_pu[ix], + ), + ) + PSY.add_component!(sys, ipc) + end + + for bus_tuple in bus_arcs_9T + dcbus = get_bus_by_number(sys, bus_tuple[1]) + acbus = get_bus_by_number(sys, bus_tuple[2]) + ipc = PSY.InterconnectingConverter(; + name = "$(bus_tuple[2])_$(bus_tuple[1])", + available = true, + bus = acbus, + dc_bus = dcbus, + active_power = 0.0, + rating = 1.0, + active_power_limits = (min = 0.0, max = 1.0), + base_power = P_limit_9T, + loss_function = PSY.QuadraticCurve( + c_pu_9T, + b_pu_9T, + a_pu_9T, + ), + ) + PSY.add_component!(sys, ipc) + end + + return sys +end diff --git a/src/system_descriptor_data.jl b/src/system_descriptor_data.jl index 9cffb3f..8e700d4 100644 --- a/src/system_descriptor_data.jl +++ b/src/system_descriptor_data.jl @@ -829,6 +829,13 @@ const SYSTEM_CATALOG = [ raw_data = RTS_DIR, build_function = build_HVDC_TWO_RTO_RTS_5Min_sys, ), + SystemDescriptor(; + name = "MTHVDC_two_RTS_DA_sys_noForecast", + description = "Two RTS systems connected by two multi-terminal HVDC systems", + category = PSISystems, + raw_data = RTS_DIR, + build_function = build_MTHVDC_two_RTS_DA_sys_noForecast, + ), SystemDescriptor(; name = "psse_ACTIVSg2000_sys", description = "PSSE ACTIVSg2000 Test system", From ec512d0909a38ee2d8ca8644d6342d9066d032f5 Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Wed, 10 Jul 2024 10:03:18 -0700 Subject: [PATCH 2/3] update code --- src/library/psi_library.jl | 196 ++----------------------------------- 1 file changed, 8 insertions(+), 188 deletions(-) diff --git a/src/library/psi_library.jl b/src/library/psi_library.jl index 8179c11..4061dfc 100644 --- a/src/library/psi_library.jl +++ b/src/library/psi_library.jl @@ -1549,210 +1549,30 @@ end function build_MTHVDC_two_RTS_DA_sys_noForecast(; kwargs...) sys_rts = build_RTS_GMLC_DA_sys_noForecast(; kwargs...) sys = _duplicate_system(sys_rts, deepcopy(sys_rts), false) + include(joinpath( + DATA_DIR, + "psy_data", + "data_mthvdc_twin_rts.jl", + )) # Remove AC connection ac_interconnection = first(PSY.get_components(PSY.MonitoredLine, sys)) PSY.remove_component!(sys, ac_interconnection) ### Add DC Buses ### - # 7T DC Buses - T7_numbers_150kV = [701, 702, 703] - T7_numbers_300kV = [704, 705, 706, 707] - for number in T7_numbers_150kV - dcbus = PSY.DCBus(; - number = number, - name = string(number), - magnitude = 1.0, - voltage_limits = (min = 0.9, max = 1.1), - base_voltage = 150.0, - ) - PSY.add_component!(sys, dcbus) - end - for number in T7_numbers_300kV - dcbus = PSY.DCBus(; - number = number, - name = string(number), - magnitude = 1.0, - voltage_limits = (min = 0.9, max = 1.1), - base_voltage = 300.0, - ) - PSY.add_component!(sys, dcbus) - end - - T9_numbers_300kV = 901:1:909 - for number in T9_numbers_300kV - dcbus = PSY.DCBus(; - number = number, - name = string(number), - magnitude = 1.0, - voltage_limits = (min = 0.9, max = 1.1), - base_voltage = 300.0, - ) + for dcbus in dcbuses PSY.add_component!(sys, dcbus) end ### Add DC Lines ### - #7T Lines - T7_bus_arcs = [ - ("701", "703"), - ("702", "703"), - ("704", "705"), - ("704", "706"), - ("704", "707"), - ("705", "707"), - ("706", "707"), - ] - T7_r = [0.0352, 0.0352, 0.1242, 0.1242, 0.1242, 0.1242, 0.0248] - limit = 1.0 # All lines have a maximum flow of 100 MW - - for (ix, bus_tuple) in enumerate(T7_bus_arcs) - bus_from = bus_tuple[1] - bus_to = bus_tuple[2] - dcline = PSY.TModelHVDCLine(; - name = "$(bus_from)_$(bus_to)", - available = true, - active_power_flow = 0.0, - arc = PSY.Arc( - PSY.get_component(PSY.DCBus, sys, bus_from), - PSY.get_component(PSY.DCBus, sys, bus_to), - ), - r = T7_r[ix], - l = 0.0, - c = 0.0, - active_power_limits_from = (min = 0.0, max = limit), - active_power_limits_to = (min = 0.0, max = limit), - ) - PSY.add_component!(sys, dcline) - end - - #9T Lines - T9_bus_arcs = [ - ("901", "903"), - ("901", "904"), - ("902", "903"), - ("902", "906"), - ("902", "909"), - ("903", "905"), - ("904", "905"), - ("904", "907"), - ("905", "907"), - ("906", "907"), - ("906", "908"), - ("908", "909"), - ] - - T9_r = [ - 0.0352, - 0.0828, - 0.0352, - 0.0828, - 0.0828, - 0.1656, - 0.1242, - 0.1242, - 0.1242, - 0.0248, - 0.0828, - 0.0828, - ] - - for (ix, bus_tuple) in enumerate(T9_bus_arcs) - bus_from = bus_tuple[1] - bus_to = bus_tuple[2] - dcline = PSY.TModelHVDCLine(; - name = "$(bus_from)_$(bus_to)", - available = true, - active_power_flow = 0.0, - arc = PSY.Arc( - PSY.get_component(PSY.DCBus, sys, bus_from), - PSY.get_component(PSY.DCBus, sys, bus_to), - ), - r = T9_r[ix], - l = 0.0, - c = 0.0, - active_power_limits_from = (min = 0.0, max = limit), - active_power_limits_to = (min = 0.0, max = limit), - ) + for dcline in dclines PSY.add_component!(sys, dcline) end ### Add IPCs ### - - # Base Data # - S_base = 100 # MVA - V_base = [150, 150, 150, 300, 300, 300, 300] # kV - Z_base = V_base .^ 2 / S_base - - # Converter Loss Data - a_pu = [1.103, 1.103, 2.206, 1.103, 2.206, 1.103, 2.206] / S_base - b_pu = [0.887, 0.887, 0.887, 1.8, 1.8, 1.8, 1.8] ./ V_base - c_pu = - 0.5 * [ - 2.885 + 4.371, - 2.885 + 4.371, - 1.442 + 2.185, - 5.94 + 9.0, - 11.88 + 18.0, - 5.94 + 9.0, - 11.88 + 18.0, - ] ./ Z_base - - # P Limit in pu - P_limit_7T = [1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 1.0] - - # Same data for all converters in 9T: Equal to the DC6 converter - a_pu_9T = a_pu[6] - b_pu_9T = b_pu[6] - c_pu_9T = c_pu[6] - P_limit_9T = 2.0 - - # There are 16 IPCs to connect - # For 7T we will use: - # 701 with 107 - # 702 with 10204 (Twin) - # 703 with 10301 (Twin) - # 704 with 113 - # 705 with 123 - # 706 with 10215 (Twin) - # 707 with 10217 (Twin) - - # For 9T we will use: - # 901 with 107 - # 902 with 10204 (Twin) - # 903 with 10301 (Twin) - # 904 with 104 - # 905 with 118 - # 906 with 10215 (Twin) - # 907 with 10217 (Twin) - # 908 with 10219 (Twin) - # 909 with 10206 (Twin) - function get_bus_by_number(sys, number) - return first(PSY.get_components(x -> x.number == number, PSY.Bus, sys)) + return first(get_components(x -> x.number == number, Bus, sys)) end - # For 7T system - bus_arcs_7T = [ - (701, 107), - (702, 10204), - (703, 10301), - (704, 113), - (705, 123), - (706, 10215), - (707, 10217), - ] - - bus_arcs_9T = [ - (901, 107), - (902, 10204), - (903, 10301), - (904, 104), - (905, 118), - (906, 10215), - (907, 10217), - (908, 10219), - (909, 10206), - ] - for (ix, bus_tuple) in enumerate(bus_arcs_7T) dcbus = get_bus_by_number(sys, bus_tuple[1]) acbus = get_bus_by_number(sys, bus_tuple[2]) From d460a085f2a1b28a5b7e33446fe08aea91d5dbf9 Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Wed, 10 Jul 2024 13:15:34 -0700 Subject: [PATCH 3/3] update artifact --- Artifacts.toml | 6 +++--- src/definitions.jl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Artifacts.toml b/Artifacts.toml index 000fe0c..9e97aa2 100644 --- a/Artifacts.toml +++ b/Artifacts.toml @@ -1,10 +1,10 @@ [CaseData] -git-tree-sha1 = "906591a156d0f786940f105e4f6aeceffefa7a2e" +git-tree-sha1 = "afb608473cf4d5eb22147856de1a1a651f36d40b" lazy = true [[CaseData.download]] - url = "https://github.com/NREL-Sienna/PowerSystemsTestData/archive/refs/tags/3.0.tar.gz" - sha256 = "6e8b16c62c8859d39a0d8eae65a20f8aa3da9a70b7e36d3dce690dcad1775437" + url = "https://github.com/NREL-Sienna/PowerSystemsTestData/archive/refs/tags/3.1.tar.gz" + sha256 = "4ac6ccd9dc9690b52ad6d0f46eeb759608e04ef8bc871732ff54bdbb0493dcea" [rts] git-tree-sha1 = "5098f357bad765bfefcff58f080818863ca776bd" diff --git a/src/definitions.jl b/src/definitions.jl index b0275ac..814e540 100644 --- a/src/definitions.jl +++ b/src/definitions.jl @@ -1,6 +1,6 @@ const PACKAGE_DIR = joinpath(dirname(dirname(pathof(PowerSystemCaseBuilder)))) const DATA_DIR = - joinpath(LazyArtifacts.artifact"CaseData", "PowerSystemsTestData-3.0") + joinpath(LazyArtifacts.artifact"CaseData", "PowerSystemsTestData-3.1") const RTS_DIR = joinpath(LazyArtifacts.artifact"rts", "RTS-GMLC-0.2.2")