NREL-Sienna / PowerSimulationsDynamics.jl

Julia package to run Dynamic Power System simulations. Part of the Scalable Integrated Infrastructure Planning Initiative at the National Renewable Energy Lab.
https://nrel-sienna.github.io/PowerSimulationsDynamics.jl/stable/
BSD 3-Clause "New" or "Revised" License
175 stars 42 forks source link

Issues with AVR/PSS Initialization #386

Open m-bossart opened 3 months ago

m-bossart commented 3 months ago

I noticed an issue when using an AVRTypeII and PSSFixed model together. If the V_pss parameter is set as non-zero, the model fails to initialize. The issue is related to the AVR model using the reference with the addition of Vs: https://github.com/NREL-Sienna/PowerSimulationsDynamics.jl/blob/f4f0a8144ab57ac8ca024a468393e265c9825ff3/src/models/generator_models/avr_models.jl#L214 But Vs is not considered in the initialization (because the AVR initialization happens before the PSS). I'm not sure yet how this should be handled generically but I do think that the example below should not fail.

MWE:

using PowerSystems
using PowerSimulationsDynamics
using PowerSystemCaseBuilder
using OrdinaryDiffEq
using PowerSystemCaseBuilder

function transform_power_load_to_constant_impedance(x::PowerLoad)
    l = StandardLoad(
        name = get_name(x),
        available = get_available(x),
        bus = get_bus(x),
        base_power = get_base_power(x),
        constant_active_power = 0.0,
        constant_reactive_power = 0.0,
        impedance_active_power = get_active_power(x),
        impedance_reactive_power = get_reactive_power(x),
        current_active_power = 0.0,
        current_reactive_power = 0.0,
        max_constant_active_power = 0.0,
        max_constant_reactive_power = 0.0,
        max_impedance_active_power = get_max_active_power(x),
        max_impedance_reactive_power = get_max_reactive_power(x),
        max_current_active_power = 0.0,
        max_current_reactive_power = 0.0,
        services = get_services(x),
        dynamic_injector = get_dynamic_injector(x),
    )
    return l 
 end 

sys = build_system(PSIDTestSystems, "psid_test_ieee_9bus")
for l in get_components(PowerLoad, sys)
    l_new =  transform_power_load_to_constant_impedance(l)
    remove_component!(sys, l)
    add_component!(sys, l_new)
end
dyn_gen = get_component(DynamicGenerator, sys, "generator-3-1")
sim = Simulation!(MassMatrixModel, sys, pwd(), (0.0, 5.0))
execute!(sim, Rodas5())

pss_3 = get_pss(get_component(DynamicGenerator, sys, "generator-3-1"))
set_V_pss!(pss_3, 0.00001)                                      #Set V_pss non-zero
sim = Simulation!(MassMatrixModel, sys, pwd(), (0.0, 5.0))      #Simulation fails to build (initialize)