Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

PSSE Blown Up Case or Iteriation Limit Exceeded

I'm am trying to run an automation program I made on PSSE. I am pretty much accessing data from an excel sheet and transferring it to PSSE. The code is shown below. Are there any ways to fix this, change settings of program, or any solving method? Any help would be appreciated. The function I am using is psspy.fdns, I need to use fixed slope decoupled Newton Raphson method. And it is shown many times in the code.

from __future__ import print_function
import os.path
import win32com.client

#---------------------------------------------------------------------------------------------------------------------
xlApp = win32com.client.DispatchEx('Excel.Application') # Running Excel
xlsPath = os.path.expanduser('I:\TPGeneral\Ten Year Load Forecasts 2017-2026.xlsm')# Reading xlsm file
wb = xlApp.Workbooks.Open(Filename=xlsPath) # Opening file
xlApp.Run('csvfile4')# Running macro---- csvfile2 is the macro name. It is under the "csv" module in the VBA editor
wb.Save()
xlApp.Quit()
#---------------------------------------------------------------------------------------------------------------------
import os, sys
import psspy
import redirect
import csv
psspy.throwPsseExceptions = True
from Tkinter import *    # File Dialog
import tkFileDialog
import tkSimpleDialog
import tkMessageBox
import Tkinter as tk

LOAD_GEN_DATAFILE = 'I:\TPGeneral\Load_Forecasts.csv' # CSV File to Read
#-------------------------------------------------------------------------------
# read the entire CSV into Python.
# CSV has columns starting with Year,busnum,busname,scaled_power,tla,location
data = list(csv.reader(open(LOAD_GEN_DATAFILE)))
mydict = {}
for row in data:
    Year,busnum,busname,scaled_power,tla,data_location,empty,year_link,from_,to,digit,name2,tla_2,min_value,max_value = row[0:15]


    #If this is a year not seen before, add it to the dictionary
    if Year not in mydict:
        mydict[Year] = {}

    busses_in_year = mydict[Year]
    if data_location not in busses_in_year:
         busses_in_year[data_location] = []


    #Add the bus to the list of busses that stop at this location
    busses_in_year[data_location].append((busnum,busname,scaled_power))
#-------------------------------------------------------------------------------



#-------------------------------------------------------------------------------------------------------------------------------------
#User Input Statement
year = raw_input("Please Select Year of Study: ")
print("\n")
location=raw_input(" \n The list above show the TLA Pockets as well as the ID numbers assigned to them ()\n\n Please enter the ID #: ")
print("\n")
Year=year
data_location=location
#---------------------------------------------------------------------------------------------------------------------------------------

#-------------------------------------------------LOAD FORECASTS--------------------------------------------------------------------
outputs=[]
if Year in mydict and data_location in mydict[Year]:  
    busses_in_year = mydict[Year]
    #print("Here are all the busses at that location for that year and the new LOAD TOTAL: ")
    #print("\n")

    #Busnum, busname,scaled_power read from excel sheet matching year and location

    for busnum,busname,scaled_power in busses_in_year[data_location]:
        scaled_power= float(scaled_power)
        busnum = int(busnum)
        output='Bus #: {}\t Area Station: {}\t New Load Total: {} MW\t'
        formatted = output.format(busnum, busname, scaled_power)
        outputs.append(formatted)
        psspy.bsys(1,0,[0.0,0.0],0,[],1,[busnum],0,[],0,[])
        psspy.scal_2(1,0,1,[0,0,0,0,0],[0.0,0.0,0.0,0.0,0.0,0.0,0.0])
        psspy.scal_2(0,1,2,[0,1,0,1,0],[scaled_power,0.0,0,-.0,0.0,-.0,0])
        #psspy.fdns([0,0,0,0,0,0,0,0])
        #psspy.fdns([1,0,0,0,0,0,0,0])
        #psspy.fdns([1,0,1,0,0,0,0,0])


else:
    exit
psspy.fdns([0,0,0,0,0,0,0,0])
psspy.fdns([1,0,0,0,0,0,0,0])
psspy.fdns([1,0,1,0,0,0,0,0])    
#-------------------------------------------------LOAD FORECASTS--------------------------------------------------------------------

#------------------------------------------------VOLTAGE ENVLOPES---------------------------------------------------------------------------------------------------------------------------------   
outputs_3=[]    
for row in data:
    year_link, from_,to,digit,name2,tla_2,min_value,max_value = row[7:15]
    output = 'From Bus #: {}\tTo Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t'
    if year_link == year and tla_2==location:
        from_=int(from_)
        to=int(to)
        min_value=float(min_value)
        max_value=float(max_value)
        digit=int(digit)
        output = 'From Bus #: {}\tTo Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t'
        formatted_3 = output.format(from_, to,name2, min_value, max_value)
        outputs_3.append(formatted_3)
        _i=psspy.getdefaultint()
        _f=psspy.getdefaultreal()
        psspy.two_winding_chng_4(from_,to,'%d'% digit,[_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f],[])
        psspy.fdns([0,0,0,0,0,0,0,0])
        psspy.fdns([1,0,0,0,0,0,0,0])
        psspy.fdns([1,0,1,0,0,0,0,0])   

    else:
        exit
#psspy.fdns([0,0,1,1,0,0,0,0])        
outputs_2=[]         
for row in data:
     year_link, from_,to,digit,name2,tla_2,min_value,max_value,last_bus = row[7:16]
     if isinstance(last_bus, str) and year_link==year and tla_2==location and last_bus.isdigit() is True:
         min_value=float(min_value)
         max_value=float(max_value)
         from_=int(from_)
         to=int(to)
         last_bus=int(last_bus)
         output = '3 WINDING VOLTAGE ENVELOPE\tFrom Bus #: {}\tTo Bus #: {}\tLast Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t'
         formatted_2 = output.format(from_, to,last_bus,name2, min_value, max_value)
         outputs_2.append(formatted_2)
         _i=psspy.getdefaultint()
         _f=psspy.getdefaultreal()
         psspy.three_wnd_winding_data_3(from_,to, last_bus,r"""1""",1,[_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f])
         psspy.fdns([0,0,0,0,0,0,0,0])
         psspy.fdns([1,0,0,0,0,0,0,0])
         psspy.fdns([1,0,1,0,0,0,0,0])
     else:
         exit         
#------------------------------------------------VOLTAGE ENVLOPES----------------------------------------------------------------------------------------------------------------------------------         
print('\n','---------------LOAD FORECASTS---------------','\n')
s='\n'*2
print(s.join(outputs))
print('\n','---------------2 WINDING VOLTAGE ENVELOPES---------------','\n')
print(s.join(outputs_3))
print('\n')
print(s.join(outputs_2))

os.remove(LOAD_GEN_DATAFILE)

PSSE Blown Up Case or Iteriation Limit Exceeded

I'm am trying to run an automation program I made on PSSE. I am pretty much accessing data from an excel sheet and transferring it to PSSE. The code is shown below. When running this code, I either get a blown up case or an iteration limit exceeded message. Are there any ways to fix this, change settings of program, or any solving method? Any help would be appreciated. The function I am using is psspy.fdns, I need to use fixed slope decoupled Newton Raphson method. And it is shown many times in the code.

from __future__ import print_function
import os.path
import win32com.client

#---------------------------------------------------------------------------------------------------------------------
xlApp = win32com.client.DispatchEx('Excel.Application') # Running Excel
xlsPath = os.path.expanduser('I:\TPGeneral\Ten Year Load Forecasts 2017-2026.xlsm')# Reading xlsm file
wb = xlApp.Workbooks.Open(Filename=xlsPath) # Opening file
xlApp.Run('csvfile4')# Running macro---- csvfile2 is the macro name. It is under the "csv" module in the VBA editor
wb.Save()
xlApp.Quit()
#---------------------------------------------------------------------------------------------------------------------
import os, sys
import psspy
import redirect
import csv
psspy.throwPsseExceptions = True
from Tkinter import *    # File Dialog
import tkFileDialog
import tkSimpleDialog
import tkMessageBox
import Tkinter as tk

LOAD_GEN_DATAFILE = 'I:\TPGeneral\Load_Forecasts.csv' # CSV File to Read
#-------------------------------------------------------------------------------
# read the entire CSV into Python.
# CSV has columns starting with Year,busnum,busname,scaled_power,tla,location
data = list(csv.reader(open(LOAD_GEN_DATAFILE)))
mydict = {}
for row in data:
    Year,busnum,busname,scaled_power,tla,data_location,empty,year_link,from_,to,digit,name2,tla_2,min_value,max_value = row[0:15]


    #If this is a year not seen before, add it to the dictionary
    if Year not in mydict:
        mydict[Year] = {}

    busses_in_year = mydict[Year]
    if data_location not in busses_in_year:
         busses_in_year[data_location] = []


    #Add the bus to the list of busses that stop at this location
    busses_in_year[data_location].append((busnum,busname,scaled_power))
#-------------------------------------------------------------------------------



#-------------------------------------------------------------------------------------------------------------------------------------
#User Input Statement
year = raw_input("Please Select Year of Study: ")
print("\n")
location=raw_input(" \n The list above show the TLA Pockets as well as the ID numbers assigned to them ()\n\n Please enter the ID #: ")
print("\n")
Year=year
data_location=location
#---------------------------------------------------------------------------------------------------------------------------------------

#-------------------------------------------------LOAD FORECASTS--------------------------------------------------------------------
outputs=[]
if Year in mydict and data_location in mydict[Year]:  
    busses_in_year = mydict[Year]
    #print("Here are all the busses at that location for that year and the new LOAD TOTAL: ")
    #print("\n")

    #Busnum, busname,scaled_power read from excel sheet matching year and location

    for busnum,busname,scaled_power in busses_in_year[data_location]:
        scaled_power= float(scaled_power)
        busnum = int(busnum)
        output='Bus #: {}\t Area Station: {}\t New Load Total: {} MW\t'
        formatted = output.format(busnum, busname, scaled_power)
        outputs.append(formatted)
        psspy.bsys(1,0,[0.0,0.0],0,[],1,[busnum],0,[],0,[])
        psspy.scal_2(1,0,1,[0,0,0,0,0],[0.0,0.0,0.0,0.0,0.0,0.0,0.0])
        psspy.scal_2(0,1,2,[0,1,0,1,0],[scaled_power,0.0,0,-.0,0.0,-.0,0])
        #psspy.fdns([0,0,0,0,0,0,0,0])
        #psspy.fdns([1,0,0,0,0,0,0,0])
        #psspy.fdns([1,0,1,0,0,0,0,0])


else:
    exit
psspy.fdns([0,0,0,0,0,0,0,0])
psspy.fdns([1,0,0,0,0,0,0,0])
psspy.fdns([1,0,1,0,0,0,0,0])    
#-------------------------------------------------LOAD FORECASTS--------------------------------------------------------------------

#------------------------------------------------VOLTAGE ENVLOPES---------------------------------------------------------------------------------------------------------------------------------   
outputs_3=[]    
for row in data:
    year_link, from_,to,digit,name2,tla_2,min_value,max_value = row[7:15]
    output = 'From Bus #: {}\tTo Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t'
    if year_link == year and tla_2==location:
        from_=int(from_)
        to=int(to)
        min_value=float(min_value)
        max_value=float(max_value)
        digit=int(digit)
        output = 'From Bus #: {}\tTo Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t'
        formatted_3 = output.format(from_, to,name2, min_value, max_value)
        outputs_3.append(formatted_3)
        _i=psspy.getdefaultint()
        _f=psspy.getdefaultreal()
        psspy.two_winding_chng_4(from_,to,'%d'% digit,[_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f],[])
        psspy.fdns([0,0,0,0,0,0,0,0])
        psspy.fdns([1,0,0,0,0,0,0,0])
        psspy.fdns([1,0,1,0,0,0,0,0])   

    else:
        exit
#psspy.fdns([0,0,1,1,0,0,0,0])        
outputs_2=[]         
for row in data:
     year_link, from_,to,digit,name2,tla_2,min_value,max_value,last_bus = row[7:16]
     if isinstance(last_bus, str) and year_link==year and tla_2==location and last_bus.isdigit() is True:
         min_value=float(min_value)
         max_value=float(max_value)
         from_=int(from_)
         to=int(to)
         last_bus=int(last_bus)
         output = '3 WINDING VOLTAGE ENVELOPE\tFrom Bus #: {}\tTo Bus #: {}\tLast Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t'
         formatted_2 = output.format(from_, to,last_bus,name2, min_value, max_value)
         outputs_2.append(formatted_2)
         _i=psspy.getdefaultint()
         _f=psspy.getdefaultreal()
         psspy.three_wnd_winding_data_3(from_,to, last_bus,r"""1""",1,[_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f])
         psspy.fdns([0,0,0,0,0,0,0,0])
         psspy.fdns([1,0,0,0,0,0,0,0])
         psspy.fdns([1,0,1,0,0,0,0,0])
     else:
         exit         
#------------------------------------------------VOLTAGE ENVLOPES----------------------------------------------------------------------------------------------------------------------------------         
print('\n','---------------LOAD FORECASTS---------------','\n')
s='\n'*2
print(s.join(outputs))
print('\n','---------------2 WINDING VOLTAGE ENVELOPES---------------','\n')
print(s.join(outputs_3))
print('\n')
print(s.join(outputs_2))

os.remove(LOAD_GEN_DATAFILE)