Ask Your Question

jsexauer's profile - activity

2019-05-06 11:02:57 -0500 received badge  Great Question (source)
2017-05-23 09:24:46 -0500 received badge  Nice Answer (source)
2015-01-26 13:28:54 -0500 received badge  Taxonomist
2014-06-09 09:35:40 -0500 edited answer Can someone please share the IEEE 9 bus system data, including generator and load data.

IEEE 9-bus in PSSe v.33 raw format:

 0,    100.00, 33, 0, 0, 60.00       / October 01, 2013 15:59:49

IEEE 9 Bus Systems - 3 generators, 9 buses and 3 loads

Western System Coordinating Council (WSCC) 3-Machines 9-Bus system

    1,'Bus1        ',  16.5000,3,   1,   1,   1,1.04000,   0.0000

    2,'Bus 2       ',  18.0000,2,   1,   1,   1,1.02500,   9.3507

    3,'Bus 3       ',  13.8000,2,   1,   1,   1,1.02500,   5.1420

    4,'Bus 4       ', 230.0000,1,   1,   1,   1,1.02531,  -2.2174

    5,'Bus 5       ', 230.0000,1,   1,   1,   1,0.99972,  -3.6802

    6,'Bus 6       ', 230.0000,1,   1,   1,   1,1.01225,  -3.5666

    7,'Bus 7       ', 230.0000,1,   1,   1,   1,1.02683,   3.7961

    8,'Bus 8       ', 230.0000,1,   1,   1,   1,1.01727,   1.3373

    9,'Bus 9       ', 230.0000,1,   1,   1,   1,1.03269,   2.4448

0 / END OF BUS DATA, BEGIN LOAD DATA

    5,'1 ',1,   1,   1,   125.000,    50.000,     0.000,     0.000,     0.000,    -0.000,   1,1

    6,'1 ',1,   1,   1,    90.000,    30.000,     0.000,     0.000,     0.000,    -0.000,   1,1

    8,'1 ',1,   1,   1,   100.000,    35.000,     0.000,     0.000,     0.000,    -0.000,   1,1

0 / END OF LOAD DATA, BEGIN FIXED SHUNT DATA

0 / END OF FIXED SHUNT DATA, BEGIN GENERATOR DATA

    1,'1 ',    71.627,    27.915,  9900.0, -9900.0,1.04,    0,   500.0,   0.0,   1.0,   0.0, 0.0, 1.0,1,  100.0,   450.000,     0.000,   1,1.0000,   0,1.0000,   0,1.0000,   0,1.0000,0, 1.0000

    2,'1 ',   163.000,     4.903,  9900.000, -9900.000,1.02500,    0,   250.000,   0.00000,   1.00000,   0.00000,   0.00000,1.00000,1,  100.0,   240.000,     0.000,   1,1.0000,   0,1.0000,   0,1.0000,   0,1.0000,0, 1.0000

    3,'1 ',    85.000,   -11.449,  9900.000, -9900.000,1.02500,    0,   100.000,   0.00000,   1.00000,   0.00000,   0.00000,1.00000,1,  100.0,    90.000,     0.000,   1,1.0000,   0,1.0000,   0,1.0000,   0,1.0000,0, 1.0000

0 / END OF GENERATOR DATA, BEGIN BRANCH DATA

    5,     4,'1 ', 0.01000, 0.06800,0.17600,   0.00,   0.00,   0.00,  0.00000,  0.00000,  0.00000,  0.00000,1,1,   0.0,   1,1.0000,   0,1.0000,   0,1.0000,   0,1.0000

    6,     4,'1 ', 0.01700, 0.09200,0.15800,   0.00,   0.00,   0.00,  0.00000,  0.00000,  0.00000,  0.00000,1,1,   0.0,   1,1.0000,   0,1.0000,   0,1.0000,   0,1.0000

    7,     5,'1 ', 0.03200, 0.16100,0.30600,   0.00,   0.00,   0.00,  0.00000,  0.00000,  0.00000,  0.00000,1,1,   0.0,   1,1.0000,   0,1.0000 ...
(more)
2014-06-04 10:29:40 -0500 edited question How to interrupt loads below a given bus voltage threshold in PSS\E using python

How can I interrupt loads at a bus when the voltage is below a given threshold in PSS\E using python during dynamic simulations? The load is then reconnected back after a certain period of time. Below is a sample of the code that I am trying to develop. Let me know if there’s a better way to do it or how I can make this code to work.

#Check the bus voltages that are higher than 1.1 p.u and lower than 0.9 p.u
psspy.set_vltscn(1,1.1,0.9)

#Run a command which interrupts loads if the voltage is below 0.9 p.u by changing the status of the load model from in service to out of service
for n in range(1,20):  # list of bus numbers
if psspy.set_vltscn(1,1.1,0.9) < 0.9: # if voltage is below 0.9
   psspy.ldmod_status2(i,'id',1,0)   # interrupt load at that bus. Where i is bus number, 'id' is the load identifier, 1 is the load model type and 0 is the new model status indicating out of service

#Run to 1 second
psspy.run(0,1,1000,1,0)

#Reconnect the load after a certain period of time (1 sec in this case)
psspy.ldmod_status2(i,'id',1,1)

 #Run to 10 seconds
psspy.run(0,10,1000,1,0)

 # Halt pss\e
  psspy.pssehalt_2()
2014-05-29 14:42:06 -0500 edited question importing psspy module in a python sript

I use the code

import os,sys

PSSE_LOCATION = r"D:\COMPONENTE_LOGICA\PSSE\PSSE30\PSSBIN"

sys.path.append(PSSE_LOCATION)

os.environ['PATH'] = os.environ['PATH'] + ';' +  PSSE_LOCATION 

import psspy

And I get this:

Traceback (most recent call last): File "<console>", line 1, in <module> File ".\psspy.py", line 56, in <module> ImportError: DLL load failed: it is not a valid win32 program

I checkeed the PSSE bin folder and I could not find a psspy.dll. There is a psspyc.pyd. Is the psspy.dll missing? Where can I get one?

2014-04-09 14:04:00 -0500 commented answer Is there any way to export to excel LOSSES of all the branches of a system?

good catch, thanks

2014-04-07 09:12:05 -0500 commented question Generator internal voltage, retrieve

Not sure there's a way to directly grab it using the API, but you could use the API to pull I, Zsource, and Vbus and calculate E, if that would suit your purposes.

2014-04-07 09:05:14 -0500 commented answer Is there any way to export to excel LOSSES of all the branches of a system?

Edited answer to save results to a file, output.csv

2014-04-07 09:04:55 -0500 edited answer Is there any way to export to excel LOSSES of all the branches of a system?

This will do what you're looking for. Refer to chapter 8 Subsystem Data Retrieval, specifically the bit on Branch Flow data, for more info. Keep in mind the "-1" subsystem is the entire case.

ierr, loss = psspy.aflowreal(-1, 2, 1, 1, 'PLOSS')
ierr, toBus = psspy.aflowint(-1, 2, 1, 1, 'TONUMBER')
ierr, fromBus = psspy.aflowint(-1, 2, 1, 1, 'FROMNUMBER')
ierr, brnID = psspy.aflowchar(-1, 2, 1, 1, 'ID')

csv = 'ToBus, FromBus, ID, PLOSS\n'
for fields in zip(toBus[0], fromBus[0], brnID[0],loss[0]):
    csv += ','.join(map(str,fields)) + '\n'
print csv
with open('output.csv','w') as f:
    f.write(csv)
2014-04-02 18:49:11 -0500 received badge  Good Answer (source)
2014-03-31 13:42:13 -0500 commented question Genetic Algorithm - Python

If you can dream it, it can be done... Do you have a more specific question?

2014-03-19 14:43:41 -0500 commented question How to correct a blown up case in PSSE?

Correcting a blown up case is more art than science. If possible, you should try to flat start the case. If that isn't possible, try to get the case back to some kind of state where it last worked and then use very wide Q limits on your gen to nudge the case to the correct solution.

2014-02-13 11:44:36 -0500 commented answer tkinter from inside PSSE

Is PowerFactory an addon to PSSE or a competitive product?

2014-02-03 12:47:32 -0500 answered a question Reading PSSE output files (*.dat) and saving in a useful format (CSV)

In a bit of a hurry, so probably didn't make this as clear as I could have. I also took some liberties in assuming your data is fixed width, as your sample was. Let me know if you have any questions.

current_branch = None
data = []
# Read data
with open("data.txt") as f:
    for l in f:
        if l[:11] == "SENSITIVITY":
            current_branch = l[44:88]
        elif l[:2] == "<-":
            continue
        elif len(l) > 2:
            assert current_branch is not None
            data.append( [l[:20], current_branch, l[20:]] )

# Strip out white space
data = [map(lambda x: x.strip(), l) for l in data]

# Create lines
data = [','.join(l) for l in data]

# Display file
print '\n'.join(data)

Output:

10000 LA    275.00,10000 LA    275.00 TO  20000 NY    275.00 1,0.1041
20000 NY    275.00,10000 LA    275.00 TO  20000 NY    275.00 1,-0.7613
30000 WDC   275.00,10000 LA    275.00 TO  20000 NY    275.00 1,-0.2254
40000 SF    275.00,10000 LA    275.00 TO  20000 NY    275.00 1,-0.2254
50000 AZ    275.00,10000 LA    275.00 TO  20000 NY    275.00 1,-0.2144
20000 NY    275.00,40000 SF    275.00 TO  50000 AZ    275.00 1,0.7613
30000 WDC   275.00,40000 SF    275.00 TO  50000 AZ    275.00 1,0.2254
40000 SF    275.00,40000 SF    275.00 TO  50000 AZ    275.00 1,0.2254
50000 AZ    275.00,40000 SF    275.00 TO  50000 AZ    275.00 1,0.2144
10000 LA    275.00,40000 SF    275.00 TO  60000 PD    275.00 1,0.1613
30000 WDC   275.00,40000 SF    275.00 TO  60000 PD    275.00 1,0.3254
40000 SF    275.00,40000 SF    275.00 TO  60000 PD    275.00 1,0.1540
50000 AZ    275.00,40000 SF    275.00 TO  60000 PD    275.00 1,0.3244
2014-01-22 01:23:51 -0500 received badge  Famous Question (source)
2014-01-10 14:08:13 -0500 commented answer tkinter from inside PSSE

Promising start at least... I can't think of a way to bring the data back though for the life of me :(

2014-01-09 09:51:47 -0500 commented answer tkinter from inside PSSE

Cool idea. But how would data from the external sever come back inside of PSSE? If you come up with something, I hope you'll post a gist for it!

2014-01-02 09:41:35 -0500 commented answer Can't open .sav file

FYI, technically you should use `os.pathsep` (ie, `os.environ['PATH'] += os.pathsep + PSSE_PATH` )

2013-12-31 22:03:10 -0500 received badge  Self-Learner (source)
2013-12-31 22:03:10 -0500 received badge  Necromancer (source)
2013-12-30 07:31:26 -0500 answered a question tkinter from inside PSSE

I contacted PTI regarding this issue and they gave me the follow advise for how to handle this in WX. I haven't tried it out yet, but hopefully it will work:

  1. Derive main program frame from wx.Dialog:

    Override ProcessClosedMainPanel:

    a. Call EndModal with the ID_CANCEL result

    b. Call app.Exit()

  2. Derive an App class from wx.App:

    Override RunApp:

    a. Instantiate your dlg class

    b. Set to top window

    c. Call ShowModal

    d. del dlg (on return from show modal)

  3. In Main function:

    a. Instantiate your app class

    b. Call RunApp

2013-12-17 08:58:14 -0500 received badge  Enlightened (source)
2013-12-17 08:58:14 -0500 received badge  Good Answer (source)
2013-12-16 13:57:22 -0500 commented question how to solve the problem for converting *.exe?

Not sure there is a way to convert a PSSE referencing psspy to an exe because you would somehow have to package PSSE into your application.

2013-12-04 08:39:17 -0500 received badge  Famous Question (source)
2013-10-21 07:13:38 -0500 commented answer Error running PSSE from Python

Are you using Spyder as part of the WinPython toolset by any chance? It could be the version of python Spyder is using and the version of python that you launched when opening the interpreter are different.

2013-10-18 15:07:16 -0500 commented question Error running PSSE from Python

Looks like you're doing it right. I just wanted to make sure you were using `psspy.psseinit()`. Although I would try a bigger value than 5, although I wouldn't think this would cause the issue you're seeing.

2013-10-18 11:16:08 -0500 commented question Error running PSSE from Python

How are you initializing the solution engine?

2013-09-28 02:45:39 -0500 received badge  Nice Answer (source)
2013-09-25 14:23:45 -0500 answered a question How to deal with unicode strings - PSS/e 33, Python 2.7, and wxPython

I have never heard of this problem, but just shooing from the hip, I think this will solve your problem. This creates a decorator which inspects all the inputs to calls to functions in the dyntools module and takes those which are unicode and converts them to strings.

import types
def UnicodeToStrDecorator(psseFunc):
    def callPsseFunc(*args, **kwargs):
        newArgs = []
        newKwargs = {}
        # Sanitize args and kwargs for unicode
        for a in args:
            if type(a) is unicode:
                newArgs.append(str(a))
            else:
                newArgs.append(a)

        for k, v in kwargs.items():
            if type(v) is unicode:
                newKwargs[k] = str(v)
            else:
                newKwargs[k] = v

        # Call origional psse function with new, sanitized arguments
        return psseFunc(*newArgs, **newKwargs)
    return callPsseFunc

import dyntools, psse_env_manager 

# Apply decorator the dyntools module
for k,v in vars(dyntools).items():
    if isinstance(v, types.FunctionType):
        vars(dyntools)[k] = UnicodeToStrDecorator(v)

# Apply decorator to psse_env_manager module
for k,v in vars(psse_env_manager).items():
    if isinstance(v, types.FunctionType):
        vars(psse_env_manager)[k] = UnicodeToStrDecorator(v)
2013-09-18 07:29:38 -0500 answered a question PSS/E Rev 33 - psspy.py UnicodeWarning

You can run your program and cause warning to be raised as exceptions by doing the following:

python -W error program.py

alternately, put this at the top of your code:

import warnings    
warnings.simplefilter("error")

That way a nice stack trace is generated and you can see which call(s) are causing the problem.

Refer to the warnings documentation for more details, including how your could just suppress printing the warnings if you find that's the best way to resolve your problem.

2013-09-16 15:13:32 -0500 commented answer Raise psspy ierr as python exception

That is awesome @EBahr! Is that functionality documented anywhere? I feel like there is so much in psspy, but so little of it written down...

2013-09-16 15:09:47 -0500 answered a question Change custom tool?

Unfortunately, the answer @amaity gives only works in version 32 so far as I know.

To create custom toolbar buttons in version 30, you have to edit an ini file located at C:\WINDOWS\psse30.ini. Per the documentation in section 2.17.2 of the user's manual (page 2-92), commands look like this:

[Custom Definitions]
CUSTOM_BUTTON_1 = PYTHON,'C:\Program Files\PTI\PSSE30\EXAMPLE\OpenCase.py','(tooltip text) Open
savnw network and diagram '
CUSTOM_BUTTON_2 = RESPONSE,'C:\Program
Files\PTI\PSSE30\EXAMPLE\RunSolutAndReport.idv','Run solution and report'
2013-09-11 00:51:08 -0500 received badge  Nice Answer (source)
2013-09-10 11:22:04 -0500 received badge  Notable Question (source)
2013-09-05 16:16:52 -0500 received badge  Good Question (source)
2013-09-05 16:15:58 -0500 received badge  Popular Question (source)
2013-09-05 09:25:13 -0500 commented question Can PSSE be used for CT sizing?

@amaity Thanks, much clearer. Using PSSE for dynamics is outside of my area of expertise, hopefully someone else can help you.

2013-09-04 09:18:39 -0500 commented question Can PSSE be used for CT sizing?

PSSE cannot be directly used for this purpose. However, you could set up a power flow and use the values it generates to help size the CT. Can you be more specific regarding what info you're looking for?

2013-09-03 20:08:00 -0500 received badge  Nice Question (source)