NREL-Sienna / PowerFlows.jl

Collection of Power Flow solution methods based on PowerSystems.jl
https://nrel-sienna.github.io/PowerFlows.jl/stable/
BSD 3-Clause "New" or "Revised" License
16 stars 9 forks source link

`solve_ac_powerflow!` on a previously solved system can fail #47

Closed GabrielKS closed 2 months ago

GabrielKS commented 2 months ago

If solve_ac_powerflow! is called on a system and succeeds, we would expect that calling solve_ac_powerflow! a second time on that solved system would succeed and, ideally, produce the same answer. The system produced by

function create_system()
    sys = with_logger(() -> build_system(PSISystems, "RTS_GMLC_DA_sys"), SimpleLogger(Error))  # suppress logging
    remove_component!(sys, only(get_components(TwoTerminalHVDCLine, sys)))  # HVDC power flow not implemented yet
    sys_mod = deepcopy(sys)
    # Modify some things so reactive power redistribution succeeds
    for (component_type, component_name, new_limits) in [
        (RenewableDispatch, "113_PV_1",    (min = -30.0, max =  30.0))
        (ThermalStandard,   "115_STEAM_3", (min = -50.0, max = 100.0))
        (ThermalStandard,   "207_CT_1",    (min = -70.0, max =  70.0))
        (RenewableDispatch, "215_PV_1",    (min = -40.0, max =  40.0))
        (ThermalStandard,   "307_CT_1",    (min = -70.0, max =  70.0))
        (ThermalStandard,   "315_CT_8",    (min =   0.0, max =  80.0))
    ]
        set_reactive_power_limits!(get_component(component_type, sys, component_name), new_limits)
    end
    return sys
end

succeeds the first time around, if you define

PowerSystems.get_reactive_power_limits(::RenewableNonDispatch) = (min = 0.0, max = 0.0)

as a quick fix for https://github.com/NREL-Sienna/PowerFlows.jl/issues/39, but the second time there is an error:

Screenshot 2024-08-13 at 3 04 43 PM
rodrigomha commented 2 months ago

The problem is that in the RTS system, the Sync Condenser units have base_power = 0.0.

Here is a fix:

sync_cond_names = ["214_SYNC_COND_1", "314_SYNC_COND_1", "114_SYNC_COND_1"]
for name in sync_cond_names
        g = get_component(StaticInjection, sys, name)
        set_base_power!(g, 100.0)
 end