2023-09-29 00:12:18 -0500
| received badge | ● Student
(source)
|
2022-12-13 20:03:10 -0500
| received badge | ● Enthusiast
|
2022-06-01 09:34:28 -0500
| answered a question | Run PSS/E from Jupyter Notebook Make sure that you use python 2.7 intepreter on your Jupyter Notebook. |
2017-07-18 21:15:38 -0500
| answered a question | QV Analysis Automation Script You can refer to this link This is my modification: # created by: Waltter Valdez
# Source: https://psspy.org/psse-help-forum/question/444/what-is-the-api-for-generating-the-qv-files/
# Modified by: ays
# Sebaiknya aplikasi excel di-save atau ditutup terlebih dahulu agar tidak terjadi error
# ========================================================== FILE BASECASE ==========================================================
kasus = ('1PM - 20160816 TAHUN 2017-apb', '')
# ========================================================== FILE BASECASE ==========================================================
# ============================================================ NOMOR BUS ============================================================
nobus = (25056, 25072, 25052, 25064, 25901, 25164, 25028, 25054, 25094, 25096)
# ============================================================ NOMOR BUS ============================================================
import sys
import os
sys.path.insert(0, r"C:\Program Files (x86)\PTI\PSSE33\PSSBIN")
# xx --> substitute xx with Version Number here.
os.environ['PATH'] = r"C:\Program Files (x86)\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)
kerja = 'D:\\PLN\\PSSE\\STUDI\\QV'
os.chdir(kerja)
archSub = kerja + '\\' + 'ALL.sub'
archMon = kerja + '\\' + 'ALL.mon'
archCon = kerja + '\\' + 'ALL.con'
import pssexcel
psspy.progress_output(2, 'LaporanPro', [2, 0])
# Crea kasus y QV por gobernador
for kasusN in kasus:
if kasusN != '':
gelar = kerja + '\\' + kasusN
if not os.path.isdir(gelar):
os.makedirs(gelar)
kes = kerja + '\\' + kasusN + '.sav'
Difaxx = gelar + '\\' + 'ALL-' + kasusN + '.dfx'
progres = gelar + '\\' + 'Progres_' + kasusN + '.txt'
psspy.progress_output(2, progres, [2, 0])
#zeroz = gelar + '\\' + 'Error_' + kasusN + '.txt'
#psspy.report_output(islct=2, filarg=zeroz, options=[0])
psspy.case(kes)
# psspy.branch_data(27371, 27372, r"""1""",
# [_i, _i, _i, _i, _i, _i], [0.1E-05, _f, _f, _f, _f, _f, _f, _f,
# _f, _f, _f, _f, _f, _f, _f])
"""Do it if you have Zero branch..."""
psspy.fdns([2,0,0,1,1,1,-1,0])
psspy.fdns([2,0,0,1,1,1,99,0])
psspy.fdns([2,0,0,1,1,0,99,0])
psspy.fdns([2,0,0,1,1,0,99,0])
psspy.dfax([1, 1], archSub, archMon, archCon, Difaxx)
for nod in nobus:
nod1 = str(nod)
archivoqv = gelar + '\\' + 'QV_' + nod1
ierr2 = psspy.qv_engine([0, 0, 0, 0, 0, 0, 1, 0, 0, nod],
[0.5, 1.1, 0.8, 0.01], Difaxx, "", archivoqv)
if ierr2 != 0:
continue
qvfile = 'QV_' + nod1 + ".qv"
qvfile1 = gelar + '\\''QV_' + nod1 + ".qv"
Kontingensi = pssarrays.qv_summary(qvfile1).colabel
reserva = ["Daya Reaktif (Mvars)"]
Contingency = ["Kontingensi"]
plt.cla()
ierr, cval = psspy.notona(nod)
for colabel in Kontingensi:
rlst = pssarrays.qv_solution(qvfile1, colabel)
v = rlst.vsetpoint
q = rlst.mgenmvar
Contingency.append(colabel)
reserva.append(min(rlst.mgenmvar)[0])
plt.plot(v, q)
pssexcel.qv(qvfile=gelar + '\\' + qvfile, string=['s', 'v', 'm', 'g'], colabel='', namesplit=True, xlsfile=gelar + '\\''QV_' + nod1, sheet='', overwritesheet=True, show=False)
pssexcel.qv(qvfile=gelar + '\\' + qvfile, string=['g'], colabel='', namesplit=True, xlsfile=gelar + '\\''QV_' + kasusN, sheet=nod1, overwritesheet=True, show=False)
# C:\Program Files(x86)\PTI\PSSE33\DOCS\API.pdf
# String = ['s','m','v','g']
# 's' or 'summary' QV Solution Summary
# 'v' or 'voltage' Monitored Bus Voltage
# 'm' or 'mismatch' Largest and Total Mismatch
# 'g' or 'generator' Monitored Plants MW and MVAR
plt.legend(Kontingensi, loc='upper right')
plt.title(qvfile[0:-3] + "_" + cval[0:-7 ... (more) |
2016-12-08 16:37:58 -0500
| received badge | ● Famous Question
(source)
|
2016-11-30 18:11:12 -0500
| received badge | ● Notable Question
(source)
|
2016-11-28 00:52:55 -0500
| received badge | ● Popular Question
(source)
|
2016-11-22 21:01:55 -0500
| commented answer | How to get MW and MVAR on psspy.aloadcplx and How to kill excel on Task Manager i'm sorry, myscript a = np.real(bload) and b = np.imag(bload) are okey.
I made a mistake when I change ierr,bload = psspy.aloadreal(flag=1,string=['MVANOM']) and not undo to aloadcplx.
Go to next issue about kicking excel on task manager.
some body can give me tips and trick? |
2016-11-22 12:49:49 -0500
| commented answer | How to get MW and MVAR on psspy.aloadcplx and How to kill excel on Task Manager I try add this code:
import numpy as np
....
a = np.real(bload)
b = np.imag(bload)
and the result "a" is MVA and "b" is zero
I need more clue |
2016-11-22 09:07:12 -0500
| asked a question | How to get MW and MVAR on psspy.aloadcplx and How to kill excel on Task Manager I have the following script: # get data loading branches, buses voltage, loads and machines.
import sys
import os
sys.path.insert(0, r"C:\Program Files (x86)\PTI\PSSE33\PSSBIN")
# xx --> substitute xx with Version Number here.
os.environ['PATH'] = r"C:\Program Files (x86)\PTI\PSSE33\PSSBIN" + ";" + os.environ['PATH']
import redirect
redirect.psse2py()
# this redirects PSS(R)E progress, report output to Python Shell/Console
import psspy
psspy.psseinit(50000)
kerja = 'D:\\DATA'
kasus = ('2018_1a.sav')
kes = kerja + '\\' + kasus
psspy.case(kes)
psspy.fdns([2,0,0,1,1,0,99,0])
#Branch
ierr,busnum = psspy.abrnint(flag=4,entry=2,string=['FROMNUMBER','TONUMBER'])
ierr,ckt = psspy.abrnchar(flag=4,entry=2,string='ID')
ierr,loading = psspy.abrnreal(flag=4,entry=2,string=['P','Q','PCTRATEA'])
#Trafo
# ierr,trbusnum = psspy.atrnint(string=['FROMNUMBER','TONUMBER'])
# ierr,trckt = psspy.atrnchar(string='ID')
# ierr,trloading = psspy.atrnreal(string=['P','Q','PCTRATEA'])
#Bus
ierr,bus = psspy.abusint(string='NUMBER')
ierr,name = psspy.abuschar(string='NAME')
ierr,volt = psspy.abusreal(string='KV')
#Load
ierr,bnum = psspy.aloadint(flag=1,string='NUMBER')
ierr,bname = psspy.aloadchar(flag=1,string='NAME')
ierr,bload = psspy.aloadcplx(flag=1,string=['MVANOM'])
#Machine
ierr,machnum = psspy.amachint(flag=4,string='NUMBER')
ierr,machname = psspy.amachchar(flag=4,string='NAME')
ierr,machload = psspy.amachreal(flag=4,string=['PGEN','QGEN'])
print 'Tahap 1 Run PSSE'
# x=len(trbusnum)
# print ('X = ' + str(x))
import excelpy
# create a Excel workbook for writing
xlobj = excelpy.workbook()
#=======================================
import pythoncom
import win32com
xl = win32com.client.Dispatch("Excel.Application")
# write header
xlobj.set_range(1,'b',['From bus','To bus','ID','MW','MVAr','PCTRATEA'])
xlobj.set_range(1,'i',['NUMBER','NAME','KV'])
xlobj.set_range(1,'m',['BNUM','BNAME','BLOAD'])
xlobj.set_range(1,'q',['MACHNUM','MACHNAME','PGEN','QGEN'])
# write data
xlobj.set_range(2,'b',zip(*busnum))
xlobj.set_range(2,'d',zip(*ckt))
xlobj.set_range(2,'e',zip(*loading))
xlobj.set_range(2,'i',zip(*bus))
xlobj.set_range(2,'j',zip(*name))
xlobj.set_range(2,'k',zip(*volt))
xlobj.set_range(2,'m',zip(*bnum))
xlobj.set_range(2,'n',zip(*bname))
xlobj.set_range(2,'o',zip(*bload))
xlobj.set_range(2,'q',zip(*machnum))
xlobj.set_range(2,'r',zip(*machname))
xlobj.set_range(2,'s',zip(*machload))
print 'Tahap 2 Olah Data di Excel'
# save workbook
import win32com
xl = win32com.client.Dispatch("Excel.Application")
xl.DisplayAlerts = False
xlobj.save(kerja + '\\' + 'scen1bfull.xlsx')
xl.DisplayAlerts = True
print 'Tahap 3 Save Data ke Excel'
# Cek Aplikasi Excel ada yang terbuka atau tidak
#=====================================================
try:
xl.Quit() #quit excel, as if user hit the close button/clicked file->exit.
wb = xl.ActiveWorkbook #Source https://mail.python.org/pipermail/python-win32/2011-August/011738.html
xl.Visible = 0
xl = None
del xl
del wb
except:
raise TypeError('Simpan dan Tutup File Excel atau End Task Ms Excel di Task Manager --> Background Process')
print 'Selesai'
pythoncom.CoUninitialize()
When I run this script, I got an error: Tahap 1 Run PSSE
Traceback (most recent call last):
File "D:/DATA/myscript.py", line 75, in <module>
xlobj.set_range(2,'o',zip(*bload))
File ".\excelpy ... (more) |
2016-10-21 02:31:25 -0500
| received badge | ● Scholar
(source)
|
2016-10-21 02:30:38 -0500
| commented answer | Mvar Annotation on diagram view |
2016-10-20 21:41:46 -0500
| commented answer | Mvar Annotation on diagram view If possible, the python arguments can work as like as on summation label, so I can get the summation of reactive power generation (fixed and switched) from some bus. |
2016-10-20 21:35:22 -0500
| commented answer | Mvar Annotation on diagram view Thanks so much perolofl to show the way how to customize the report respectively to slider diagram.
There are some issue, in those script it show the nominal install capacity of fixed and switched shunt, what I need is the summation value of generating MVAr of fixed and switched shunt.
Continue... |
2016-10-14 17:05:52 -0500
| received badge | ● Notable Question
(source)
|
2016-10-14 17:05:52 -0500
| received badge | ● Famous Question
(source)
|
2016-10-14 17:05:52 -0500
| received badge | ● Popular Question
(source)
|
2016-10-13 01:49:10 -0500
| received badge | ● Editor
(source)
|
2016-10-13 01:47:54 -0500
| asked a question | Mvar Annotation on diagram view Hello, I want to made report for Mvar generation from a single or multiple Capacitor (Fixed or Switched Shunt) at some bus show on digram .sld view.
I tried use summation text "BL,+,110" only show bus load, and also when using "GN,+,110" it is not working since the bus code is 1, change bus code to 2, still not working.
When using report node with pssgrpg.pyc there are only option to showing total result of system, area, and zone. Please help me how to create the python script to show the Mvar of capacitor on sld view. Thanks,
ays |