Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Help update data in PSSE by Python 2.7 get data from excel file.

Hi all I want to update data of Bus in PSSE by Python 2.7, get data from excel. My code: import os, sys PYTHONPATH = r'C:\Program Files (x86)\PTI\PSSE33\PSSBIN' sys.path.append(PYTHONPATH) os.environ['PATH'] += ';' + PYTHONPATH import psspy psspy.throwPsseExceptions = True import redirect redirect.psse2py() psspy.psseinit(1000) psspy.case(r'C:\Users\ngoclq\Desktop\TEST PYTHON\QNPC.sav') import xlrd busexcellocation = "C:/Users/ngoclq/Desktop/TEST PYTHON/Bus.xlsx" bus= xlrd.openworkbook(busexcellocation) bussheet= bus.sheetbyindex(0) bussheet.cellvalue(0,0) bussheet.nrows bussheet.ncols

intgar=[0, 0, 0, 0] realar=[0, 0, 0, 0, 0, 0, 0] for k in range(1,bussheet.nrows): intgar[0]=bussheet.cellvalue(k,9) intgar[1]=bussheet.cellvalue(k,3)
intgar[2]=bussheet.cellvalue(k,5) intgar[3]=bussheet.cellvalue(k,7)
realar[0]=bussheet.cellvalue(k,2) realar[1]=bussheet.cellvalue(k,10) realar[2]=bussheet.cellvalue(k,11) realar[3]=bussheet.cellvalue(k,12) realar[4]=bussheet.cellvalue(k,13) realar[5]=bussheet.cellvalue(k,14) realar[6]=bussheet.cellvalue(k,15) i=bussheet.cellvalue(k,0) name=bussheet.cellvalue(k,1) ierr=psspy.busdata_3(i,intgar,realar,name)

Please help me show any error on that code and how to run python file .py to update data of bus as data on my excel file Tks for helps.

Help update data in PSSE by Python 2.7 get data from excel file.

Hi all I want to update data of Bus in PSSE by Python 2.7, get data from excel. My code: code:

import os, sys PYTHONPATH = r'C:\Program Files (x86)\PTI\PSSE33\PSSBIN' sys.path.append(PYTHONPATH) os.environ['PATH'] += ';' + PYTHONPATH import psspy psspy.throwPsseExceptions = True import redirect redirect.psse2py() psspy.psseinit(1000) psspy.case(r'C:\Users\ngoclq\Desktop\TEST PYTHON\QNPC.sav') PYTHON\QNPC.sav')

import xlrd busexcellocation = "C:/Users/ngoclq/Desktop/TEST PYTHON/Bus.xlsx" bus= xlrd.openworkbook(busexcellocation) bussheet= bus.sheetbyindex(0) bussheet.cellvalue(0,0) bussheet.nrows bussheet.ncols

intgar=[0, 0, 0, 0] realar=[0, 0, 0, 0, 0, 0, 0] for k in range(1,bussheet.nrows): range(1,bussheet.nrows):

intgar[0]=bussheet.cell_value(k,9)
intgar[1]=bussheet.cell_value(k,3)  intgar[0]=bussheet.cellvalue(k,9)
 intgar[1]=bussheet.cellvalue(k,3) 
intgar[2]=bussheet.cellvalue(k,5) intgar[3]=bussheet.cellvalue(k,7)
realar[0]=bussheet.cellvalue(k,2) realar[1]=bussheet.cellvalue(k,10) realar[2]=bussheet.cellvalue(k,11) realar[3]=bussheet.cellvalue(k,12) realar[4]=bussheet.cellvalue(k,13) realar[5]=bussheet.cellvalue(k,14) realar[6]=bussheet.cellvalue(k,15) i=bussheet.cellvalue(k,0) name=bussheet.cellvalue(k,1) ierr=psspy.busdata_3(i,intgar,realar,name)

intgar[2]=bussheet.cell_value(k,5) intgar[3]=bussheet.cell_value(k,7) realar[0]=bussheet.cell_value(k,2) realar[1]=bussheet.cell_value(k,10) realar[2]=bussheet.cell_value(k,11) realar[3]=bussheet.cell_value(k,12) realar[4]=bussheet.cell_value(k,13) realar[5]=bussheet.cell_value(k,14) realar[6]=bussheet.cell_value(k,15) i=bussheet.cell_value(k,0) name=bussheet.cell_value(k,1) ierr=psspy.bus_data_3(i,intgar,realar,name)

Please help me show any error on that code and how to run python file .py to update data of bus as data on my excel file Tks for helps.

Help update data in PSSE by Python 2.7 get data from excel file.

Hi all I want to update data of Bus in PSSE by Python 2.7, get data from excel. My code:

code: import os, sys PYTHONPATH = r'C:\Program Files (x86)\PTI\PSSE33\PSSBIN' sys.path.append(PYTHONPATH) os.environ['PATH'] += ';' + PYTHONPATH import psspy psspy.throwPsseExceptions = True import redirect redirect.psse2py() psspy.psseinit(1000) psspy.case(r'C:\Users\ngoclq\Desktop\TEST PYTHON\QNPC.sav')

PYTHON\QNPC.sav') import xlrd busexcellocation = "C:/Users/ngoclq/Desktop/TEST PYTHON/Bus.xlsx" bus= xlrd.openworkbook(busexcellocation) bussheet= bus.sheetbyindex(0) bussheet.cellvalue(0,0) bussheet.nrows bussheet.ncols

intgar=[0, 0, 0, 0] realar=[0, 0, 0, 0, 0, 0, 0] for k in range(1,bussheet.nrows):range(1,bussheet.nrows): intgar[0]=bussheet.cellvalue(k,9) intgar[1]=bussheet.cellvalue(k,3)
intgar[2]=bussheet.cellvalue(k,5) intgar[3]=bussheet.cellvalue(k,7)
realar[0]=bussheet.cellvalue(k,2) realar[1]=bussheet.cellvalue(k,10) realar[2]=bussheet.cellvalue(k,11) realar[3]=bussheet.cellvalue(k,12) realar[4]=bussheet.cellvalue(k,13) realar[5]=bussheet.cellvalue(k,14) realar[6]=bussheet.cellvalue(k,15) i=bussheet.cellvalue(k,0) name=bussheet.cellvalue(k,1) ierr=psspy.busdata_3(i,intgar,realar,name)

intgar[0]=bussheet.cell_value(k,9)
intgar[1]=bussheet.cell_value(k,3)           
intgar[2]=bussheet.cell_value(k,5)
intgar[3]=bussheet.cell_value(k,7) 

realar[0]=bussheet.cell_value(k,2)
realar[1]=bussheet.cell_value(k,10)
realar[2]=bussheet.cell_value(k,11)
realar[3]=bussheet.cell_value(k,12)
realar[4]=bussheet.cell_value(k,13)
realar[5]=bussheet.cell_value(k,14)
realar[6]=bussheet.cell_value(k,15)

i=bussheet.cell_value(k,0)

name=bussheet.cell_value(k,1)

ierr=psspy.bus_data_3(i,intgar,realar,name)

Please help me show any error on that code and how to run python file .py to update data of bus as data on my excel file Tks for helps.

click to hide/show revision 4
No.4 Revision

Help update data in PSSE by Python 2.7 get data from excel file.

Hi all I want to update data of Bus in PSSE by Python 2.7, get data from excel. My code: code:

import os, sys
PYTHONPATH = r'C:\Program Files (x86)\PTI\PSSE33\PSSBIN'
sys.path.append(PYTHONPATH)
os.environ['PATH'] += ';' + PYTHONPATH
import psspy
psspy.throwPsseExceptions = True
import redirect
redirect.psse2py()
psspy.psseinit(1000)
psspy.case(r'C:\Users\ngoclq\Desktop\TEST PYTHON\QNPC.sav')
import xlrd
busexcellocation bus_excel_location = "C:/Users/ngoclq/Desktop/TEST PYTHON/Bus.xlsx" 
bus= xlrd.openworkbook(busexcellocation)
xlrd.open_workbook(bus_excel_location)
bussheet= bus.sheetbyindex(0) 
bussheet.cellvalue(0,0)
bus.sheet_by_index(0) 
bussheet.cell_value(0,0)
bussheet.nrows
bussheet.ncols

bussheet.ncols intgar=[0, 0, 0, 0] realar=[0, 0, 0, 0, 0, 0, 0] for k in range(1,bussheet.nrows): intgar[0]=bussheet.cellvalue(k,9) intgar[1]=bussheet.cellvalue(k,3)
intgar[2]=bussheet.cellvalue(k,5) intgar[3]=bussheet.cellvalue(k,7)
realar[0]=bussheet.cellvalue(k,2) realar[1]=bussheet.cellvalue(k,10) realar[2]=bussheet.cellvalue(k,11) realar[3]=bussheet.cellvalue(k,12) realar[4]=bussheet.cellvalue(k,13) realar[5]=bussheet.cellvalue(k,14) realar[6]=bussheet.cellvalue(k,15) i=bussheet.cellvalue(k,0) name=bussheet.cellvalue(k,1) ierr=psspy.busdata_3(i,intgar,realar,name)

intgar[0]=bussheet.cell_value(k,9) intgar[1]=bussheet.cell_value(k,3) intgar[2]=bussheet.cell_value(k,5) intgar[3]=bussheet.cell_value(k,7) realar[0]=bussheet.cell_value(k,2) realar[1]=bussheet.cell_value(k,10) realar[2]=bussheet.cell_value(k,11) realar[3]=bussheet.cell_value(k,12) realar[4]=bussheet.cell_value(k,13) realar[5]=bussheet.cell_value(k,14) realar[6]=bussheet.cell_value(k,15) i=bussheet.cell_value(k,0) name=bussheet.cell_value(k,1) ierr=psspy.bus_data_3(i,intgar,realar,name)

Please help me show any error on that code and how to run python file .py to update data of bus as data on my excel file Tks for helps.