NREL-Sienna/PowerSimulationsDynamics.jl

LoadChange Perturbation Not Changing System

ciaranrob opened this issue · 1 comments

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")

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