Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
#List of generatorts for investigation:
Gen=[[bus1,id1],
     [bus2,id2],
     [bus3,id3]] #and so on

#Loop through all generators:
for g in Gen:

  bus=g[0]
  id=g[1]

  #remember initial generation:
  e1, Pold = psspy.macdat(bus, id, 'P')

  #getting generator Pmax:
  e2, Pmax = psspy.macdat(bus, id, 'PMAX')

  #changing generation to Pmax
  e3 = psspy.machine_data_2(bus,id,[_i,_i,_i,_i,_i,_i],[Pmax,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f])

  e4 = psspy.fnsl() #solving

  #some code here - doing something, output results, etc.
  #...

  #restore initial generation:
  e5 = psspy.machine_data_2(bus,id,[_i,_i,_i,_i,_i,_i],[Pold,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f]) 

  e6 = psspy.fnsl() #solving again

  if (e1+e2+e3+e4+e5+e6)!=0: print "got some errors ! ",g