Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Bolgaryn committed Jan 9, 2025
1 parent 11d86a1 commit 2214214
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/newton_ac_powerflow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ solve_ac_powerflow!(sys, method=:newton)
function solve_powerflow!(
pf::ACPowerFlow{<:ACPowerFlowSolverType},
system::PSY.System;
kwargs...
kwargs...,
)
#Save per-unit flag
settings_unit_cache = deepcopy(system.units_settings.unit_system)
Expand All @@ -45,7 +45,7 @@ function solve_powerflow!(
system;
check_connectivity = get(kwargs, :check_connectivity, true),
)

converged, x = _ac_powereflow(data, pf, system; kwargs...)

if converged
Expand Down Expand Up @@ -76,7 +76,7 @@ res = solve_powerflow(sys, method=:newton)
function solve_powerflow(
pf::ACPowerFlow{<:ACPowerFlowSolverType},
system::PSY.System;
kwargs...
kwargs...,
)
#Save per-unit flag
settings_unit_cache = deepcopy(system.units_settings.unit_system)
Expand All @@ -91,7 +91,7 @@ function solve_powerflow(
# @error(typeof(data))

converged, x = _ac_powereflow(data, pf, system; kwargs...)

if converged
@info("PowerFlow solve converged, the results are exported in DataFrames")
df_results = write_results(pf, system, data, x)
Expand All @@ -106,13 +106,12 @@ function solve_powerflow(
return df_results
end


function _ac_powereflow(
data::PowerFlowData,
pf::ACPowerFlow{<:ACPowerFlowSolverType},
system::PSY.System;
kwargs...
)
kwargs...,
)
check_reactive_power_limits = get(kwargs, :check_reactive_power_limits, false)

for _ in 1:MAX_REACTIVE_POWER_ITERATIONS
Expand Down Expand Up @@ -159,7 +158,6 @@ function _solve_powerflow!(
check_reactive_power_limits;
nlsolve_kwargs...,
)

for _ in 1:MAX_REACTIVE_POWER_ITERATIONS
converged, x = _newton_powerflow(pf, data; nlsolve_kwargs...)
if !converged || !check_reactive_power_limits || _check_q_limit_bounds!(data, x)
Expand Down

0 comments on commit 2214214

Please sign in to comment.