Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It can be done in the GUI:

  1. Select a transformer in the 2 Winding spreadsheet
  2. Ctrl-c to copy the data to the clipboard
  3. Click the first column on the empty last line
  4. Ctrl-v to paste the data.
  5. Change the id from e.g. 1 to 2
  6. Press enter to exit edit mode

A transformer can be duplicated in python in the following way:

  1. Write raw data for the subsystem consisting of ibus and jbus
  2. Change id of existing transformer
  3. Read raw data files with existing transformer

The python code:

import os

def duplicate_transformer(ibus,jbus,ickt='1',ickt2='2'):
    """ Duplicates 2W transformer ickt between ibus and jbus
    """
    rdcfile = 'copy_transformer_dummy_file'
    # Write data for existing transformer to raw data files
    psspy.bsys(11,0,[0.0,0.0],0,[],2,[ibus,jbus],0,[],0,[])
    psspy.rawd_2(11,0,[1,1,1,0,0,0,2],0,rdcfile+'.rac')
    psspy.rwsq_2(11,0,[1,1,1,1,1],0,rdcfile+'.seq')
    # Change id of existing transformer
    psspy.mbidbrn(ibus,jbus,ickt,ickt2)
    # Read raw data files with existing transformer
    psspy.rdch(0,rdcfile+'.rac')
    psspy.resq(rdcfile+'.seq')
    # Delete raw data files
    os.remove(rdcfile+'.rac')
    os.remove(rdcfile+'.seq')

# Duplicate transformer in savnw network
duplicate_transformer(152,153,'1','2')