-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ce7cce
commit 3200883
Showing
6 changed files
with
334 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
0, 100.00, 33, 0, 0, 60.00 / PSS(R)E 33 RAW created by rawd33 TUE, JUL 21 2020 17:55 | ||
|
||
|
||
101,'BUS 1', 138.0000,3, 1, 1, 1,1.05000, 0.0000,1.10000,0.90000,1.10000,0.90000 | ||
102,'BUS 2', 138.0000,2, 1, 1, 1,1.02000, -0.9440,1.10000,0.90000,1.10000,0.90000 | ||
103,'BUS 3', 138.0000,1, 1, 1, 1,0.99341, -8.7697,1.10000,0.90000,1.10000,0.90000 | ||
0 /End of Bus data, Begin Load data | ||
103,'1 ',1, 1, 1, 250.000, 30.000, 0.000, 0.000, 0.000, 0.000, 1,1,0 | ||
0 /End of Load data, Begin Fixed shunt data | ||
0 /End of Fixed shunt data, Begin Generator data | ||
101,'1 ', 153.335, 73.271, 100.000, -100.000,1.05000, 0, 100.000, 0.00000E+0, 1.00000E-5, 0.00000E+0, 0.00000E+0,1.00000,1, 100.0, 318.000, 0.000, 1,1.0000 | ||
102,'1 ', 100.000, -3.247, 100.000, -100.000,1.02000, 0, 100.000, 0.00000E+0, 2.500E-1, 0.00000E+0, 0.00000E+0,1.00000,1, 100.0, 318.000, 0.000, 1,1.0000 | ||
0 /End of Generator data, Begin Branch data | ||
101, 102,'1 ', 1.00000E-2, 1.20000E-1, 0.00000, 250.00, 250.00, 250.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.00, 1,1.0000 | ||
101, 103,'1 ', 1.00000E-2, 1.20000E-1, 0.00000, 250.00, 250.00, 250.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.00, 1,1.0000 | ||
102, 103,'1 ', 1.00000E-2, 1.20000E-1, 0.00000, 250.00, 250.00, 250.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.00, 1,1.0000 | ||
0 /End of Branch data, Begin Transformer data | ||
0 /End of Transformer data, Begin Area interchange data | ||
0 /End of Area interchange data, Begin Two-terminal dc line data | ||
0 /End of Two-terminal dc line data, Begin VSC dc line data | ||
0 /End of VSC dc line data, Begin Impedance correction table data | ||
0 /End of Impedance correction table data, Begin Multi-terminal dc line data | ||
0 /End of Multi-terminal dc line data, Begin Multi-section line data | ||
0 /End of Multi-section line data, Begin Zone data | ||
0 /End of Zone data, Begin Inter-area transfer data | ||
0 /End of Inter-area transfer data, Begin Owner data | ||
0 /End of Owner data, Begin FACTS device data | ||
0 /End of FACTS device data, Begin Switched shunt data | ||
0 /End of Switched shunt data, Begin GNE device data | ||
0 /End of GNE device data, Begin Induction machine data | ||
0 /End of Induction machine data | ||
Q |
7 changes: 7 additions & 0 deletions
7
test/benchmarks/psse/DEGOV1/ThreeBus_DEGOV1_nodelay_flag0.dyr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
101 'GENCLS' 1 0 0 / | ||
102 'GENROU' 1 8.0000 0.30000E-01 0.40000 0.50000E-01 | ||
6.1750 0.50000E-01 1.8000 1.7000 0.30000 | ||
0.55000 0.25000 0.20000 0.10000 0.80000 / | ||
102 'DEGOV1' 1 0 0.19050 0.47600E-01 0.18000E-01 | ||
1.0000 5.1000 0.32200 0.0000 0.0000 | ||
99.99 -99.99 0.70000E-01 0.50000E-01 / |
7 changes: 7 additions & 0 deletions
7
test/benchmarks/psse/DEGOV1/ThreeBus_DEGOV1_nodelay_flag1.dyr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
101 'GENCLS' 1 0 0 / | ||
102 'GENROU' 1 8.0000 0.30000E-01 0.40000 0.50000E-01 | ||
6.1750 0.50000E-01 1.8000 1.7000 0.30000 | ||
0.55000 0.25000 0.20000 0.10000 0.80000 / | ||
102 'DEGOV1' 1 1 0.19050 0.47600E-01 0.18000E-01 | ||
1.0000 5.1000 0.32200 0.0000 0.0000 | ||
99.99 -99.99 0.70000E-01 0.50000E-01 / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
""" | ||
Validation PSSE/PIDGOV: | ||
This case study defines a three bus system with an infinite bus, GENROU+DEGOV1 and a load. | ||
The fault drop the line connecting the infinite bus and GENROU | ||
""" | ||
|
||
################################################## | ||
############### SOLVE PROBLEM #################### | ||
################################################## | ||
|
||
# Define dyr files | ||
|
||
names = ["DEGOV1 MechTorque Flag", "DEGOV1 ElecTorque Flag"] | ||
|
||
dyr_files = [ | ||
joinpath(TEST_FILES_DIR, "benchmarks/psse/DEGOV1/ThreeBus_DEGOV1_nodelay_flag0.dyr"), | ||
joinpath(TEST_FILES_DIR, "benchmarks/psse/DEGOV1/ThreeBus_DEGOV1_nodelay_flag1.dyr"), | ||
] | ||
|
||
csv_files = [ | ||
joinpath(TEST_FILES_DIR, "benchmarks/psse/DEGOV1/DEGOV1_results_nodelay_flag0.csv"), | ||
joinpath(TEST_FILES_DIR, "benchmarks/psse/DEGOV1/DEGOV1_results_nodelay_flag0.csv"), | ||
] | ||
|
||
init_conditions = [test63_x0_init_Flag0, test63_x0_init_Flag1] | ||
|
||
eigs_values = [test63_eigvals_Flag0, test63_eigvals_Flag1] | ||
|
||
raw_file_dir = joinpath(TEST_FILES_DIR, "benchmarks/psse/DEGOV1/ThreeBusMulti.raw") | ||
tspan = (0.0, 20.0) | ||
|
||
function test_degov1_implicit(dyr_file, csv_file, init_cond, eigs_value) | ||
path = (joinpath(pwd(), "test-psse-degov1")) | ||
!isdir(path) && mkdir(path) | ||
try | ||
sys = System(raw_file_dir, dyr_file) | ||
for l in get_components(PSY.StandardLoad, sys) | ||
transform_load_to_constant_impedance(l) | ||
end | ||
|
||
# Define Simulation Problem | ||
sim = Simulation!( | ||
ResidualModel, | ||
sys, #system | ||
path, | ||
tspan, #time span | ||
BranchTrip(1.0, Line, "BUS 1-BUS 2-i_1"), #Type of Fault | ||
) #Type of Fault | ||
|
||
# Test Initial Condition | ||
diff_val = [0.0] | ||
res = get_init_values_for_comparison(sim) | ||
for (k, v) in init_cond | ||
diff_val[1] += LinearAlgebra.norm(res[k] - v) | ||
end | ||
|
||
@test (diff_val[1] < 1e-3) | ||
|
||
# Obtain small signal results for initial conditions. Testing the simulation reset | ||
small_sig = small_signal_analysis(sim) | ||
eigs = small_sig.eigenvalues | ||
@test small_sig.stable | ||
|
||
# Test Eigenvalues | ||
@test LinearAlgebra.norm(eigs - eigs_value) < 1e-3 | ||
|
||
# Solve problem | ||
@test execute!(sim, IDA(); dtmax = 0.005, saveat = 0.005) == | ||
PSID.SIMULATION_FINALIZED | ||
results = read_results(sim) | ||
|
||
# Obtain data for voltage magnitude at bus 102 | ||
series = get_voltage_magnitude_series(results, 102) | ||
t = series[1] | ||
V = series[2] | ||
# Test Vf, τm and branch series flows with PSSE | ||
_, P101_103 = get_activepower_branch_flow(results, "BUS 1-BUS 3-i_1", :from) | ||
_, Q101_103 = get_reactivepower_branch_flow(results, "BUS 1-BUS 3-i_1", :from) | ||
_, P103_101 = get_activepower_branch_flow(results, "BUS 1-BUS 3-i_1", :to) | ||
_, Q103_101 = get_reactivepower_branch_flow(results, "BUS 1-BUS 3-i_1", :to) | ||
_, τm = get_mechanical_torque_series(results, "generator-102-1") | ||
|
||
# TODO: Get PSSE CSV files and enable tests | ||
#M = get_csv_data(csv_file) | ||
#t_psse = M[:, 1] | ||
#V_psse = M[:, 2] | ||
#P101_103_psse = M[:, 3] ./ 100.0 # convert to pu | ||
#Q101_103_psse = M[:, 4] ./ 100.0 # convert to pu | ||
#P103_101_psse = M[:, 5] ./ 100.0 # convert to pu | ||
#Q103_101_psse = M[:, 6] ./ 100.0 # convert to pu | ||
#Vf_psse = M[:, 7] | ||
#τm_psse = M[:, 8] | ||
|
||
# Test Transient Simulation Results | ||
#@test LinearAlgebra.norm(V - V_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(P101_103 - P101_103_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(Q101_103 - Q101_103_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(P103_101 - P103_101_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(Q103_101 - Q103_101_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(Vf - Vf_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(τm - τm_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(t - round.(t_psse, digits = 3)) == 0.0 | ||
finally | ||
@info("removing test files") | ||
rm(path; force = true, recursive = true) | ||
end | ||
end | ||
|
||
function test_degov1_mass_matrix(dyr_file, csv_file, init_cond, eigs_value) | ||
path = (joinpath(pwd(), "test-psse-degov1")) | ||
!isdir(path) && mkdir(path) | ||
try | ||
sys = System(raw_file_dir, dyr_file) | ||
for l in get_components(PSY.StandardLoad, sys) | ||
transform_load_to_constant_impedance(l) | ||
end | ||
|
||
# Define Simulation Problem | ||
sim = Simulation!( | ||
MassMatrixModel, | ||
sys, #system | ||
path, | ||
tspan, #time span | ||
BranchTrip(1.0, Line, "BUS 1-BUS 2-i_1"), #Type of Fault | ||
) #Type of Fault | ||
|
||
# Test Initial Condition | ||
diff_val = [0.0] | ||
res = get_init_values_for_comparison(sim) | ||
for (k, v) in init_cond | ||
diff_val[1] += LinearAlgebra.norm(res[k] - v) | ||
end | ||
|
||
@test (diff_val[1] < 1e-3) | ||
|
||
# Obtain small signal results for initial conditions. Testing the simulation reset | ||
small_sig = small_signal_analysis(sim) | ||
eigs = small_sig.eigenvalues | ||
@test small_sig.stable | ||
|
||
# Test Eigenvalues | ||
@test LinearAlgebra.norm(eigs - eigs_value) < 1e-3 | ||
|
||
# Solve problem | ||
@test execute!(sim, Rodas4(); dtmax = 0.005, saveat = 0.005) == | ||
PSID.SIMULATION_FINALIZED | ||
results = read_results(sim) | ||
|
||
# Obtain data for voltage magnitude at bus 102 | ||
series = get_voltage_magnitude_series(results, 102) | ||
t = series[1] | ||
V = series[2] | ||
# Test Vf, τm and branch series flows with PSSE | ||
_, P101_103 = get_activepower_branch_flow(results, "BUS 1-BUS 3-i_1", :from) | ||
_, Q101_103 = get_reactivepower_branch_flow(results, "BUS 1-BUS 3-i_1", :from) | ||
_, P103_101 = get_activepower_branch_flow(results, "BUS 1-BUS 3-i_1", :to) | ||
_, Q103_101 = get_reactivepower_branch_flow(results, "BUS 1-BUS 3-i_1", :to) | ||
_, τm = get_mechanical_torque_series(results, "generator-102-1") | ||
|
||
# TODO: Get PSSE CSV files and enable tests | ||
#M = get_csv_data(csv_file) | ||
#t_psse = M[:, 1] | ||
#V_psse = M[:, 2] | ||
#P101_103_psse = M[:, 3] ./ 100.0 # convert to pu | ||
#Q101_103_psse = M[:, 4] ./ 100.0 # convert to pu | ||
#P103_101_psse = M[:, 5] ./ 100.0 # convert to pu | ||
#Q103_101_psse = M[:, 6] ./ 100.0 # convert to pu | ||
#Vf_psse = M[:, 7] | ||
#τm_psse = M[:, 8] | ||
|
||
# Test Transient Simulation Results | ||
#@test LinearAlgebra.norm(V - V_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(P101_103 - P101_103_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(Q101_103 - Q101_103_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(P103_101 - P103_101_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(Q103_101 - Q103_101_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(Vf - Vf_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(τm - τm_psse, Inf) <= 1e-2 | ||
#@test LinearAlgebra.norm(t - round.(t_psse, digits = 3)) == 0.0 | ||
finally | ||
@info("removing test files") | ||
rm(path; force = true, recursive = true) | ||
end | ||
end | ||
|
||
@testset "Test 63 DEGOV1 ResidualModel" begin | ||
for (ix, name) in enumerate(names) | ||
@testset "$(name)" begin | ||
dyr_file = dyr_files[ix] | ||
csv_file = csv_files[ix] | ||
init_cond = init_conditions[ix] | ||
eigs_value = eigs_values[ix] | ||
test_degov1_implicit(dyr_file, csv_file, init_cond, eigs_value) | ||
end | ||
end | ||
end | ||
|
||
@testset "Test 63 DEGOV1 MassMatrixModel" begin | ||
for (ix, name) in enumerate(names) | ||
@testset "$(name)" begin | ||
dyr_file = dyr_files[ix] | ||
csv_file = csv_files[ix] | ||
init_cond = init_conditions[ix] | ||
eigs_value = eigs_values[ix] | ||
test_degov1_mass_matrix(dyr_file, csv_file, init_cond, eigs_value) | ||
end | ||
end | ||
end |