First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
    |  1 |    initial version    |  
The following python code will check the Q-limit state of a machine:
def maclimits(ibus,id):
ierr, q    = psspy.macdat(ibus, id, 'Q')
ierr, qmax = psspy.macdat(ibus, id, 'QMAX')
ierr, qmin = psspy.macdat(ibus, id, 'QMIN')
answer = 0              #machine is within reactive limits
if   q >= qmax:
     answer = 1     #machine hits upper reactive limit
elif q <= qmin:
     answer = -1    #machine hits lower reactive limit
return answer           
#usage, having savnw loaded in PSSe:
qlimit = maclimits(3018,'1')
print qlimit
     |  2 |    No.2 Revision    |  
The following python code will check the Q-limit state of a machine:
def maclimits(ibus,id):
 ierr, q    = psspy.macdat(ibus, id, 'Q')
 ierr, qmax = psspy.macdat(ibus, id, 'QMAX')
 ierr, qmin = psspy.macdat(ibus, id, 'QMIN')
 answer = 0               #machine is within reactive limits
 if   q >= qmax:
      answer = 1      #machine hits upper reactive limit
 elif q <= qmin:
      answer = -1   #machine hits lower reactive limit
 return answer          
#usage, having savnw loaded in PSSe:
qlimit = maclimits(3018,'1')
print qlimit
 
 
                
                whit loves you.      Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.