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

Fix Bugs/Issues of PowerFlow #45

Merged
merged 8 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
9 changes: 3 additions & 6 deletions test/test_dc_powerflow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
# CASE 1: ABA and BA matrices
solved_data_ABA = solve_powerflow(DCPowerFlow(), sys)
@test isapprox(
solved_data_ABA["1"]["flow_results"].P_from_to +
solved_data_ABA["1"]["flow_results"].P_to_from,
solved_data_ABA["1"]["flow_results"].P_from_to,
rodrigomha marked this conversation as resolved.
Show resolved Hide resolved
ref_flow_values,
atol = 1e-6,
)
Expand All @@ -38,8 +37,7 @@
# CASE 2: PTDF and ABA MATRICES
solved_data_PTDF = solve_powerflow(PTDFDCPowerFlow(), sys)
@test isapprox(
solved_data_PTDF["1"]["flow_results"].P_from_to +
solved_data_PTDF["1"]["flow_results"].P_to_from,
solved_data_PTDF["1"]["flow_results"].P_from_to,
ref_flow_values,
atol = 1e-6,
)
Expand All @@ -48,8 +46,7 @@
# CASE 3: VirtualPTDF and ABA MATRICES
solved_data_vPTDF = solve_powerflow(vPTDFDCPowerFlow(), sys)
@test isapprox(
solved_data_vPTDF["1"]["flow_results"].P_from_to +
solved_data_vPTDF["1"]["flow_results"].P_to_from,
solved_data_vPTDF["1"]["flow_results"].P_from_to,
ref_flow_values,
atol = 1e-6,
)
Expand Down
12 changes: 3 additions & 9 deletions test/test_multiperiod_dc_powerflow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,19 @@

# case 1
for i in 1:length(data_1.timestep_map)
flow_from_to = results_1[data_1.timestep_map[i]]["flow_results"].P_from_to
flow_to_from = results_1[data_1.timestep_map[i]]["flow_results"].P_to_from
net_flow = flow_from_to + flow_to_from
net_flow = results_1[data_1.timestep_map[i]]["flow_results"].P_from_to
@test isapprox(net_flow, flows[:, i], atol = 1e-5)
end

# case 2
for i in 1:length(data_1.timestep_map)
flow_from_to = results_1[data_2.timestep_map[i]]["flow_results"].P_from_to
flow_to_from = results_1[data_2.timestep_map[i]]["flow_results"].P_to_from
net_flow = flow_from_to + flow_to_from
net_flow = results_1[data_2.timestep_map[i]]["flow_results"].P_from_to
@test isapprox(net_flow, flows[:, i], atol = 1e-5)
end

# case 3
for i in 1:length(data_1.timestep_map)
flow_from_to = results_1[data_3.timestep_map[i]]["flow_results"].P_from_to
flow_to_from = results_1[data_3.timestep_map[i]]["flow_results"].P_to_from
net_flow = flow_from_to + flow_to_from
net_flow = results_1[data_3.timestep_map[i]]["flow_results"].P_from_to
@test isapprox(net_flow, flows[:, i], atol = 1e-5)
end
end
Loading