Skip to content

Commit 2b17faa

Browse files
authored
Merge pull request #572 from jinningwang/enhance
Enhancement
2 parents d534ced + e38166f commit 2b17faa

File tree

8 files changed

+152
-13
lines changed

8 files changed

+152
-13
lines changed

andes/cases/wscc9/wscc9_3wxfr.raw

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
0, 100.00, 33, 0, 0, 60.00 /
2+
This case has a extra three-winding transformer for file parser testing only. October 04, 2024 15:43:21
3+
0 / END OF SYSTEM-WIDE DATA, BEGIN BUS DATA
4+
1,'Bus1 ', 16.5000,3, 1, 1, 1,1.04000, 0.0000
5+
2,'Bus 2 ', 18.0000,2, 1, 1, 1,1.02500, 9.3507
6+
3,'Bus 3 ', 13.8000,2, 1, 1, 1,1.02500, 5.1420
7+
4,'Bus 4 ', 230.0000,1, 2, 2, 2,1.02531, -2.2174
8+
5,'Bus 5 ', 230.0000,1, 1, 1, 1,0.99972, -3.6802
9+
6,'Bus 6 ', 230.0000,1, 1, 1, 1,1.01225, -3.5666
10+
7,'Bus 7 ', 230.0000,1, 1, 1, 1,1.02683, 3.7961
11+
8,'Bus 8 ', 230.0000,1, 1, 1, 1,1.01727, 1.3373
12+
9,'Bus 9 ', 230.0000,1, 1, 1, 1,1.03269, 2.4448
13+
0 / END OF BUS DATA, BEGIN LOAD DATA
14+
5,'1 ',1, 1, 1, 125.000, 50.000, 0.000, 0.000, 0.000, -0.000, 1,1
15+
6,'1 ',1, 1, 1, 90.000, 30.000, 0.000, 0.000, 0.000, -0.000, 1,1
16+
8,'1 ',1, 1, 1, 100.000, 35.000, 0.000, 0.000, 0.000, -0.000, 1,1
17+
0 / END OF LOAD DATA, BEGIN FIXED SHUNT DATA
18+
0 / END OF FIXED SHUNT DATA, BEGIN GENERATOR DATA
19+
1,'1 ', 71.627, 27.915, 9900.000, -9900.000,1.04000, 0, 500.000, 0.00000, 1.00000, 0.00000, 0.00000,1.00000,1, 100.0, 450.000, 0.000, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000,0, 1.0000
20+
2,'1 ', 163.000, 4.903, 9900.000, -9900.000,1.02500, 0, 250.000, 0.00000, 1.00000, 0.00000, 0.00000,1.00000,1, 100.0, 240.000, 0.000, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000,0, 1.0000
21+
3,'1 ', 85.000, -11.449, 9900.000, -9900.000,1.02500, 0, 100.000, 0.00000, 1.00000, 0.00000, 0.00000,1.00000,1, 100.0, 90.000, 0.000, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000,0, 1.0000
22+
0 / END OF GENERATOR DATA, BEGIN BRANCH DATA
23+
5, 4,'1 ', 0.01000, 0.06800,0.17600, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
24+
6, 4,'1 ', 0.01700, 0.09200,0.15800, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
25+
7, 5,'1 ', 0.03200, 0.16100,0.30600, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
26+
9, 6,'1 ', 0.03900, 0.17380,0.35800, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
27+
7, 8,'1 ', 0.00850, 0.05760,0.14900, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
28+
8, 9,'1 ', 0.01190, 0.10080,0.20900, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
29+
0 / END OF BRANCH DATA, BEGIN TRANSFORMER DATA
30+
4, 1, 0,'1 ',1,1,1, 0.00000, 0.00000,2,' ',1, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
31+
0.00000, 0.05760, 100.00
32+
1.00000, 0.000, 0.000, 0.00, 0.00, 0.00,0, 0, 1.50000, 0.51000, 1.50000, 0.51000,159, 0, 0.00000, 0.00000
33+
1.00000, 0.000
34+
2, 7, 0,'1 ',1,1,1, 0.00000, 0.00000,2,' ',1, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
35+
0.00000, 0.06250, 100.00
36+
1.00000, 0.000, 0.000, 0.00, 0.00, 0.00,0, 2, 1.10000, 0.90000, 1.00000, 0.99000, 33, 0, 0.00000, 0.00000
37+
1.00000, 0.000
38+
9, 3, 0,'1 ',1,1,1, 0.00000, 0.00000,2,' ',1, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
39+
0.00000, 0.05860, 100.00
40+
1.00000, 0.000, 0.000, 0.00, 0.00, 0.00,0, 9, 1.10000, 0.90000, 1.00000, 0.99000, 33, 0, 0.00000, 0.00000
41+
1.00000, 0.000
42+
4, 5, 6,'1 ',1,1,1, 0.00000, 0.00000,2,'3WINDXFR',1, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000
43+
0.01000, 0.10000, 100.00, 0.02000, 0.20000, 100.00, 0.03000, 0.30000, 100.00, 1.00000, 0.00000
44+
1.00000, 230.00, 0.000, 100.00, 100.00, 100.00, 0, 4, 1.10000, 0.90000, 1.10000, 0.90000, 33, 0, 0.00000, 0.00000
45+
1.00000, 230.00, 0.000, 100.00, 100.00, 100.00, 0, 5, 1.10000, 0.90000, 1.10000, 0.90000, 33, 0, 0.00000, 0.00000
46+
1.00000, 230.00, 0.000, 100.00, 100.00, 100.00, 0, 6, 1.10000, 0.90000, 1.10000, 0.90000, 33, 0, 0.00000, 0.00000
47+
0 / END OF TRANSFORMER DATA, BEGIN AREA DATA
48+
1, 0, 0.000, 1.000,'1 '
49+
0 / END OF AREA DATA, BEGIN TWO-TERMINAL DC DATA
50+
0 / END OF TWO-TERMINAL DC DATA, BEGIN VOLTAGE SOURCE CONVERTER DATA
51+
0 / END OF VOLTAGE SOURCE CONVERTER DATA, BEGIN IMPEDANCE CORRECTION DATA
52+
0 / END OF IMPEDANCE CORRECTION DATA, BEGIN MULTI-TERMINAL DC DATA
53+
0 / END OF MULTI-TERMINAL DC DATA, BEGIN MULTI-SECTION LINE DATA
54+
0 / END OF MULTI-SECTION LINE DATA, BEGIN ZONE DATA
55+
1,'1 '
56+
0 / END OF ZONE DATA, BEGIN INTER-AREA TRANSFER DATA
57+
0 / END OF INTER-AREA TRANSFER DATA, BEGIN OWNER DATA
58+
1,'1'
59+
0 / END OF OWNER DATA, BEGIN FACTS CONTROL DEVICE DATA
60+
0 / END OF FACTS CONTROL DEVICE DATA, BEGIN SWITCHED SHUNT DATA
61+
0 /END OF SWITCHED SHUNT DATA, BEGIN GNE DEVICE DATA
62+
0 /END OF GNE DEVICE DATA
63+
Q

andes/io/psse.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,20 @@ def _parse_transf_v33(raw, system, max_bus):
555555
logger.warning('Added bus <%s> for 3-winding transformer <%s-%s-%s>',
556556
new_bus, data[0][0], data[0][1], data[0][2])
557557

558+
# Assign `area`, `owner`, and `zone` using the high-voltage side bus values
559+
high_voltage_bus = data[0][0]
560+
area = system.Bus.get(src='area', attr='v', idx=high_voltage_bus)
561+
zone = system.Bus.get(src='zone', attr='v', idx=high_voltage_bus)
562+
owner = system.Bus.get(src='owner', attr='v', idx=high_voltage_bus)
563+
558564
param = {'idx': new_bus,
559565
'name': '_'.join([str(i) for i in data[0][:3]]),
560566
'Vn': 1.0,
561567
'v0': data[1][-2],
562-
'a0': data[1][-1] * deg2rad
568+
'a0': data[1][-1] * deg2rad,
569+
'area': area,
570+
'owner': owner,
571+
'zone': zone,
563572
}
564573

565574
out['Bus'].append(param)

andes/models/group.py

+25
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,31 @@ def get_next_idx(self, idx=None, model_name=None):
438438

439439
return idx
440440

441+
def get_all_idxes(self):
442+
"""
443+
Return all the devices idx in this group.
444+
445+
Returns
446+
-------
447+
list
448+
List of indices.
449+
450+
Notes
451+
-----
452+
The default models sequence depends on the order of the models in the group,
453+
which comes from OrderedDict `file_classes` in `models.__init__.py`.
454+
455+
Examples
456+
--------
457+
>>> ss = andes.load(andes.get_case('ieee14/ieee14_pvd1.xlsx'))
458+
>>> ss.DG.get_all_idxes()
459+
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
460+
461+
>>> ss.StaticGen.get_all_idxes()
462+
[2, 3, 4, 5, 6, 1]
463+
"""
464+
return list(self._idx2model.keys())
465+
441466
def doc(self, export='plain'):
442467
"""
443468
Return the documentation of the group in a string.

andes/routines/pflow.py

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
class PFlow(BaseRoutine):
1717
"""
1818
Power flow calculation routine.
19+
20+
Power flow analysis currently supports limiting reactive power (needs to to be
21+
turned on via `config.pv2pq`) but does not enforce voltage limits.
1922
"""
2023

2124
def __init__(self, system=None, config=None):

docs/source/release-notes.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ v1.9 Notes
1111

1212
v1.9.3 (2024-04-XX)
1313
-------------------
14-
- In the `dae`` module, change `self.t.itemset` to array assignment to ensure compatibility with NumPy 2.0.
14+
- In the ``dae`` module, change `self.t.itemset` to array assignment to ensure compatibility with NumPy 2.0.
1515
- Follow RTD's deprecation of Sphinx context injection at build time
1616
- In symbolic processor, most variables are assumed to be real, except some
1717
services that are specified as complex. This will allow generating simplified
@@ -20,6 +20,8 @@ v1.9.3 (2024-04-XX)
2020
- Add parameter from_csv=None in TDS.run() to allow loading data from CSV files at TDS begining.
2121
- Fix `TDS.init()` and `TDS._csv_step()` to fit loading from CSV when `Output` exists.
2222
- Add parameter `allow_all=False` to `ModelData.find_idx()` `GroupBase.find_idx()` to allow searching all matches.
23+
- Add method `GroupBase.get_all_idxes()` to get all indices of a group.
24+
- Enhanced three-winding transformer parsing in PSS/E raw files by assigning the equivalent star bus `area`, `owner`, and `zone` using the high-voltage bus values.
2325

2426
v1.9.2 (2024-03-25)
2527
-------------------

examples/ex1.ipynb

+18-11
Large diffs are not rendered by default.

tests/test_group.py

+6
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,9 @@ def test_group_access(self):
102102
# --- get_field ---
103103
ff = ss.DG.get_field('f', list(ss.DG._idx2model.keys()), 'v_code')
104104
self.assertTrue(any([item == 'y' for item in ff]))
105+
106+
# --- get group idx ---
107+
self.assertSetEqual(set(ss.DG.get_all_idxes()),
108+
set(ss.PVD1.idx.v))
109+
self.assertSetEqual(set(ss.StaticGen.get_all_idxes()),
110+
set(ss.PV.idx.v + ss.Slack.idx.v))

tests/test_psse_parser.py

+24
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from andes.system import System
1010
from andes.io import psse
1111

12+
import andes
13+
1214

1315
class TestPSSEParser(unittest.TestCase):
1416
"""
@@ -26,3 +28,25 @@ def test_sort_models(self):
2628
with open(f'{dirname}/../andes/io/psse-dyr.yaml', 'r') as f:
2729
dyr_yaml = yaml.full_load(f)
2830
psse.sort_psse_models(dyr_yaml, system)
31+
32+
def test_3wxfr(self):
33+
"""
34+
Test three winding transformer parsing.
35+
"""
36+
37+
ss = andes.load(andes.get_case('wscc9/wscc9_3wxfr.raw'),
38+
setup=True)
39+
40+
hv_bus = 4 # high voltage bus
41+
area_hv = ss.Bus.get(src='area', attr='v', idx=hv_bus)
42+
zone_hv = ss.Bus.get(src='zone', attr='v', idx=hv_bus)
43+
owner_hv = ss.Bus.get(src='owner', attr='v', idx=hv_bus)
44+
45+
star_bus = 10 # created star bus
46+
area_star = ss.Bus.get(src='area', attr='v', idx=star_bus)
47+
zone_hv = ss.Bus.get(src='zone', attr='v', idx=star_bus)
48+
owner_hv = ss.Bus.get(src='owner', attr='v', idx=star_bus)
49+
50+
self.assertEqual(area_hv, area_star)
51+
self.assertEqual(zone_hv, zone_hv)
52+
self.assertEqual(owner_hv, owner_hv)

0 commit comments

Comments
 (0)