First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
To my knowledge QV Analysis is performed on one bus at a time. Although you could loop the analysis across multiple buses. I suppose this is why you would typically have a sheet for each bus. In regards to MVARReserve and Vmincollapse... Not sure what you are after. The QV Analysis puts an infinite dynamic reactive source on the bus, and all other reactive devices must be switched out or locked. Anyhow, here is some code that might help:
def GetQVSolution(studybus,dfxfile,qvfile,mismatchtol,vhighsetpoint,vlowsetpoint,adjtaps,adjpsts,adjswshunts):
qverrdict = {0: 'NO ERROR',
1: 'INVALID VALUES VALUE',
2: 'INVALID OPTIONS VALUE',
3: 'GENERATORS ARE CONVERTED',
4: 'BUSES IN ISLAND(S) WITHOUT A SWING BUS; USE ACTIVITY TREE',
5: 'LARGEST MISMATCH EXCEEDS MISMATCH TOLERANCE',
6: 'VHI IS NOT GREATER THAN VLO',
7: 'STUDY BUS NOT FOUND',
8: 'SWShunt Not Locked Or Gen Controlling?',
9: 'ERROR WHEN ADDING A PLANT TO THE STUDY BUS',
10: 'ERROR WHEN ADDING A MACHINE TO THE STUDY BUS',
11: 'BASE CASE VHI SOLUTION DID NOT CONVERGE',
12: 'NO DISTRIBUTION FACTOR DATA FILE SPECIFIED',
13: 'NO Q-V SOLUTION OUTPUT FILE SPECIFIED',
14: 'NO ZIP ARCHIVE OUTPUT FILE SPECIFIED',
15: 'IN-SERVICE INDUCTION MACHINES ARE IN THE STALLED OR TRIPPED STATE',
16: 'BUS TYPE CODE AND SERIES ELEMENT STATUS INCONSISTENCIES',
17: 'NO DISPATCH SUBSYSTEM IS SPECIFIED',
18: 'MORE THAN 10 ISLANDS IN THE BASE CASE',
21: 'FILE DFXFILE IS NOT IN THE FORM OF A PSSE-25 OR LATER DFAX FILE; RUN DFAX',
22: 'MONITORED ELEMENTS EXCEED LIMIT WHEN ADDING MULTISECTION LINE MEMBERS',
23: 'NO SUBSYSTEMS DEFINED',
24: 'SUBSYSTEM NOT FOUND',
51: 'ERROR OPENING QV RESULTS FILE',
52: 'ERROR OPENING DISTRIBUTION FACTOR DATA FILE',
53: 'ERROR OPENING LOAD THROWOVER DATA FILE',
54: 'ERROR OPENING INERTIA AND GOVERNOR RESPONSE DATA FILE',
55: 'ERROR OPENING ZIP ARCHIVE OUTPUT FILE',
56: 'PREREQUISITE REQUIREMENTS FOR API ARE NOT MET',
99: 'TERMINATED BY USER INTERRUPT OR FILE ERROR'}
#QV OPTIONS ----------------------------------------------------------------
a=adjtaps # tap adjustment flag
b=0 # area interchange adjustment flag
c=adjpsts # phase shifter adjustment flag
d=1 # dc tap adjustment flag
e=adjswshunts # switched shunt adjustment flag(0,1,2-Enable Continuous Only)
f=0 # induction motor treatment flag
g=0 # non-divergent solution flag
h=0 # solution method flag (0-Fixed Slope, 1-Full Newton, 2-Optimized Fixed Slope)
i=0 # var limit for the VHI solution (0-Apply Immediately, 1-Ignore then Apply)
j=0 # var limit code for subsequent solutons (0-Apply Immediately, 1-Ignore then Apply)
k=studybus # Study Bus Number (Input to this Function)
l=0 # dispatch mode for power imbalances resulting from the application of contingencies
m=0 # Zip archive flag
A=mismatchtol # mismatch tolerance in MW and Mvar
B=vhighsetpoint # per unit initial (maximum) setpoint voltage for study bus
C=vlowsetpoint # per unit minimum setpoint voltage for study bus
D=0.01 # per unit voltage setpoint decrement
qverr=psspy.qv_engine_4([a,b,c,d,e,f,g,h,i,j,k,l,m],[A,B,C,D],'',dfxfile,'','',qvfile,'')
errordesc=qverrdict[qverr]
return qverr,errordesc
2 | No.2 Revision |
To my knowledge QV Analysis is performed on one bus at a time. Although you could loop the analysis across multiple buses. I suppose this is why you would typically have a sheet for each bus. In regards to MVARReserve and Vmincollapse... Not sure what you are after. The QV Analysis puts an infinite dynamic reactive source on the bus, and all other reactive devices must be switched out or locked. Anyhow, here is some code that might help:
def GetQVSolution(studybus,dfxfile,qvfile,mismatchtol,vhighsetpoint,vlowsetpoint,adjtaps,adjpsts,adjswshunts):
qverrdict = {0: 'NO ERROR',
1: 'INVALID VALUES VALUE',
2: 'INVALID OPTIONS VALUE',
3: 'GENERATORS ARE CONVERTED',
4: 'BUSES IN ISLAND(S) WITHOUT A SWING BUS; USE ACTIVITY TREE',
5: 'LARGEST MISMATCH EXCEEDS MISMATCH TOLERANCE',
6: 'VHI IS NOT GREATER THAN VLO',
7: 'STUDY BUS NOT FOUND',
8: 'SWShunt Not Locked Or Gen Controlling?',
9: 'ERROR WHEN ADDING A PLANT TO THE STUDY BUS',
10: 'ERROR WHEN ADDING A MACHINE TO THE STUDY BUS',
11: 'BASE CASE VHI SOLUTION DID NOT CONVERGE',
12: 'NO DISTRIBUTION FACTOR DATA FILE SPECIFIED',
13: 'NO Q-V SOLUTION OUTPUT FILE SPECIFIED',
14: 'NO ZIP ARCHIVE OUTPUT FILE SPECIFIED',
15: 'IN-SERVICE INDUCTION MACHINES ARE IN THE STALLED OR TRIPPED STATE',
16: 'BUS TYPE CODE AND SERIES ELEMENT STATUS INCONSISTENCIES',
17: 'NO DISPATCH SUBSYSTEM IS SPECIFIED',
18: 'MORE THAN 10 ISLANDS IN THE BASE CASE',
21: 'FILE DFXFILE IS NOT IN THE FORM OF A PSSE-25 OR LATER DFAX FILE; RUN DFAX',
22: 'MONITORED ELEMENTS EXCEED LIMIT WHEN ADDING MULTISECTION LINE MEMBERS',
23: 'NO SUBSYSTEMS DEFINED',
24: 'SUBSYSTEM NOT FOUND',
51: 'ERROR OPENING QV RESULTS FILE',
52: 'ERROR OPENING DISTRIBUTION FACTOR DATA FILE',
53: 'ERROR OPENING LOAD THROWOVER DATA FILE',
54: 'ERROR OPENING INERTIA AND GOVERNOR RESPONSE DATA FILE',
55: 'ERROR OPENING ZIP ARCHIVE OUTPUT FILE',
56: 'PREREQUISITE REQUIREMENTS FOR API ARE NOT MET',
99: 'TERMINATED BY USER INTERRUPT OR FILE ERROR'}
#QV OPTIONS ----------------------------------------------------------------
a=adjtaps # tap adjustment flag
b=0 # area interchange adjustment flag
c=adjpsts # phase shifter adjustment flag
d=1 # dc tap adjustment flag
e=adjswshunts # switched shunt adjustment flag(0,1,2-Enable Continuous Only)
f=0 # induction motor treatment flag
g=0 # non-divergent solution flag
h=0 # solution method flag (0-Fixed Slope, 1-Full Newton, 2-Optimized Fixed Slope)
i=0 # var limit for the VHI solution (0-Apply Immediately, 1-Ignore then Apply)
j=0 # var limit code for subsequent solutons (0-Apply Immediately, 1-Ignore then Apply)
k=studybus # Study Bus Number (Input to this Function)
l=0 # dispatch mode for power imbalances resulting from the application of contingencies
m=0 # Zip archive flag
A=mismatchtol # mismatch tolerance in MW and Mvar
B=vhighsetpoint # per unit initial (maximum) setpoint voltage for study bus
C=vlowsetpoint # per unit minimum setpoint voltage for study bus
D=0.01 # per unit voltage setpoint decrement
qverr=psspy.qv_engine_4([a,b,c,d,e,f,g,h,i,j,k,l,m],[A,B,C,D],'',dfxfile,'','',qvfile,'')
errordesc=qverrdict[qverr]
return qverr,errordesc