Ask Your Question

LDale's profile - activity

2013-12-31 22:20:48 -0500 received badge  Student (source)
2013-12-30 18:58:29 -0500 received badge  Famous Question (source)
2013-12-09 12:31:46 -0500 received badge  Notable Question (source)
2013-12-08 01:09:15 -0500 received badge  Popular Question (source)
2013-12-06 05:10:47 -0500 asked a question Can't open .sav file

I'm just starting with psspy. I want to open a .sav file, modify the P and Q of the load, run a load flow, and read the results. Here's the code:

import os
import sys
import pdb

PSSE_PATH = "C:/Program Files/PTI/PSSE33/PSSBIN"
File_Path = "C:/Users/LD0FA74N/Documents/PSSEScripts"

sys.path.append(PSSE_PATH)
os.environ['PATH'] += PSSE_PATH + ';' 

sys.path.append(File_Path)
os.environ['PATH'] += File_Path + ';' 


import psspy
import pssarrays
import redirect


workingfile = "C:/Users/LD0FA74N/Documents/PSSEScripts/test2diagram.sav"

psspy.psseinit(10000)
_i=psspy.getdefaultint()
_f=psspy.getdefaultreal()
_s=psspy.getdefaultchar()

redirect.psse2py()

flatstart = 1

busnum = 1401

Pload = 90 # from 10 to 100

Qload = 20 # from -40 to 60

psspy.case(workingfile)

psspy.load_chng_4(busnum,r"""1""",[_i,_i,_i,_i,_i,_i],[ Pload,_f,_f,_f,_f,_f])

psspy.load_chng_4(busnum,r"""1""",[_i,_i,_i,_i,_i,_i],[_f, Qload,_f,_f,_f,_f])

psspy.fnsl([1,0,0,1,1,flatstart,99,0])

psspy.save(workingfile)

voltages = psspy.abusreal(sid=-1, string="PU")
buses = psspy.abusint(sid=-1, string="NUMBER")

print voltages
print buses

I get the following error message:

Invalid file type. C:/Users/LD0FA74N/Documents/PSSEScripts/test2diagram.sav (OpnAppFil/OPNPTI).

I know that PSSE can read .sav files, so I assume there's a problem finding the file, but I've appended the PSSE and the .sav directories to both the system path and the path environmental variables, so I don't know where this could be coming from.

What does redirect.psse2py() do? I've tried with and without this line but the error message is the same. What is the difference between the system path and the environmental path variables? Any help would be much appreciated!