Ask Your Question

Transmission Impossible's profile - activity

2016-06-09 06:24:18 -0500 commented answer Get names of buses in correct order.

Nice solution! Didn't think of that. Requires some work around, but it's clever =)

2016-06-09 01:37:04 -0500 received badge  Famous Question (source)
2016-06-06 06:02:52 -0500 received badge  Notable Question (source)
2016-06-06 06:02:52 -0500 received badge  Popular Question (source)
2016-06-03 02:35:48 -0500 received badge  Associate Editor (source)
2016-06-03 02:08:26 -0500 asked a question Get names of buses in correct order.

To get the names of buses, I create a subsystem consisting of the buses I want, using psspy.bsys, then I use abuschar to get the bus names, like this:

psspy.bsys(1,0,[ 0.69, 400.],0,[],1,[buses],0,[],0,[])
ierr, carray = psspy.abuschar(1,2,'NAME')

This gives me the names in the order they are listed in PSS/E. What I want is to get the names of the buses, sorted in the same order as my list buses.

My solution has been to make multiple subsystems, and call abuschar several times. Is there a way to avoid this?

nodes = [1,2,3,10,4]

for x in range(0,len(nodes)):
   psspy.bsys(x,0,[ 0.69, 400.],0,[],1,[nodes[x]],0,[],0,[])

   ierr, carray = psspy.abuschar(x,2,'NAME')   
   names[x] = carray[0][0].strip()
2016-05-09 21:12:32 -0500 marked best answer Dynamic simulations using Python

I've been following an example from the PSSE "Program Application Guide" to run a dynamic simulation where a fault is initialized and cleared.

I now want to do similar simulations from Python not PSSE, but I can't figure out how to do it.

The example goes as follows:

  1. Steady state initialization (t < 0-)
  2. 3-phase fault at bus 200, large admittance to ground (t < 0.1s)
  3. Fault clearance (zero admittance to ground), branch 100-200 is out. (t < 3s)

I have very limited knowledge about both PSSE and Python, so any tips and tricks (best practice) would be most welcome!

What is the correct way of creating faults? The equivalent of ALTR in PSSE? How can I plot the results afterwards? (Choose channels etc. etc.)

The (unfinished) code I have now is included below. It's plain to see that it's no good, but I don't what the correct way to do it is. Also, I don't know how to check if it works (besides noting that I don't get errors).

import os,sys
PYTHONPATH = r'C:\Program Files (x86)\PTI\PSSE32\PSSBIN'
MODELFOLDER = r'C:\Program Files (x86)\PTI\PSSE32\MODELDRW'

sys.path.append(PYTHONPATH)
os.environ['PATH'] += ';' + PYTHONPATH
## Numpy of matplotlib maa lastes ned for aa brukes:
## http://www.whit.com.au/blog/python-libraries-for-psse-python-training/

# import numpy as np
# import matplotlib.pyplot as plt
import psspy
import redirect
import dyntools

# Redirect output from PSSE to Python:
redirect.psse2py()

# Last case:
CASE = r"C:\Program Files (x86)\PTI\PSSE32\EXAMPLE\savnw.sav"
psspy.psseinit(12000)
psspy.case(CASE)

ierr = psspy.dyre_add(dyrefile="C:\Program Files (x86)\PTI\PSSE32\EXAMPLE\savnw.dyr")
ierr = psspy.rstr("C:\Program Files (x86)\PTI\PSSE32\EXAMPLE\savnw.snp")
# Convert generators:
ierr = psspy.cong()
# Convert loads:
ierr, rlods = psspy.conl(all=1,apiopt=2, status1=0, loadin1=100,loadin2=0, loadin3 = 0, loadin4 = 100)

ierr = psspy.fact()
ierr = psspy.strt(outfile="C:\Program Files (x86)\PTI\PSSE32\EXAMPLE\python_test.out")

Btw, the complete path name is written, because it can't find the files if I don't.

2015-10-07 05:32:47 -0500 commented question Automated Simulations in PSSE

What type of simulations?

2015-09-21 07:53:48 -0500 received badge  Famous Question (source)
2015-09-17 09:49:07 -0500 received badge  Notable Question (source)
2015-09-15 03:52:14 -0500 received badge  Popular Question (source)
2015-09-13 09:41:44 -0500 commented answer Stop power flow calculations and recover solution if model blows up

Thanks for answering jconto! Awesome solution =) I updated my question with the exact code I ended up using, for future reference.

2015-09-13 07:03:34 -0500 asked a question Stop power flow calculations and recover solution if model blows up

Is it possible to create an Automation File (in Python) that tries to run a normal FNSL power flow, but stops, and retrieve original case if the mismatch becomes too large?

The pseudo code of what I want is:

run fnsl
if absolute mismatch > 1   # or some other appropriate value
    abort fnsl
    print error message: "The power flow blew up". 
    recover previous power flow results
stop

At the moment, I have to load the .sav case every time my model blows up (which is often). It's cumbersome, and time demanding. I'm doing a lot of manual changes and don't need to store the results, so I don't want to create new .sav-files for every change and load flow I run.

I appreciate any help!

EDIT

One of the things I do a lot of is trying to disconnect different combinations of lines.

  1. Run power flow
  2. Disconnect line 1 - Run power flow, OK?
  3. Disconnect line 2 - Run power flow, OK?
  4. Disconnect line 3 - Run power flow. Not OK!
  5. Connect line 1, disconnect line 6. Run power flow, OK?
  6. Connect line 3, disconnect line 7. Run power flow, Not OK!
  7. Connect line 2 and 6. Run power flow, OK?
  8. Turn of generator. Run power flow, OK?
  9. ... and so on ...

What I want is to make changes in the GUI (in PSS/E), run an automation file that executes fnsl and aborts and restore model if it doesn't converge. I'd prefer not to save the model every time I make a minor adjustment.

Final result (thanks to jconto):

ierr = psspy.save('temp.sav')
if ierr > 0:
    print "Couldn't save temp-file"

ierr = psspy.fnsl()
if ierr == 3:
    print "Nodes without swing bus. API: tree() may help"
elif ierr != 0:
    print "Power flow failed."

ierr = psspy.solved()
if ierr > 0:
    psspy.case('temp.sav')
else:
    print "Power flow reached convergence"
2015-08-04 10:33:10 -0500 received badge  Famous Question (source)
2015-06-08 07:35:03 -0500 edited question Short circuit current as function of distance from bus

I want to plot how the short circuit current (L-G) decays, as a function of the distance from a bus. That is, assuming a radial topology, the short circuit will be lower if the fault occurs at the end of a line, instead of the end.

image description (Figure 10.4 in POM)

I can run SCMU to create the faults, like this:

psspy.scmu(1,[0,0,0,0,0,0,0],[0.0,0.0,0.0,0.0,0.0],"")      # Need to run this first        
psspy.scmu(2,[9,54193,54223,1,1,0,0],[0.0,0.0,0.0,0.0, 0.05],r"""1""")   # Fault 5% from 54193
psspy.scmu(3,[9,54193,54223,1,1,0,0],[0.0,0.0,0.0,0.0, 0.05],r"""1""")   # Clear fault

Now, it's fairly simple to run this in a loop where I change the distance from 54193 from 0.05 to 0.95. My problem is, I don't know how the results are stored and how I can access them. I'm assuming I have to use SCOP, but I'm not exactly sure how. I don't find it in POM or API. Does anyone know how I can do this?

2015-05-29 06:14:49 -0500 received badge  Critic (source)
2015-05-05 04:37:50 -0500 commented question p.u. to MW

This is a tad unclear. Could you try to elaborate? What are you plotting, what type of plot, etc.?

2015-04-14 03:16:21 -0500 received badge  Notable Question (source)
2015-04-10 06:44:07 -0500 received badge  Popular Question (source)
2015-04-07 03:44:51 -0500 asked a question Unable to enter correct vector group for three-winding transformer

I have a transformer with vector group: YNyn0d11. The HV-side is solidly grounded, while the MV-winding is ungrounded. I can use a vector group YNyn0d11, but that would give a solidly grounded MV-winding. I tried entering very high RG2 and XG2 values, but those where reverted to 0. If I try to make the transformer YNy0d11 PSS/E refuses to recognize it.

Does anyone know how I can enter the correct values here?

Thanks in advance!

2015-03-19 08:16:22 -0500 received badge  Popular Question (source)
2015-03-19 08:16:22 -0500 received badge  Famous Question (source)
2015-03-19 08:16:22 -0500 received badge  Notable Question (source)
2015-03-10 05:07:05 -0500 asked a question How to find the line-ground current contribution from one branch?

I want to calculate the zero sequence charging capacitance based on known ground current contributions. That is, I know that some line A, B and C contribute 50A, 30A, and 10A respectively. Based on this, I want to enter the charging capacitance. My problem is that I can't figure out how to do this properly.

From literature, the equation for line-ground current in an isolated network is: If = Va*3*j*w*C / (1 + 3*j*w*C*R), where R is close to zero, thus |If| = Va*3*w*C. However, using the same B-value for different lines gives very different currents. It's even dependent on which side of the line the fault occurs.

Suppose I have the simple network below. If I try a simple line-ground fault at bus 3, with the dashed line out of service, I get a contribution I0 = 42.2A from bus 2. However, if I take the other vertical line and try a line-ground fault at bus 2, I get a contribution I0 = 31.2A from bus 3. I really don't see why this is.

Anyone know that might cause this, and how I can find the correct B-value? I use psspy.scmu to find the currents.

image description

2015-03-09 10:36:06 -0500 received badge  Famous Question (source)
2015-03-03 07:53:30 -0500 received badge  Famous Question (source)
2015-02-24 02:29:23 -0500 received badge  Notable Question (source)
2015-02-23 05:52:45 -0500 commented question Open several psspy-instances from Python

Thank you both jconto and sheng! I think I understand how it works now, and how I can solve the issues I'm having.

2015-02-22 19:29:25 -0500 received badge  Popular Question (source)
2015-02-20 07:50:40 -0500 answered a question Extracting fault analysis data

As the error message states, you can't use ['z1'] the way you do here. What you probably want is:

rlsp = pssarrays.iecs_currents(1,0,0,1,0,0,1,0,0,0,3,3,0,0,1,0.0833)
Z_pstv = rlst.thevz[0].z1

Now to verify that this gives meaningful results (for my grid):

print Z_pstv
(5.92823457718+18.1242160797j)
2015-02-20 07:44:10 -0500 edited question Open several psspy-instances from Python

Is it possible to have open several sav-files in Python, and do operations on them in parallel. For instance, I may want to run load flow analysis on two different load scenarios, or different topologies for the same power system and compare them. I would like to do something like:

psspy1.fnsl()
psspy2.fnsl()

And compare the branch flows etc. Is this possible? Any help is greatly appreciated!

2015-02-20 03:39:52 -0500 received badge  Notable Question (source)
2015-02-20 03:37:59 -0500 commented answer Open several psspy-instances from Python

Thanks for the answer. I'm new to Python, so I don't really understand how the information is stored. I assume it's inside some object in the module psspy, but I'm not really sure. Is psspy a module that can only handle one object at a time? If the terminology I'm using is wrong, please correct it=)