Skip to content

Update compat to PowerFlows.jl v0.9.0 #400

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

Merged
merged 11 commits into from
Jul 8, 2025
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ ForwardDiff = "~v0.10"
InfrastructureSystems = "2"
NLsolve = "4"
PowerSystems = "4"
PowerFlows = "^0.7"
PowerNetworkMatrices = "^0.11"
PowerFlows = "^0.9"
PowerNetworkMatrices = "^0.12.1"
PrettyTables = "1, 2"
SciMLBase = "2"
TimerOutputs = "~0.5"
Expand Down
6 changes: 4 additions & 2 deletions docs/src/tutorials/tutorial_continuation_pf.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ for p in P_range
q_power = power * tan(acos(load_pf))
set_reactive_power!(load, q_power)
# Run Power Flow
status = solve_ac_powerflow!(sys_static)
pf = ACPowerFlow()
status = solve_powerflow!(pf, sys_static)
if !status
# Finish the loop if the power flow fails
print("Power Flow failed at p = $(power)")
Expand Down Expand Up @@ -143,7 +144,8 @@ for p in P_range
q_power = power * tan(acos(load_pf))
set_reactive_power!(load, q_power)
# Run Power Flow
status = solve_ac_powerflow!(sys_static)
pf = ACPowerFlow()
status = solve_powerflow!(pf, sys_static)
if !status
# Finish the loop if the power flow fails
print("Power Flow failed at p = $(power)")
Expand Down
1 change: 1 addition & 0 deletions src/base/nlsolve_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ function _check_residual(
Generator = $gen_name, state = $state.
Residual error is too large to continue")
else
bus_count = get_bus_count(inputs)
bus_no = ix > bus_count ? ix - bus_count : ix
component = ix > bus_count ? "imag" : "real"
error("The initial residual in the state located at $ix has a value of $val.
Expand Down
3 changes: 2 additions & 1 deletion src/base/simulation_initialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ function power_flow_solution!(
sys::PSY.System,
inputs::SimulationInputs,
)
res = PF.solve_ac_powerflow!(sys)
pf = PF.ACPowerFlow{PF.TrustRegionACPowerFlow}()
res = PF.solve_powerflow!(pf, sys)
if !res
@error("PowerFlow failed to solve")
return BUILD_FAILED
Expand Down
3 changes: 2 additions & 1 deletion test/test_case_5shaft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ The fault disconnects a circuit between buses 1 and 2, doubling its impedance.
##################################################

threebus_sys = build_system(PSIDTestSystems, "psid_test_threebus_5shaft")
solve_ac_powerflow!(threebus_sys)
pf = ACPowerFlow()
solve_powerflow!(pf, threebus_sys)
Ybus_fault = get_ybus_fault_threebus_sys(threebus_sys)

##################################################
Expand Down
3 changes: 2 additions & 1 deletion test/test_case_anderson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ and the generator located in bus 3.
##################################################

threebus_sys = build_system(PSIDTestSystems, "psid_test_threebus_anderson")
solve_ac_powerflow!(threebus_sys)
pf = ACPowerFlow()
solve_powerflow!(pf, threebus_sys)
Ybus_fault = get_ybus_fault_threebus_sys(threebus_sys)

##################################################
Expand Down
3 changes: 2 additions & 1 deletion test/test_case_marconato.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ and the generator located in bus 3.
##################################################

threebus_sys = build_system(PSIDTestSystems, "psid_test_threebus_marconato")
solve_ac_powerflow!(threebus_sys)
pf = ACPowerFlow()
solve_powerflow!(pf, threebus_sys)
Ybus_fault = get_ybus_fault_threebus_sys(threebus_sys)

##################################################
Expand Down
3 changes: 2 additions & 1 deletion test/test_case_oneDoneQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ and the generator located in bus 3.
##################################################

threebus_sys = build_system(PSIDTestSystems, "psid_test_threebus_oneDoneQ")
solve_ac_powerflow!(threebus_sys)
pf = ACPowerFlow()
solve_powerflow!(pf, threebus_sys)
Ybus_fault = get_ybus_fault_threebus_sys(threebus_sys)

##################################################
Expand Down
3 changes: 2 additions & 1 deletion test/test_case_simple_anderson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ and the generator located in bus 3.
##################################################

threebus_sys = build_system(PSIDTestSystems, "psid_test_threebus_simple_anderson")
solve_ac_powerflow!(threebus_sys)
pf = ACPowerFlow()
solve_powerflow!(pf, threebus_sys)
Ybus_fault = get_ybus_fault_threebus_sys(threebus_sys)

##################################################
Expand Down
3 changes: 2 additions & 1 deletion test/test_case_simple_marconato.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ and the generator located in bus 3.
##################################################

threebus_sys = build_system(PSIDTestSystems, "psid_test_threebus_simple_marconato")
solve_ac_powerflow!(threebus_sys)
pf = ACPowerFlow()
solve_powerflow!(pf, threebus_sys)
Ybus_fault = get_ybus_fault_threebus_sys(threebus_sys)

##################################################
Expand Down
Loading