-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update psse parser for 3winding transformers #917
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,8 +434,13 @@ function _psse2pm_transformer!(pm_data::Dict, pti_data::Dict, import_all::Bool) | |
else | ||
br_r, br_x = transformer["R1-2"], transformer["X1-2"] | ||
end | ||
br_r *= (transformer["NOMV1"]^2 / _get_bus_value(transformer["I"], "base_kv", pm_data)^2) * (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
br_x *= (transformer["NOMV1"]^2 / _get_bus_value(transformer["I"], "base_kv", pm_data)^2) * (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
if transformer["NOMV1"] == 0.0 | ||
br_r *= (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
br_x *= (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
else | ||
br_r *= (transformer["NOMV1"]^2 / _get_bus_value(transformer["I"], "base_kv", pm_data)^2) * (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
br_x *= (transformer["NOMV1"]^2 / _get_bus_value(transformer["I"], "base_kv", pm_data)^2) * (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
end | ||
end | ||
|
||
# Zeq scaling for tap2 (see eq (4.21b) in PROGRAM APPLICATION GUIDE 1 in PSSE installation folder) | ||
|
@@ -448,8 +453,13 @@ function _psse2pm_transformer!(pm_data::Dict, pti_data::Dict, import_all::Bool) | |
br_r *= (transformer["WINDV2"]/_get_bus_value(transformer["J"], "base_kv", pm_data))^2 | ||
br_x *= (transformer["WINDV2"]/_get_bus_value(transformer["J"], "base_kv", pm_data))^2 | ||
else # "for off-nominal turns ratio in pu of nominal winding voltage, NOMV1, NOMV2 and NOMV3." | ||
br_r *= (transformer["WINDV2"]*(transformer["NOMV2"]/_get_bus_value(transformer["J"], "base_kv", pm_data)))^2 | ||
br_x *= (transformer["WINDV2"]*(transformer["NOMV2"]/_get_bus_value(transformer["J"], "base_kv", pm_data)))^2 | ||
if transformer["NOMV2"] == 0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same note as above. |
||
br_r *= transformer["WINDV2"]^2 | ||
br_x *= transformer["WINDV2"]^2 | ||
else | ||
br_r *= (transformer["WINDV2"]*(transformer["NOMV2"]/_get_bus_value(transformer["J"], "base_kv", pm_data)))^2 | ||
br_x *= (transformer["WINDV2"]*(transformer["NOMV2"]/_get_bus_value(transformer["J"], "base_kv", pm_data)))^2 | ||
end | ||
end | ||
end | ||
|
||
|
@@ -482,15 +492,23 @@ function _psse2pm_transformer!(pm_data::Dict, pti_data::Dict, import_all::Bool) | |
sub_data["nomv2"] = transformer["NOMV2"] | ||
end | ||
|
||
# Assumes CW = 1, namely, for off-nominal turns ratio in pu of windning bus base voltage | ||
sub_data["tap"] = pop!(transformer, "WINDV1") / pop!(transformer, "WINDV2") | ||
sub_data["shift"] = pop!(transformer, "ANG1") | ||
|
||
# Unit Transformations | ||
if transformer["CW"] != 1 # NOT "for off-nominal turns ratio in pu of winding bus base voltage" | ||
if transformer["CW"] == 1 # "for off-nominal turns ratio in pu of winding bus base voltage" | ||
# do nothing | ||
elseif transformer["CW"] == 2 # "for winding voltage in kv" | ||
sub_data["tap"] *= _get_bus_value(transformer["J"], "base_kv", pm_data) / _get_bus_value(transformer["I"], "base_kv", pm_data) | ||
if transformer["CW"] == 3 # "for off-nominal turns ratio in pu of nominal winding voltage, NOMV1, NOMV2 and NOMV3." | ||
sub_data["tap"] *= transformer["NOMV1"] / transformer["NOMV2"] | ||
elseif transformer["CW"] == 3 # "for off-nominal turns ratio in pu of nominal winding voltage, NOMV1, NOMV2 and NOMV3." | ||
if !iszero(transformer["NOMV1"]) && !iszero(transformer["NOMV2"]) | ||
sub_data["tap"] *= (transformer["NOMV1"] / transformer["NOMV2"]) * (_get_bus_value(transformer["J"], "base_kv", pm_data) / _get_bus_value(transformer["I"], "base_kv", pm_data)) | ||
else | ||
# do nothing | ||
end | ||
else | ||
error(_LOGGER, "psse data parsing error, unsupported value for `CW` on transformer") | ||
end | ||
|
||
if import_all | ||
|
@@ -544,13 +562,29 @@ function _psse2pm_transformer!(pm_data::Dict, pti_data::Dict, import_all::Bool) | |
|
||
# Unit Transformations | ||
if transformer["CZ"] != 1 # NOT "for resistance and reactance in pu on system MVA base and winding voltage base" | ||
br_r12 *= (transformer["NOMV1"] / _get_bus_value(bus_id1, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
br_r23 *= (transformer["NOMV2"] / _get_bus_value(bus_id2, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE2-3"]) | ||
br_r31 *= (transformer["NOMV3"] / _get_bus_value(bus_id3, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE3-1"]) | ||
if transformer["NOMV1"] == 0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same note as above. |
||
br_r12 *= (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
br_x12 *= (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
else | ||
br_r12 *= (transformer["NOMV1"] / _get_bus_value(bus_id1, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
br_x12 *= (transformer["NOMV1"] / _get_bus_value(bus_id1, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
end | ||
|
||
br_x12 *= (transformer["NOMV1"] / _get_bus_value(bus_id1, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE1-2"]) | ||
br_x23 *= (transformer["NOMV2"] / _get_bus_value(bus_id2, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE2-3"]) | ||
br_x31 *= (transformer["NOMV3"] / _get_bus_value(bus_id3, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE3-1"]) | ||
if transformer["NOMV2"] == 0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same note as above. |
||
br_r23 *= (pm_data["baseMVA"] / transformer["SBASE2-3"]) | ||
br_x23 *= (pm_data["baseMVA"] / transformer["SBASE2-3"]) | ||
else | ||
br_r23 *= (transformer["NOMV2"] / _get_bus_value(bus_id2, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE2-3"]) | ||
br_x23 *= (transformer["NOMV2"] / _get_bus_value(bus_id2, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE2-3"]) | ||
end | ||
|
||
if transformer["NOMV3"] == 0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same note as above |
||
br_r31 *= (pm_data["baseMVA"] / transformer["SBASE3-1"]) | ||
br_x31 *= (pm_data["baseMVA"] / transformer["SBASE3-1"]) | ||
else | ||
br_r31 *= (transformer["NOMV3"] / _get_bus_value(bus_id3, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE3-1"]) | ||
br_x31 *= (transformer["NOMV3"] / _get_bus_value(bus_id3, "base_kv", pm_data))^2 * (pm_data["baseMVA"] / transformer["SBASE3-1"]) | ||
end | ||
end | ||
|
||
# See "Power System Stability and Control", ISBN: 0-07-035958-X, Eq. 6.72 | ||
|
@@ -600,11 +634,18 @@ function _psse2pm_transformer!(pm_data::Dict, pti_data::Dict, import_all::Bool) | |
sub_data["shift"] = pop!(transformer, "ANG$m") | ||
|
||
# Unit Transformations | ||
if transformer["CW"] != 1 # NOT "for off-nominal turns ratio in pu of winding bus base voltage" | ||
if transformer["CW"] == 1 # "for off-nominal turns ratio in pu of winding bus base voltage" | ||
# do nothing | ||
elseif transformer["CW"] == 2 # "for winding voltage in kv" | ||
sub_data["tap"] /= _get_bus_value(bus_id, "base_kv", pm_data) | ||
if transformer["CW"] == 3 # "for off-nominal turns ratio in pu of nominal winding voltage, NOMV1, NOMV2 and NOMV3." | ||
sub_data["tap"] *= transformer["NOMV$m"] | ||
elseif transformer["CW"] == 3 # "for off-nominal turns ratio in pu of nominal winding voltage, NOMV1, NOMV2 and NOMV3." | ||
if !iszero(transformer["NOMV$m"]) | ||
sub_data["tap"] *= transformer["NOMV$m"] / _get_bus_value(bus_id, "base_kv", pm_data) | ||
else | ||
# do nothing | ||
end | ||
else | ||
error(_LOGGER, "psse data parsing error, unsupported value for `CW` on transformer") | ||
end | ||
|
||
if import_all | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
0, 100.00, 33, 0, 1, 50.00 / PSS(R)E 33 RAW created by rawd33 MON, SEP 18 2023 13:45 | ||
Example | ||
SOME ITEMS IS NOT SUPPORTED, PLEASE CHECK THE DOCS. | ||
2,' ', 132.0000,1, 6, 6, 1,0.82852, -0.7009,1.10000,0.9000,1.1000,0.90000 | ||
3,' ', 132.0000,1, 6, 5, 1,0.93835, -2.1349,1.10000,0.9000,1.1000,0.90000 | ||
4,' ', 11.0000,3, 6, 6, 1,1.05000, 0.0000,1.1000,0.9000,1.10000,0.90000 | ||
0 / END OF BUS DATA, BEGIN LOAD DATA | ||
2,'1 ',1, 6, 6, 15.000, 50.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 | ||
4,'1 ', 18.352, 58.958, 400.000, 0.000,1.05000, 0, 100.000, 0.00000E+0, 2.00000E-1, 0.00000E+0, 0.00000E+0,1.00000,1, 100.0, 300.000, 0.000, 60,1.0000 | ||
0 / END OF GENERATOR DATA, BEGIN BRANCH DATA | ||
2, 3,'1 ', 9.00000E-2, 1.60000E-1, 0.05000, 90.30, 99.30, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 60.00, 1,1.0000 | ||
0 / END OF BRANCH DATA, BEGIN TRANSFORMER DATA | ||
3, 4, 0,'1 ',3,2,1, 0.00000E+0, 0.00000E+0,2,' ',1, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000,' ' | ||
0.00000E+0, 1.20000E-1, 100.00 | ||
1.00000, 0.000, 0.000, 100.00, 66.00, 0.00, 1, 0, 1.15003, 0.94999, 1.10000, 0.90000, 17, 0, 0.00000, 0.00000, 0.000 | ||
1.00000, 0.000 | ||
0 / END OF TRANSFORMER DATA, BEGIN AREA DATA | ||
0 / END OF AREA DATA, BEGIN TWO-TERMINAL DC DATA | ||
0 / END OF TWO-TERMINAL DC DATA, BEGIN VSC DC LINE DATA | ||
0 / END OF VSC DC LINE DATA, BEGIN IMPEDANCE CORRECTION DATA | ||
0 / END OF IMPEDANCE CORRECTION DATA, BEGIN MULTI-TERMINAL DC DATA | ||
0 / END OF MULTI-TERMINAL DC 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 DATA | ||
0 / END OF GNE DATA, BEGIN INDUCTION MACHINE DATA | ||
0 / END OF INDUCTION MACHINE DATA | ||
Q |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
0, 100.0, 33, 0, 1, 50.0 | ||
|
||
|
||
1, 'BUS1 ', 380.0, 3, 1, 1, 1, 1.0, 0.0, 1.1, 0.9, 1.1, 0.9 | ||
2, 'BUS2 ', 110.0, 2, 1, 1, 1, 1.03828, -0.0017, 1.1, 0.9, 1.1, 0.9 | ||
81, 'BUS81 ', 30.0, 1, 1, 1, 1, 0.95156, -150.4438, 1.1, 0.9, 1.1, 0.9 | ||
0 / END OF BUS DATA, BEGIN LOAD DATA | ||
81, '1 ', 1, 1, 1, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0 | ||
0 / END OF LOAD DATA, BEGIN FIXED SHUNT DATA | ||
0 / END OF FIXED SHUNT DATA, BEGIN GENERATOR DATA | ||
1, 'Q1', 0.05, -2.757, 100.0, -100.0, 1.0, 1, 100.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1, 100.0, 100.0, 0.0, 1, 1.0, 0, 1.0, 0, 1.0, 0, 1.0, 0, 1.0 | ||
0 / END OF GENERATOR DATA, BEGIN BRANCH DATA | ||
0 / END OF BRANCH DATA, BEGIN TRANSFORMER DATA | ||
1, 2, 81, 'T4', 2, 2, 1, 0.0, 0.0, 2, 'T4 ', 1, 1, 1.0, 0, 1.0, 0, 1.0, 0, 1.0, ' ' | ||
0.0026, 0.209984, 350.0, 0.0016, 0.0699817, 50.0, 0.0016, 0.0999872, 50.0, 0.95174, -0.001 | ||
400.0, 0.0, 0.0, 350.0, 0.0, 0.0, 0, 0, 1.1, 0.9, 1.1, 0.9, 33, 0, 0.0, 0.0, 0.0 | ||
120.0, 0.0, 0.0, 50.0, 0.0, 0.0, 0, 0, 1.1, 0.9, 1.1, 0.9, 33, 0, 0.0, 0.0, 0.0 | ||
30.0, 0.0, -30.0, 50.0, 0.0, 0.0, 0, 0, 1.1, 0.9, 1.1, 0.9, 33, 0, 0.0, 0.0, 0.0 | ||
0 / END OF TRANSFORMER DATA, BEGIN AREA DATA | ||
0 / END OF AREA DATA, BEGIN TWO-TERMINAL DC DATA | ||
0 / END OF TWO-TERMINAL DC DATA, BEGIN VOLTAGE SOURCE CONVERTER DATA | ||
0 / END OF VOLTAGE SOURCE CONVERTER DATA, BEGIN IMPEDANCE CORRECTION DATA | ||
0 / END OF IMPEDANCE CORRECTION DATA, BEGIN MULTI-TERMINAL DC DATA | ||
0 / END OF MULTI-TERMINAL DC 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 CONTROL DEVICE DATA | ||
0 / END OF FACTS CONTROL 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 INDUCTION MACHINE DATA | ||
Q |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
0, 100.0, 33, 0, 1, 50.0 | ||
|
||
|
||
1, 'BUS1 ', 380.0, 3, 1, 1, 1, 1.0, 0.0, 1.1, 0.9, 1.1, 0.9 | ||
2, 'BUS2 ', 110.0, 2, 1, 1, 1, 1.03828, -0.0017, 1.1, 0.9, 1.1, 0.9 | ||
81, 'BUS81 ', 30.0, 1, 1, 1, 1, 0.95156, -150.4438, 1.1, 0.9, 1.1, 0.9 | ||
0 / END OF BUS DATA, BEGIN LOAD DATA | ||
81, '1 ', 1, 1, 1, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0 | ||
0 / END OF LOAD DATA, BEGIN FIXED SHUNT DATA | ||
0 / END OF FIXED SHUNT DATA, BEGIN GENERATOR DATA | ||
1, 'Q1', 0.05, -2.757, 100.0, -100.0, 1.0, 1, 100.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1, 100.0, 100.0, 0.0, 1, 1.0, 0, 1.0, 0, 1.0, 0, 1.0, 0, 1.0 | ||
0 / END OF GENERATOR DATA, BEGIN BRANCH DATA | ||
0 / END OF BRANCH DATA, BEGIN TRANSFORMER DATA | ||
1, 2, 81, 'T4', 3, 2, 1, 0.0, 0.0, 2, 'T4 ', 1, 1, 1.0, 0, 1.0, 0, 1.0, 0, 1.0, ' ' | ||
0.0026, 0.209984, 350.0, 0.0016, 0.0699817, 50.0, 0.0016, 0.0999872, 50.0, 0.95174, -0.001 | ||
1.0, 0.0, 0.0, 350.0, 0.0, 0.0, 0, 0, 1.1, 0.9, 1.1, 0.9, 33, 0, 0.0, 0.0, 0.0 | ||
1.0, 0.0, 0.0, 50.0, 0.0, 0.0, 0, 0, 1.1, 0.9, 1.1, 0.9, 33, 0, 0.0, 0.0, 0.0 | ||
1.0, 0.0, -30.0, 50.0, 0.0, 0.0, 0, 0, 1.1, 0.9, 1.1, 0.9, 33, 0, 0.0, 0.0, 0.0 | ||
0 / END OF TRANSFORMER DATA, BEGIN AREA DATA | ||
0 / END OF AREA DATA, BEGIN TWO-TERMINAL DC DATA | ||
0 / END OF TWO-TERMINAL DC DATA, BEGIN VOLTAGE SOURCE CONVERTER DATA | ||
0 / END OF VOLTAGE SOURCE CONVERTER DATA, BEGIN IMPEDANCE CORRECTION DATA | ||
0 / END OF IMPEDANCE CORRECTION DATA, BEGIN MULTI-TERMINAL DC DATA | ||
0 / END OF MULTI-TERMINAL DC 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 CONTROL DEVICE DATA | ||
0 / END OF FACTS CONTROL 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 INDUCTION MACHINE DATA | ||
Q |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of
x == 0.0
I am wondering ifisapprox(x, 0.0)
would be more robust.@odow, can you comment the the best practice in Julia for float equality tests?