Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jd/radial branch reduction #1033

Merged
merged 82 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
54d707f
add radial_lines to network models
jd-lara Dec 28, 2023
df8f361
add radial branches to model
jd-lara Dec 28, 2023
fdba9ba
add bus maps
jd-lara Dec 29, 2023
040b150
add missing sort! call
jd-lara Jan 2, 2024
b8f9629
updates to network model
jd-lara Jan 2, 2024
2deda19
updates to the container
jd-lara Jan 2, 2024
d18aaea
updates to branch modeling
jd-lara Jan 2, 2024
c393f81
remove debugging assertion
jd-lara Jan 2, 2024
c8845f1
fix tests
jd-lara Jan 3, 2024
4d2c34c
fix bug with serialize function
jd-lara Jan 3, 2024
fbcd7da
bump power models
jd-lara Jan 3, 2024
51260df
remove assertion for multiconductor
jd-lara Jan 3, 2024
21b0ae4
update branch constructors to ignore radial branches
rodrigomha Jan 3, 2024
8154c9a
update slack expressions
rodrigomha Jan 3, 2024
d1dd6b1
add radial test
rodrigomha Jan 3, 2024
492aee9
Update LICENSE
jd-lara Jan 4, 2024
b77ecc5
add nothing check
jd-lara Jan 5, 2024
c927047
add assert
jd-lara Jan 5, 2024
954a916
use summary
jd-lara Jan 5, 2024
8e960bd
use power limits
jd-lara Jan 5, 2024
37d05db
fix function
jd-lara Jan 5, 2024
cfef00b
Update src/devices_models/devices/thermal_generation.jl
jd-lara Jan 5, 2024
bf24077
add new test
jd-lara Jan 8, 2024
f5e52bd
update testing
jd-lara Jan 8, 2024
a8be7cf
Merge pull request #1036 from NREL-Sienna/jd/ntp_debug
jd-lara Jan 8, 2024
a3af6b3
change internal
jd-lara Jan 10, 2024
86e3fc8
device_hvdc and network_const updates
Jan 10, 2024
b8cac7f
parametrize internal
jd-lara Jan 10, 2024
6976b14
separate outer constructor
jd-lara Jan 10, 2024
7833677
removing HydroPowerSimulations from Project.toml
lpstreitmatter Jan 10, 2024
4826380
Merge pull request #1041 from NREL-Sienna/ls/power_models_test_updates
rodrigomha Jan 10, 2024
32c7e03
abstract container
jd-lara Jan 10, 2024
8ac313f
use getter function
jd-lara Jan 10, 2024
4fa2a15
Merge pull request #1042 from NREL-Sienna/jd/multicontainer
jd-lara Jan 11, 2024
82b8115
Update Project.toml
jd-lara Jan 11, 2024
4f50cc8
bump PNM version
jd-lara Jan 11, 2024
2c4d558
Merge pull request #1034 from NREL-Sienna/jd/bump_power_models
jd-lara Jan 11, 2024
c1972c8
Update Project.toml
jd-lara Jan 11, 2024
b50e02c
bump PNM dependency
jd-lara Jan 11, 2024
5aefd0a
add radial_lines to network models
jd-lara Dec 28, 2023
1ee92de
add radial branches to model
jd-lara Dec 28, 2023
2cb0c36
add bus maps
jd-lara Dec 29, 2023
869042f
add missing sort! call
jd-lara Jan 2, 2024
72ae721
updates to network model
jd-lara Jan 2, 2024
4e9d046
updates to the container
jd-lara Jan 2, 2024
b3d7511
updates to branch modeling
jd-lara Jan 2, 2024
8e1a85c
remove debugging assertion
jd-lara Jan 2, 2024
e1aab9e
fix tests
jd-lara Jan 3, 2024
55704f1
fix bug with serialize function
jd-lara Jan 3, 2024
67cf974
update branch constructors to ignore radial branches
rodrigomha Jan 3, 2024
b9195ea
update slack expressions
rodrigomha Jan 3, 2024
1901f14
add radial test
rodrigomha Jan 3, 2024
46122d5
add new test
jd-lara Jan 8, 2024
f2a2a88
update testing
jd-lara Jan 8, 2024
6ea9724
bump PNM version
jd-lara Jan 11, 2024
ed843d5
Merge branch 'jd/radial_branch_reduction' of https://github.com/NREL-…
jd-lara Jan 11, 2024
5983103
bump ts version
jd-lara Jan 11, 2024
74a643c
formatter and test fixes
jd-lara Jan 15, 2024
d00ad50
update te testing code
jd-lara Jan 15, 2024
32b40cb
rename PNM object
jd-lara Jan 15, 2024
f0a7c76
replace radial_branches to radial_network_reduction
jd-lara Jan 15, 2024
2f6b9f0
replace field names
jd-lara Jan 15, 2024
82865ab
field name change
jd-lara Jan 15, 2024
a5764c3
more name replace
jd-lara Jan 15, 2024
0770442
implement name changes
jd-lara Jan 15, 2024
f856011
fix usage of dot access
jd-lara Jan 15, 2024
5a5e9b8
fix incompatible models
jd-lara Jan 15, 2024
4a5a05e
fix typo
jd-lara Jan 15, 2024
035ef78
use radial network reduction in slacks specs
jd-lara Jan 15, 2024
2ab1dd4
remove code duplication
jd-lara Jan 15, 2024
c9a7b5a
formatter run
jd-lara Jan 15, 2024
3bb6e78
fix eliminated variable
jd-lara Jan 15, 2024
4c1ccbd
variable rename
jd-lara Jan 15, 2024
c92e073
add missing docstring entry
jd-lara Jan 16, 2024
c046be7
fix deleted line
jd-lara Jan 16, 2024
db9e04c
rename field
jd-lara Jan 18, 2024
c6539e3
use bus
jd-lara Jan 19, 2024
d2ba948
fix network instantiation
jd-lara Jan 22, 2024
e356d1e
limit PNM version
jd-lara Jan 22, 2024
9f1c16d
fix typo
jd-lara Jan 22, 2024
782e017
add comment on sorting
jd-lara Jan 22, 2024
f93f740
Update src/core/optimization_container.jl
jd-lara Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 234 additions & 0 deletions test/test_radial_branches.jl
jd-lara marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
function _updated_5bus_sys_with_extensions()
sys = PSB.build_system(PSITestSystems, "c_sys5_uc")
new_sys = deepcopy(sys)
################################
#### Create Extension Buses ####
################################

busC = get_component(ACBus, new_sys, "nodeC")

busC_ext1 = ACBus(;
number = 301,
name = "nodeC_ext1",
bustype = ACBusTypes.PQ,
angle = 0.0,
magnitude = 1.0,
voltage_limits = (min = 0.9, max = 1.05),
base_voltage = 230.0,
area = nothing,
load_zone = nothing,
)

busC_ext2 = ACBus(;
number = 302,
name = "nodeC_ext2",
bustype = ACBusTypes.PQ,
angle = 0.0,
magnitude = 1.0,
voltage_limits = (min = 0.9, max = 1.05),
base_voltage = 230.0,
area = nothing,
load_zone = nothing,
)

add_components!(new_sys, [busC_ext1, busC_ext2])

################################
#### Create Extension Lines ####
################################

line_C_to_ext1 = Line(;
name = "C_to_ext1",
available = true,
active_power_flow = 0.0,
reactive_power_flow = 0.0,
arc = Arc(; from = busC, to = busC_ext1),
#r = 0.00281,
r = 0.0,
x = 0.0281,
b = (from = 0.00356, to = 0.00356),
rate = 2.0,
angle_limits = (min = -0.7, max = 0.7),
)

line_ext1_to_ext2 = Line(;
name = "ext1_to_ext2",
available = true,
active_power_flow = 0.0,
reactive_power_flow = 0.0,
arc = Arc(; from = busC_ext1, to = busC_ext2),
#r = 0.00281,
r = 0.0,
x = 0.0281,
b = (from = 0.00356, to = 0.00356),
rate = 2.0,
angle_limits = (min = -0.7, max = 0.7),
)

add_components!(new_sys, [line_C_to_ext1, line_ext1_to_ext2])

###################################
###### Update Extension Loads #####
###################################

load_bus3 = get_component(PowerLoad, new_sys, "Bus3")

load_ext1 = PowerLoad(;
name = "Bus_ext1",
available = true,
bus = busC_ext1,
active_power = 1.0,
reactive_power = 0.9861 / 3,
base_power = 100.0,
max_active_power = 1.0,
max_reactive_power = 0.9861 / 3,
)

load_ext2 = PowerLoad(;
name = "Bus_ext2",
available = true,
bus = busC_ext2,
active_power = 1.0,
reactive_power = 0.9861 / 3,
base_power = 100.0,
max_active_power = 1.0,
max_reactive_power = 0.9861 / 3,
)

add_components!(new_sys, [load_ext1, load_ext2])

copy_time_series!(load_ext1, load_bus3)
copy_time_series!(load_ext2, load_bus3)

set_active_power!(load_bus3, 1.0)
set_max_active_power!(load_bus3, 1.0)
set_reactive_power!(load_bus3, 0.3287)
set_max_reactive_power!(load_bus3, 0.3287)
return new_sys
end

@testset "StandardPTDF Radial Branches Test" begin
new_sys = _updated_5bus_sys_with_extensions()

net_model = StandardPTDFModel

template_uc = template_unit_commitment(;
network = NetworkModel(net_model;
reduce_radial_branches = true,
use_slacks = false,
),
)
thermal_model = ThermalStandardUnitCommitment
set_device_model!(template_uc, ThermalStandard, thermal_model)

##### Solve Reduced Model ####
solver = GLPK_optimizer
uc_model_red = DecisionModel(
template_uc,
new_sys;
optimizer = solver,
name = "UC_RED",
store_variable_names = true,
)

@test build!(uc_model_red; output_dir = mktempdir(; cleanup = true)) ==
PSI.BuildStatus.BUILT
solve!(uc_model_red)

res_red = ProblemResults(uc_model_red)

flow_lines = read_variable(res_red, "FlowActivePowerVariable__Line")
line_names = DataFrames.names(flow_lines)[2:end]

##### Solve Original Model ####
template_uc_orig = template_unit_commitment(;
network = NetworkModel(net_model;
reduce_radial_branches = false,
use_slacks = false,
),
)
set_device_model!(template_uc_orig, ThermalStandard, thermal_model)

uc_model_orig = DecisionModel(
template_uc_orig,
new_sys;
optimizer = solver,
name = "UC_ORIG",
store_variable_names = true,
)

@test build!(uc_model_orig; output_dir = mktempdir(; cleanup = true)) ==
PSI.BuildStatus.BUILT
solve!(uc_model_orig)

res_orig = ProblemResults(uc_model_orig)

flow_lines_orig = read_variable(res_orig, "FlowActivePowerVariable__Line")

for line in line_names
@test isapprox(flow_lines[!, line], flow_lines_orig[!, line])
end
end

@testset "DCPPowerModel Radial Branches Test" begin
new_sys = _updated_5bus_sys_with_extensions()

net_model = DCPPowerModel

template_uc = template_unit_commitment(;
network = NetworkModel(net_model;
reduce_radial_branches = true,
use_slacks = false,
),
)
thermal_model = ThermalStandardUnitCommitment
set_device_model!(template_uc, ThermalStandard, thermal_model)

##### Solve Reduced Model ####
solver = GLPK_optimizer
uc_model_red = DecisionModel(
template_uc,
new_sys;
optimizer = solver,
name = "UC_RED",
store_variable_names = true,
)

@test build!(uc_model_red; output_dir = mktempdir(; cleanup = true)) ==
PSI.BuildStatus.BUILT
solve!(uc_model_red)

res_red = ProblemResults(uc_model_red)

flow_lines = read_variable(res_red, "FlowActivePowerVariable__Line")
line_names = DataFrames.names(flow_lines)[2:end]

##### Solve Original Model ####
template_uc_orig = template_unit_commitment(;
network = NetworkModel(net_model;
reduce_radial_branches = false,
use_slacks = false,
),
)
set_device_model!(template_uc_orig, ThermalStandard, thermal_model)

uc_model_orig = DecisionModel(
template_uc_orig,
new_sys;
optimizer = solver,
name = "UC_ORIG",
store_variable_names = true,
)

@test build!(uc_model_orig; output_dir = mktempdir(; cleanup = true)) ==
PSI.BuildStatus.BUILT
solve!(uc_model_orig)

res_orig = ProblemResults(uc_model_orig)

flow_lines_orig = read_variable(res_orig, "FlowActivePowerVariable__Line")

for line in line_names
@test isapprox(flow_lines[!, line], flow_lines_orig[!, line])
end
end
Loading