First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
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.loadchng4(busnum,r"""1""",[i,i,i,i,i,i],[ Pload,f,f,f,f,_f])
psspy.loadchng4(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!
2 | No.2 Revision |
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
import os
import sys
import pdb
PSSE_PATH = "C:/Program sys.path.append(PSSE_PATH)
sys.path.append(File_Path)
import psspy
import pssarrays
import redirect
psspy.psseinit(10000)
_i=psspy.getdefaultint()
_f=psspy.getdefaultreal()
_s=psspy.getdefaultchar()
redirect.psse2py()
psspy.case(workingfile)
psspy.loadchng4(busnum,r"""1""",[i,i,i,i,i,i],[ Pload,f,f,f,f,_f])
psspy.loadchng4(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)
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!