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
177 stars 42 forks source link

LoadChange Perturbation Not Changing System #258

Closed ciaranrob closed 2 years ago

ciaranrob commented 2 years ago

When trying to introduce a load step into the system, the perturbation doesn't appear to be affecting anything. The simulation runs without error but the results indicate that the perturbation wasn't applied.

Below is the code I ran using PSID v0.9.2

using PowerSimulationsDynamics using Sundials using Plots using PowerSystems const PSY = PowerSystems

include(joinpath(dirname(@FILE), "models/dynamic_test_data.jl"))

sys_dir = joinpath(dirname(@FILE), "models/ThreeBusMultiLoad.raw")

sys = System(sys_dir, runchecks = false) set_units_base_system!(sys, "DEVICE_BASE")

function dyn_gen_marconato_tg(generator) return PSY.DynamicGenerator( name = get_name(generator), ω_ref = 1.0, # ω_ref, machine = machine_marconato(), #machine shaft = shaft_no_damping(), #shaft avr = avr_type2(), #avr prime_mover = tg_type1(), #tg pss = pss_none(), ) end

for g in get_components(Generator, sys) case_gen = dyn_gen_marconato_tg(g) add_component!(sys, case_gen, g) end

l_device = get_component(ElectricLoad, sys, "load1031") l_change = LoadChange(1.0, l_device, :P_ref, 1.4) path = (joinpath(pwd(), "outputLog"))

sim = Simulation!(ResidualModel, sys, path, (0.0, 5.0), l_change, all_lines_dynamic = true)

execute!(sim, Sundials.IDA()) results = read_results(sim) apower = get_activepower_series(results, "generator-101-1") plot(apower, ylim=[0.79, 0.83], label="SG1 Active Power")

freq = get_state_series(results, ("generator-101-1", :ω)) plot(freq, ylim=[0.99, 1.01], label="SG1 Frequency")

jd-lara commented 2 years ago

This issue doesn't reproduce in the current master of PSID. It seems that it could be a versioning problem, I will close unless @ciaranrob detects the same problem again and re-opens