Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think I have the hang of the thing now:

import os,sys
import operator

PSSE_LOCATION = r"C:\Program Files\PTI\PSSE32\PSSBIN"
sys.path.append(PSSE_LOCATION)
os.environ['PATH'] = os.environ['PATH'] + ';' +  PSSE_LOCATION 

import psspy
import redirect
redirect.psse2py()
psspy.throwPsseExceptions = True

#--------------------------------
# PSS/E Saved case
casename = "12TH_PLAN_MAR_2017R1.sav"
CASE = os.path.join(os.path.abspath(dir[0]), casename)
psspy.psseinit(12000)
psspy.case(CASE)

busid = 44121
subfile = r"qvcase.sub"
f = open(subfile, "w+")
f.write("subsystem ABC\njoin group\nzone 44\nkvrange 100.0 300.\nend\nend\nend\n")
f.close()

monfile = r"qvcase.mon"
f = open(monfile, "w+")
f.write("monitor voltage range subsystem ABC 0.9\nend\n")
f.close()

confile = r"qvcase.con"
f = open(confile, "w+")
f.write("single line from bus %s\nend\nend\n" % busid)
f.close()

dfxfile = r"qvcase.dfx"
options = []
options.append(1) # 1-calculate distribution factors
options.append(1) # 1-sort monitored elements 
ierr = psspy.dfax(options, subfile, monfile, confile, dfxfile)

options = []
values  = []
options.append(0) # 0-disable tap adjustment
options.append(0) # 0-disable using tie line flows
options.append(0) # 0-disable phase shift adjustment
options.append(0) # 0-disable dc tap adjustment
options.append(0) # 0-disable switched shunt adjustment
options.append(1) # 1-enable non-divergent solution
options.append(0) # 0-FDNS
options.append(1) # 1-initially ignore: var limit code for the VHI power flow sol
options.append(0) # 
options.append(busid) # study bus number (no default allowed)
values.append(0.1) # Newton solution convergence tolerance, TOLN
values.append(1.1) # the initial (max) pu voltage setpoint at the study bus (VHI)
values.append(0.9) # the minimum pu voltage setpoint at the study bus (VLO)
values.append(0.01) # the pu voltage setpoint decrement (positive) 
ierr = psspy.qv_engine(options, values, dfxfile, accfile=r"test.qv")

I think I have the hang of the thing now:

import os,sys
import operator

PSSE_LOCATION = r"C:\Program Files\PTI\PSSE32\PSSBIN"
sys.path.append(PSSE_LOCATION)
os.environ['PATH'] = os.environ['PATH'] + ';' +  PSSE_LOCATION 

import psspy
import redirect
redirect.psse2py()
psspy.throwPsseExceptions = True

#--------------------------------
# PSS/E Saved case
casename = "12TH_PLAN_MAR_2017R1.sav"
"MY_SYSTEM.sav"
CASE = os.path.join(os.path.abspath(dir[0]), casename)
psspy.psseinit(12000)
psspy.case(CASE)

busid = 44121
subfile = r"qvcase.sub"
f = open(subfile, "w+")
f.write("subsystem ABC\njoin group\nzone 44\nkvrange 100.0 300.\nend\nend\nend\n")
f.close()

monfile = r"qvcase.mon"
f = open(monfile, "w+")
f.write("monitor voltage range subsystem ABC 0.9\nend\n")
f.close()

confile = r"qvcase.con"
f = open(confile, "w+")
f.write("single line from bus %s\nend\nend\n" % busid)
f.close()

dfxfile = r"qvcase.dfx"
options = []
options.append(1) # 1-calculate distribution factors
options.append(1) # 1-sort monitored elements 
ierr = psspy.dfax(options, subfile, monfile, confile, dfxfile)

options = []
values  = []
options.append(0) # 0-disable tap adjustment
options.append(0) # 0-disable using tie line flows
options.append(0) # 0-disable phase shift adjustment
options.append(0) # 0-disable dc tap adjustment
options.append(0) # 0-disable switched shunt adjustment
options.append(1) # 1-enable non-divergent solution
options.append(0) # 0-FDNS
options.append(1) # 1-initially ignore: var limit code for the VHI power flow sol
options.append(0) # 
options.append(busid) # study bus number (no default allowed)
values.append(0.1) # Newton solution convergence tolerance, TOLN
values.append(1.1) # the initial (max) pu voltage setpoint at the study bus (VHI)
values.append(0.9) # the minimum pu voltage setpoint at the study bus (VLO)
values.append(0.01) # the pu voltage setpoint decrement (positive) 
ierr = psspy.qv_engine(options, values, dfxfile, accfile=r"test.qv")