Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Python code for interchange between two areas

Trying to extract the interchange between two areas and save it on excel. I have already create the python code, but having a problem with extracting data. I need to make the extract ( cmpval ) data on matrix form so i can save it on excel. here is the code .. please check it out users and help me about regards

import os,sys

PSSEPATH = r'C:\Program Files (x86)\PTI\PSSEUniversity33\PSSBIN' sys.path.append(PSSEPATH) os.environ['PATH'] += ';' + PSSE_PATH

import psspy import redirect

redirect.psse2py() psspy.psseinit(9) psspy.case('C:\Users\user\Desktop\9busnew.sav')

import excelpy x1 = excelpy.workbook() x1.show() x1.setcell('a1', 'FROMAREA/ZONE') x1.setcell('b1', 'TOAREA/ZONE') x1.set_cell('c1', 'Total Change')

code for extracting the interchange between two areas.

ierr, areas = psspy.aareacount(sid = -1, flag = 1) for i in range(areas): for j in range(areas): frarea = i + 1; toarea = j + 1; ierr, cmpval = psspy.aritoj(frarea, toarea) print cmpval

having a problem with cmpval, i need to put in matrix form

x1.set_range(2,'c',zip(cmpval))

code for areas numbers, but still having a problem on puting all the numbers

ierr, Fromarea = psspy.aareaint(-1, 1, 'NUMBER') ierr, toarea = psspy.aareaint(-1, 1, 'NUMBER') Fromarea = Fromarea[0] toarea = toarea[0] x1.setrange(2,'a', zip(Fromarea)) x1.setrange(2,'b', zip(toarea))

Python code for interchange between two areas

Trying to extract the interchange between two areas and save it on excel. I have already create the python code, but having a problem with extracting data. I need to make the extract ( cmpval ) data on matrix form so i can save it on excel. here is the code .. please check it out users and help me about regards

import os,sys

PSSEPATH = r'C:\Program Files (x86)\PTI\PSSEUniversity33\PSSBIN' sys.path.append(PSSEPATH) os.environ['PATH'] += ';' + PSSE_PATH

import psspy import redirect

redirect.psse2py() psspy.psseinit(9) psspy.case('C:\Users\user\Desktop\9busnew.sav')

import excelpy x1 = excelpy.workbook() x1.show() x1.setcell('a1', 'FROMAREA/ZONE') x1.setcell('b1', 'TOAREA/ZONE') x1.set_cell('c1', 'Total Change')

code for extracting the interchange between two areas.

areas. ierr, areas = psspy.aareacount(sid = -1, flag = 1) for i in range(areas): for j in range(areas): frarea = i + 1; toarea = j + 1; ierr, cmpval = psspy.aritoj(frarea, toarea) print cmpval

cmpval having a problem with cmpval, i need to put in matrix form

form x1.set_range(2,'c',zip(cmpval))

code for areas numbers, but still having a problem on puting all the numbers

numbers ierr, Fromarea = psspy.aareaint(-1, 1, 'NUMBER') ierr, toarea = psspy.aareaint(-1, 1, 'NUMBER') Fromarea = Fromarea[0] toarea = toarea[0] x1.setrange(2,'a', zip(Fromarea)) x1.setrange(2,'b', zip(toarea))