Get Q of fictious generator, QV curve
Hi, folks. I am trying to do multiple QV analyses and wirte data to csv file. Data contain Vsetpoint and Q of fictious generator, write along columns. But when I used:
ierr, cval = psspy.notona(node)
rlst = pssarrays.qv_solution(qvfile1, colabel)
v = rlst.vsetpoint
q = (rlst.mgenmvar)
I got q with size (199*length(v)) more bigger than what I expected (1 * length(v)). All of my monitored buses in .mon file are type 1, so I just don't know why it is so big. Is there anyway to get q of fictious generator contacted with the interested bus in those data or just an simpler way to get direct Q without relating to rlst.mgenmvar.
Also, I got an error message when try to do second interation. It is TypeError: 'float' object is not iterable in
for row,vol in zip(rows,V):
row.append(vol)
for row,mvar in zip(rows,Q):
rows.append(mvar)
Here is my code( I edited from code in https://psspy.org/psse-help-forum/que...).
# created by: Waltter Valdez
import sys, os
sys.path.insert(0, r"C:\Program Files\PTI\PSSE33\PSSBIN")
# xx --> substitute xx with Version Number here.
os.environ['PATH'] = r"C:\Program Files\PTI\PSSE33\PSSBIN" + ";" + os.environ['PATH']
#import redirect
#redirect.psse2py()
# this redirects PSS(R)E progress, report output to Python Shell/Console
import psspy
_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()
_s = psspy.getdefaultchar()
import pssarrays
#import matplotlib.pyplot as plt
import csv
psspy.psseinit(50000)
Ruta = os.getcwd()
cases = ('savnw','')
"""Do not remove the single quotes from the end, these allow you to use the
python even a single scenario """
archSub = Ruta + '\\' + 'savnw.sub'
archMon = Ruta + '\\' + 'savnw.mon'
archCon = Ruta + '\\' + 'savnw.con'
nodes = (153,154)
"""# Nodes must be entered in the numbers of the buses in which
you want to get the QV curves"""
#psspy.progress_output(2, 'reportePro', [2, 0])
# Create cases and QV governor
for caseN in cases:
if caseN != '':
carpeta = Ruta + '\\' + caseN
if not os.path.isdir(carpeta):
os.makedirs(carpeta)
case = Ruta + '\\' + caseN + '.sav'
Difaxx = carpeta + '\\' + 'Difaxx-' + caseN + '.dfx'
progress = carpeta + '\\' + 'progress_' + caseN + '.txt'
psspy.progress_output(2, progress, [2, 0])
psspy.case(case)
psspy.fnsl([1, 0, 0, 1, 1, 0, 0, 0])
psspy.dfax([1, 1], archSub, archMon, archCon, Difaxx)
rows=[]
count=0
for node in nodes:
count+=1
psspy.case(case)
node1 = str(node)
archivoqv = carpeta + '\\' + 'QV_' + node1
ierr2 = psspy.qv_engine_4([0, 0, 0, 0, 0, 0, 1, 1, 0, 1, node, 0, 0],
[0.5, 1.05, 0.5, 0.01],"",Difaxx,"","",archivoqv,"")
if ierr2 != 0:
continue
# Change these values as required.
qvfile = 'QV_' + node1 + ".qv"
qvfile1 = carpeta + '\\''QV_' + node1 + ".qv"
Q=['Q(MVAr))']
V=['V'+'_'+str(node)]
Contingencies = pssarrays.qv_summary(qvfile1).colabel
colabel=Contingencies[0]
ierr, cval = psspy.notona(node)
rlst = pssarrays.qv_solution(qvfile1, colabel)
v = rlst.vsetpoint
q = rlst.mgenmvar
Q.extend(q)
V.extend(v)
if count==1:
rows=[]
for q,v in zip(Q,V):
row=[q]
row.extend([v])
rows.append(row)
else:
for ...
I changed another code from https://psspy.org/psse-help-forum/question/341/will-this-generate-a-qv-curve/ and It worked well. Thank Jervis. Still want to know how to get varlist by qv_solution.