Ask Your Question
0

How to retrieve Three Winding Transformer (Winding 1,2,3 Data) via Python?

asked 2020-04-09 07:19:23 -0500

ZAM gravatar image

Hi, I have to extract Winding 1, Winding2 and Winding 3 MVA (RATE1 lets say) for over 1000 Three Winding Transformers present in case file. Since, there individual winding attributes we cannot see all at once in PSSE spreadsheat, as we can only one by one. So, we cannot copy all at once. Thus In order to avoid length tiring job (1000 times repeating same), I was working to retrieve this via Python. Can anyone please suggest which code should I use to retrieve WINDING 1 MVA, WINDING 2 MVA and WINDING 3 MVA for all 1000 3W-Transformers?

and How can I put up loop to get all at once?

Thanks in advance

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2020-04-16 13:39:38 -0500

drsgao gravatar image

I needed to do something similar before. To avoid repeating the effort, I made a big function that can extract all things that can be extracted for 3-winding transformer windings. Be aware that the APIs in PSSE for 3-winding transformer and 3-winding transformer windings are different.

# 3-Winding Transformer Winding data
# this dictionary is sourced from PSSE's API doct, and there are
# descriptions that even I do not understand
CONST_DICT_3WTRF_WND_HEADER = {# int
                                'WNDBUSNUMBER'  : ['WNDBUSNUMBER',  'Number of the bus connected to this winding'],
                                'OTHER1NUMBER'  : ['OTHER1NUMBER',  'Number of another bus connected to this transformer'],
                                'OTHER2NUMBER'  : ['OTHER2NUMBER',  'Number of another bus connected to this transformer'],
                                'WNDNUM'        : ['WNDNUM',        'Winding number'],
                                'WIND1NUMBER'   : ['WIND1NUMBER',   'Winding 1 bus number'],
                                'WIND2NUMBER'   : ['WIND2NUMBER',   'Winding 2 bus number'],
                                'WIND3NUMBER'   : ['WIND3NUMBER',   'Winding 3 bus number'],
                                'NMETERNUMBER'  : ['NMETERNUMBER',  'Non-metered end bus number'],
                                'STATUS'        : ['STATUS',        'Winding status'],
                                'OWNERS'        : ['OWNERS',        'Number of owners'],
                                'OWN1'          : ['OWN1',          'First owner'],
                                'OWN2'          : ['OWN2',          'Second owner'],
                                'OWN3'          : ['OWN3',          'Third owner'],
                                'OWN4'          : ['OWN4',          'Fourth owner'],
                                'ICONTNUMBER'   : ['ICONTNUMBER',   'Controlled bus number'],
                                'TABLE'         : ['TABLE',         'Transformer impedance adjustment table number'],
                                'CODE'          : ['CODE',          'Transformer control mode for automatic adjustments'],
                                'NTPOSN'        : ['NTPOSN',        'Number of tap positions'],
                                'CW'            : ['CW',            'Winding data I/O code'],
                                'CZ'            : ['CZ',            'Impedance data I/O code'],
                                'CM'            : ['CM',            'Magnetizing admittance I/O code'],
                                'CZ0'           : ['CZ0',           'Leakage impedance data I/O code'],
                                'CZG'           : ['CZG',           'Grounding impedance data I/O code'],
                                'CNXCOD'        : ['CNXCOD',        'Connection code'],
                                'TPSTT'         : ['TPSTT',         'Winding 1 ratio limit code: -1 for low; 0 for regulating; 1 for high; -2 for locked'],
                                'ANSTT'         : ['ANSTT',         'Winding 1 angle limit code: -1 for low; 0 for regulating; 1 for high; -2 for locked'],

                                # float
                                'AMPS'          : ['AMPS',          'Branch current in amps (0.0 if bus base voltage is 0.0)'],
                                'PUCUR'         : ['PUCUR',         'Branch current in pu'],
                                'PCTRATE'       : ['PCTRATE',       'Percent winding bus current of default rating set'],
                                'PCTRATEA'      : ['PCTRATEA',      'Percent winding bus current of rating set A'],
                                'PCTRATEB'      : ['PCTRATEB',      'Percent winding bus current of rating set B'],
                                'PCTRATEC'      : ['PCTRATEC',      'Percent winding bus current of rating set C'],
                                'PCTMVARATE'    : ['PCTMVARATE',    'Percent winding bus MVA of default rating set'],
                                'PCTMVARATEA'   : ['PCTMVARATEA',   'Percent winding bus MVA of rating set A'],
                                'PCTMVARATEB'   : ['PCTMVARATEB',   'Percent winding bus MVA of rating set B'],
                                'PCTMVARATEC'   : ['PCTMVARATEC',   'Percent winding bus MVA of rating set C'],
                                'PCTCORPRATE'   : ['PCTCORPRATE',   'Percent winding bus current or MVA loading (according to the transformer percent loading units program option setting) of default rating set'],
                                'PCTCORPRATEA'  : ['PCTCORPRATEA',  'Percent winding bus current or MVA loading (according to the transformer percent loading units program option setting) of rating set A'],
                                'PCTCORPRATEB'  : ['PCTCORPRATEB',  'Percent winding bus current or MVA loading (according to the transformer percent loading units program option setting) of rating set B'],
                                'PCTCORPRATEC'  : ['PCTCORPRATEC',  'Percent winding bus current or MVA loading (according to the transformer percent loading units program option setting) of rating set C'],
                                'MAXPCTRATE'    : ['MAXPCTRATE',    'Larger of percent winding/star point bus current of default rating set'],
                                'MAXPCTRATEA'   : ['MAXPCTRATEA',   'Larger of percent winding/star point bus current of rating set A'],
                                'MAXPCTRATEB'   : ['MAXPCTRATEB',   'Larger of percent winding/star point bus current of rating set B'],
                                'MAXPCTRATEC'   : ['MAXPCTRATEC',   'Larger of percent ...
(more)
edit flag offensive delete link more
0

answered 2020-04-16 11:57:47 -0500

perolofl gravatar image

I believe the following code will do the work:

# Get 3W data in arrays
sid = -1    
ierr, lbuses = psspy.awndint(sid,ties=3, flag=3, entry=2,string=['WIND1NUMBER','WIND2NUMBER','WIND3NUMBER','WNDNUM'])
ierr, sarray = psspy.awndchar(sid,ties=3, flag=3, entry=2,string=['ID'])
ierr, rarray = psspy.awndreal(sid,ties=3, flag=3, entry=2,string=['RATEA'])

# Print arrays with one 3w-transformer per row
print '   IBUS    JBUS    KBUS  ID   Winding-1  Winding-2  Winding-3'
for i,ibus in enumerate(lbuses[0]):
    # with entry=2 winding data should be in order 1,2,3,1,2,3,1,2,3,etc in the arrays
    winding = lbuses[3][i]
    # print IBUS, JBUS, KBUS, ID, W1-rate, W2-rate, W3-rate
    if winding==1: print '%7i %7i %7i  %2s  %8.1f   %8.1f   %8.1f' % (ibus,lbuses[1][i],lbuses[2][i],sarray[0][i],rarray[0][i],rarray[0][i+1],rarray[0][i+2])

You can change print statement to write and get a CSV-file for import into Excel.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

2 followers

Stats

Asked: 2020-04-09 07:19:23 -0500

Seen: 1,780 times

Last updated: Apr 16 '20