Ask Your Question

DaRobba's profile - activity

2015-11-16 14:21:03 -0500 received badge  Famous Question (source)
2015-11-11 19:17:58 -0500 received badge  Notable Question (source)
2015-11-08 21:28:39 -0500 received badge  Popular Question (source)
2015-11-05 22:18:30 -0500 asked a question PSS/E Plotting

Hi,

I'm looking for help with plotting results from PSSE OUT files. I am aware of the PSSPLT function to plot and save as postscript or PDF files.

I recently installed Python(X,Y) but found that I need to install the PSSE DYNTOOLS library to make some functions possible. Does anyone know how I can go about installing the DYNTOOLS library to Python(X,Y)?

Thanks

2015-01-05 01:02:09 -0500 received badge  Famous Question (source)
2014-11-27 18:53:45 -0500 received badge  Popular Question (source)
2014-11-27 18:53:45 -0500 received badge  Notable Question (source)
2014-11-18 23:07:31 -0500 asked a question Plot multiple PSSE "out" files

Hi,

I recently came across some code that shows how to run PSSE from python and the some tricks with the dyntools module. This is the code.

The code works great but my problem is, instead of entering the name of each out file, is there a way of plotting all the outfiles in a directory?

Thanks.

----------------------------
import os, sys

# =============================================================================================
# Get installed location of latest PSS(R)E version

def latest_psse_location():
    import _winreg
    ptiloc = r"SOFTWARE\PTI"
    ptikey = _w

    inreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, ptiloc, 0, _winreg.KEY_READ)

    ptikeyinfo = _winreg.QueryInfoKey(ptikey)
    numptisubkeys = ptikeyinfo[0]
    vdict = {}
    for i in range(numptisubkeys):
        vernum = _winreg.EnumKey(ptikey, i)
        try:
            n = int(vernum[-2:])
            vdict[n]=vernum
        except:
            pass

    vers = vdict.keys()
    vers.sort()
    k = vers[-1]
    lver = vdict[k]
    lverloc = ptiloc + "\\" + lver + "\\" + "Product Paths"
    lverkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, lverloc, 0, _winreg.KEY_READ)
    lverdir, stype = _winreg.QueryValueEx(lverkey, 'PsseInstallPath')
    _winreg.CloseKey(ptikey)
    _winreg.CloseKey(lverkey)
    return lverdir

pssedir = latest_psse_location()
pssedir = str(pssedir)              # convert unicode to str

# =============================================================================================
# Files Used

pssbindir  = os.path.join(pssedir,'PSSBIN')
exampledir = os.path.join(pssedir,'EXAMPLE')

savfile    = os.path.join(exampledir,'savcnv.sav')
snpfile    = os.path.join(exampledir,'savnw.snp')
outfile1   = os.path.join(exampledir,'bus154_fault.out')
outfile2   = os.path.join(exampledir,'bus3018_gentrip.out')
outfile3   = os.path.join(exampledir,'brn3005_3007_trip.out')
prgfile    = os.path.join(exampledir,'dyntools_demo_progress.txt')

# =============================================================================================
# Check if running from Python Interpreter
exename = sys.executable
p, nx   = os.path.split(exename)
nx      = nx.lower()
if nx in ['python.exe', 'pythonw.exe']:
    os.environ['PATH'] = pssbindir + ';' + os.environ['PATH']
    sys.path.insert(0,pssbindir)

# =============================================================================================

import dyntools

# =============================================================================================
# Run Dynamic simulation on SAVNW to generate .out files

def run_savnw_simulation():
    import redirect
    redirect.psse2py()    
    import psspy
    ierr = psspy.psseinit(buses=80000)  # choose here bus numbers you want

    psspy.lines_per_page_one_device(1,90)
    psspy.progress_output(2,prgfile,[0,0])

    psspy.case(savfile)
    psspy.rstr(snpfile)
    psspy.strt(0,outfile1)
    psspy.run(0, 1.0,1000,1,0)
    psspy.dist_bus_fault(154,1, 230.0,[0.0,-0.2E+10])
    psspy.run(0, 1.05,1000,1,0)
    psspy.dist_clear_fault(1)
    psspy.run(0, 5.0,1000,1,0)

    psspy.case(savfile)
    psspy.rstr(snpfile)
    psspy.strt(0,outfile2)
    psspy.run(0, 1.0,1000,1,0)
    psspy.dist_machine_trip(3018,'1')
    psspy.run(0, 5.0,1000,1,0)

    psspy.case(savfile)
    psspy.rstr(snpfile)
    psspy.strt(0,outfile3)
    psspy.run(0, 1.0,1000,1,0)
    psspy.dist_branch_trip(3005,3007,'1')
    psspy.run(0, 5.0,1000,1,0)

    psspy.lines_per_page_one_device(2,10000000)
    psspy.progress_output(1,"",[0,0])

# =============================================================================================
# 1. Data extraction/information

def test_data_extraction(chnfobj):   
    print '\n Testing call to get_data'
    sh_ttl, ch_id, ch_data = chnfobj.get_data()
    print sh_ttl
    print ch_id

    print '\n Testing call to get_id'
    sh_ttl, ch_id = chnfobj.get_id()
    print sh_ttl
    print ch_id

    print '\n Testing call to get_range'
    ch_range = chnfobj.get_range()
    print ch_range

    print '\n Testing call to get_scale'
    ch_scale = chnfobj.get_scale()
    print ch_scale

    print '\n Testing call to print_scale'
    chnfobj.print_scale()

    print '\n Testing call to txtout'
    chnfobj.txtout(channels=[1,4])

    print '\n Testing call to xlsout'
    chnfobj.xlsout(channels ...
(more)
2014-11-13 07:30:11 -0500 received badge  Famous Question (source)
2014-10-30 15:11:16 -0500 received badge  Notable Question (source)
2014-10-29 18:37:21 -0500 received badge  Popular Question (source)
2014-10-29 08:42:08 -0500 commented answer Plotting PSSE Results

Eli i'm trying to practice using this example here: http://www.whit.com.au/blog/2012/07/matplotlib-and-psse/ But I got the following errors when i ran the script: Traceback (most recent call last): File "C:\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 325,

2014-10-29 08:14:49 -0500 commented answer Plotting PSSE Results

Ignore last message - I got it working!

2014-10-29 08:10:56 -0500 answered a question Plotting PSSE Results

Thanks Eli, i actually didnt see the exe files!

Downloaded it and executed the application - all I get now if a mouse cursor that flashes. My machine is 32bit so its the right installer. When I look in task manager it just shows the installer moving up and down in Processes.

Its not installing.

2014-10-29 06:44:45 -0500 received badge  Nice Question (source)
2014-10-29 03:39:25 -0500 received badge  Student (source)
2014-10-29 00:58:27 -0500 answered a question Plotting PSSE Results

Hi Eli,

Appreciate your response thank you.

Am using Python2.7 (not sure how to use the commands you provided but I just opened up Python and got the version number).

I did see the links you've provided but it didn't provide a step by step guide on how to install. Please forgive me as my experience is absolutely minimal to zero wrt python and any other plotting tool.

Thanks and much appreciated.

2014-10-28 22:55:58 -0500 asked a question Plotting PSSE Results

Hi

How do I get started plotting PSSE results in a "nice" way. I hear Matplotlib and numpy can be used but I have no idea how to install these and have looked around for an explanation. I have python installed as I am running python scripts from PSSE.

Could someone point me in the right direction?

Regards,