Ask Your Question

rimux's profile - activity

2017-05-23 09:24:58 -0500 received badge  Nice Answer (source)
2015-09-11 03:30:10 -0500 commented question need good reference to learn PSSE

PSSE can do a lot of things - load flow, dynamics, contingency, OPF, short circuit etc. Also it is not clear do you have your network in psse format already - if you need to build your network from scratch - could be not easy task for beginner as well. And PSSE manuals are really large...good luck:)

2015-09-08 05:47:06 -0500 commented answer Combining .sav files in PSSE

And when saving raw files, select option "Configure RAW file to Add to working case"

2015-07-20 10:51:30 -0500 received badge  Nice Answer (source)
2015-05-26 02:42:49 -0500 answered a question Move buses in slider diagrams

I have created for myself simple solution for automatic creation of sld diagram containing necessary buses placed in the right places. Save following gif file and change extension from gif to zip, inside there are one excel file and one python file. Excel template is for preparing list of buses containing x and y coordinates for each bus. On "buses" sheet put bus numbers in the cells where approximately they should appear on your sld file. Then run macro "PreapreForPython" (to do that you will probably need to enable Developer tab). than copy-paste from another sheet list of buses into python just after "buses=" line. Than open in psse blank sld and run that python script. All buses will be more or less in right places. Of course this thing could be improved, feel free to do that, just don't forget to put better solution here :)

PSSE_SLD.gif

2015-04-09 00:57:54 -0500 answered a question Distribution factor data file(.dfx)

There are no API for building ".mon", ".con", ".sub", but this is text files so would be not big deal to write some python code for doing that. Or you can use excel, I for example have excel template that creates lists of branches in right format for .con and .mon. Regarding second question, I think you should check output results when using the same .dfx and not the same, and you will know is there any difference or not. I think if you are not changing grid topology (connecting/disconnecting branches and other equipment you have described in .con and .mon) there should not be any difference, because you should have correctly solved case before running contingency routines.

2015-02-17 00:18:48 -0500 received badge  Commentator
2015-02-17 00:18:48 -0500 commented answer How to add a extra digit on the bus numbers in PSS/E

You can do it in Excel, 2000 bus bars are not too much for excel for sure :) And from Excel copy those two columns of old/new bus numbers into .trn file in any text editor.

2015-02-12 05:00:52 -0500 answered a question How to add a extra digit on the bus numbers in PSS/E

Use standard PSS/E functions. From top menu:

Power Flow -> Renumber Buses -> By Bus Number

Just prepare .trn file which format as far as I remember is very easy:

'old bus number'  'new bus number'
2015-02-06 04:39:48 -0500 answered a question Exporting branch R,X values to Excel
R = branchrx.real
X = branchrx.imag
2015-01-26 02:21:56 -0500 answered a question How to get MVA at "to" end of branch through API

from API manual:

ierr, rval = brnmsc(ibus,jbus,ickt,string)
’P’ Branch MW flow at the IBUS end of the branch.
’Q’ Branch Mvar flow at the IBUS end of the branch.

You can get P and Q at the desired branch end just by placing correct bus number into ibus place. Formula for MVA:

S=sqrt(P^2+Q^2)
2014-09-15 17:27:08 -0500 received badge  Nice Answer (source)
2014-08-27 03:08:32 -0500 answered a question Can you tell if a branch is a transformer or non-transformer based on "fromBus", "toBus" info?

Nice solution from amaity.

Another possibility - use abrncount, abrnint and other API commands for retrieving all branch data for defined subsystem at once. Just use right option FLAG, e.g. FLAG = 1 for only in-service non-transformer branches and FLAG = 5 for only in-service two-winding transformers.

Also if need to check just one branch if it is line or transformer - just get the base voltages form both sides of a branch (by using psspy.busdat(bus,"BASE")) and compare them - if voltages are different - this is transformer.

2014-08-26 11:33:31 -0500 received badge  Necromancer (source)
2014-08-22 02:22:05 -0500 answered a question Weird bug in user defined contingency list

In savnw.sav 201-204-205 is a multi-section line, so for PSS/E it is the same are you disconnecting 201-204 or 201-205. But I don't have experience with multi-section lines and I newer use them so you need to read PSS/E manual if you want to learn more. As I can see in savnw.sav bus 201 has voltage 500 kV, bus 204 also 500 kV but bus 205 has 230 kV, so this should be power transformer. I would better use normal way of modelling power transformers.

2014-08-21 23:45:18 -0500 commented answer Is there way to identify all radial lines through PSS\E+Python?

I tested and updated my code and now it should work. I just forgot that command tree needs some special behavior.

2014-08-20 02:57:58 -0500 answered a question Why does ACCC restart python?

Once I also had the same problem with acccwithdsp3, I solved it by using the accc command insted - it works just fine. But you can try also acccwithdsp2 or acccwithdsp - may also work.

2014-08-20 02:39:03 -0500 answered a question Will that possible to adjust generator dispatch levels inside ACCC?

I think that after tripping of one generator during ACCC process generation from lost generator would be replaced by increased generation from swing bus, so balance between generation and load in the whole system will be correct and you should not get "blown up" type problem. One fast solution I can propose to you is to try to set up swing bus (type 3 instead of 2) that it should be or the biggest unit in your system or some big hydro unit used to be fast reserve source in your system. You can have many swing buses in the system, e.g. one per area.

How to change production from all generators proportionally during ACCC process I didn't try to do by myself, but maybe you should start to investigate if it is possible not from analyzing API commands in python but trying to do this directly in PSS/E. In ACCC dialog window I see option ''Dispatch mode" and it has options "Subsystem machines (Reserve)" and "Subsystem machines (Pmax)". Maybe this is what you are looking for. From documentation I found description for e.g. "Pmax" option as following:

Participating machines are connected to dispatch subsystem buses and have positive active power generation. Each machine's participation factor is its maximum active power generation with positive values. If a Unit Inertia and Governor Data file is specified, maximum machine active power limits are taken from it; otherwise, the maximum machine active power limits in the working case are used. PT is adjusted by the rules discussed in Dispatch Mode of Machine Reserve.

So you should go and dig deeper and find in documentation about format of Unit Inertia and Governor Data file mentioned before. If you will find that it works, than in python you will need probably acccwithdsp_3 (for PSSE 33) command.

2014-08-19 02:13:29 -0500 commented answer Is there way to identify all radial lines through PSS\E+Python?

Seems that you are right, contingency list contains even those branches disconnection of which leads to island.

2014-08-18 13:15:38 -0500 commented answer Questions about running contingency analysis for a large-scale network?

Of course, would be nice that accc_violations_report would do output not only into text report but similar output like accc_solution. Maybe we should write to PSSE support proposing to include such improvement, shouldnt be big deal for them to implement this into next psse version I think.

2014-08-18 13:05:37 -0500 commented answer Questions about running contingency analysis for a large-scale network?

I am fetching monitored elements by using api command accc_solution, e.g.: sm=pssarrays.accc_summary(accfile=acc) for i in range(len(sm.colabel)): CL = sumry.colabel[i] r=pssarrays.accc_solution(accfile=acc, colabel=CL, stype='contingency', busmsm=bm, sysmsm=sm) mva = r.mvaflow

2014-08-18 12:34:46 -0500 commented answer Is there way to identify all radial lines through PSS\E+Python?

Also I am not sure you really need to filter those radial lines as psse DFAX command will automatically (I think so, will check this tomorrow) remove those contingencies that leads to formatting islands in the system.

2014-08-18 12:23:43 -0500 commented answer Is there way to identify all radial lines through PSS\E+Python?

Island means - there are bus or buses which do not have connection to any type 3 bus (swingbus).

2014-08-18 05:28:52 -0500 answered a question How to terminate a running python code within IDLE?

I suggest you not to use python IDLE if possible as it is very simple and not very programming-friendly enviroment. I would recommend to use PyScripter or Notepad++, both of them are free and much better shells for writing in python. In PyScripter you can terminate running program by pressing Ctrl-Alt-F9 ('Abort debugging'). In Notepad++ for running python programs you will need to install plugin NppExec and run python scripts by pressing F6 (for the very first time you will need to enter this line for make it work: C:\Python27\python.exe "$(FULLCURRENTPATH)" ). After program starts, if you'll press F6 again "Terminate" button appears and you can kill active process. Try this and you will never ever want to come back using native python IDLE :)

2014-08-18 02:46:56 -0500 answered a question Is there way to identify all radial lines through PSS\E+Python?

I would suggest to go through a list of branches and disconnect them one by one. After disconnection of the branch, check if there are no islands - if you will get an island this means that branch is radial. e.g.:

import psspy

branches=[[101,102,'1'], [201,202,'1']]

psspy.progress_output(6,"",[0,0])

List=[]
for b in branches:
  ierr, status = psspy.brnint(b[0], b[1], b[2], "STATUS")
  if ierr==0 and status==1: #branch is on
    ierr = psspy.branch_chng(b[0], b[1], b[2], 
               [0,_i,_i,_i,_i,_i], [_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f])   
    if ierr==0:
      ierr, n = psspy.tree(1,0)
      if ierr==0 and n>0: #island detected
        # b is radial branch...
        print 'branch',b[0], b[1], b[2],'is radial'
        ierr, n = psspy.tree(2,-1)
      else:
        #branch is not radial 
        print 'branch',b[0], b[1], b[2],'is not radial'
        List.append(b)              
      ierr = psspy.branch_chng(b[0], b[1], b[2],
                 [1,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f])  
#List will contain only non-radial branches (and only with status=on)

psspy.progress_output(1,"",[0,0])
print 'Non-radial branches:',List
2014-07-17 06:25:18 -0500 answered a question Seperate a single .py file into multiple .py files

Regarding 1st question - just write in the top of A.py:

import B
import C

than if you have e.g. in B.py some function1, you can reach it in A.py :

B.function1()
2014-07-16 09:49:36 -0500 received badge  Nice Answer (source)
2014-07-16 02:05:36 -0500 answered a question Questions about running contingency analysis for a large-scale network?

Hi, I will try to answer your questions as I have written python script for my needs for ACCC calculations.

-Is there a way to automatically generate .sub, .mon and.con files? In general if you want to generate those files from python, you should prepare functions that can do that, but I think you don't need to do that automatically as usually you know before calculations what you want to analyse - area numbers and voltage levels. In .sub file you can create as many different subsystems as you want, give them different names, and later in python just manipulate in changing subsystem name rather than trying to generate new .sub file. The same advice for .mon file - put everything you want to monitor there, later on anyway you will need to program your specific python function for digging into ACCC results file and filtering what you need. For .con - I advice you to prepare different .con files for different levels of analyses - one for e.g. 400 kV level, another for just generators and so on - each for different purposes as some contingencys will run very long, e.g. n-2 for branches for voltage levels less than 400 kV.

-I wonder if I can save the the violated contingencies (only the contingency names/indices should be sufficient) to a list. Of course you can, so why we are using python instead of psse GUI - in python you can do everything :) Following python code will give you contingency list (excerptions from my code, sorry if something will not work):

#method 1: contingency list with short descriptions

sumry = pssarrays.accc_summary(accfile=acc)
print 'Contingency list:'
k = 0
for n in sumry.colabel:
  k += 1
  print k, n

#method 2: contingency list with full descriptions

for i in range(len(sumry.colabel)):
  ContLabel = sumry.colabel[i]
  try:
    rlst = pssarrays.accc_solution(accfile=acc, colabel=ContLabel, stype='contingency',
                                   busmsm=busmsm, sysmsm=sysmsm)
  finally:
    pass

  if rlst is not None:  # contingency solution found, proceed
    msm = rlst.mvatotal #if need to check mismatch
    msm2=rlst.mvaworst #also mismatch (msm2<msm  - I dont know why)

    if (only_bad_mismatch and msm2>maxMismatch) or (only_bad_mismatch==0): #if need to filter cases with high mismnatches - e.g. where no solution found
      contdescr = rlst.codesc
      s=contdescr[0]
      for z in range(1,len(contdescr)):
        s += ' & ' + contdescr[z]
      print s #printing contingency full description

-Does any one know the Python module that can be used to create a specific contingency for either generator or branch?

No specific module I think, but you can write easily function that will generate .con file (which is in text format of course) where you can put all contingencys you want as e.g. one bus contingency description in .con file looks simple:

CONTINGENCY 'Line 111-222-1' 
DISCONNECT BRANCH FROM BUS 111 TO BUS 222 CIRCUIT '1'
END

Just iterate over all branches changing bus numbers and putting those three lines into .con. Later on just re-run ACCC with newly created .con.

In my program I organized ... (more)

2013-05-29 05:21:02 -0500 answered a question Bus vectors PSSE/E + Python

Check the API.pdf manual file - abusreal command will give to you results from all buses at once.

2013-05-15 04:36:13 -0500 answered a question Get power output
#List of generatorts for investigation:
Gen=[[bus1,id1],
     [bus2,id2],
     [bus3,id3]] #and so on

#Loop through all generators:
for g in Gen:

  bus=g[0]
  id=g[1]

  #remember initial generation:
  e1, Pold = psspy.macdat(bus, id, 'P')

  #getting generator Pmax:
  e2, Pmax = psspy.macdat(bus, id, 'PMAX')

  #changing generation to Pmax
  e3 = psspy.machine_data_2(bus,id,[_i,_i,_i,_i,_i,_i],[Pmax,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f])

  e4 = psspy.fnsl() #solving

  #some code here - doing something, output results, etc.
  #...

  #restore initial generation:
  e5 = psspy.machine_data_2(bus,id,[_i,_i,_i,_i,_i,_i],[Pold,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f]) 

  e6 = psspy.fnsl() #solving again

  if (e1+e2+e3+e4+e5+e6)!=0: print "got some errors ! ",g
2013-05-02 00:10:40 -0500 commented question Single line diagram generation from saved case (RIMUX method)

Hi, I am not sure I understood the problem you are facing. This code should be run from within PSSE - just open PSSE, open desired sav, open python program with e.g. notepad++, change bus numbers in buslist (and add more), in psse create new empty diagram, and "run automation file". Thats it. About importing buslist information from excel - thats another story

2013-04-19 09:35:59 -0500 answered a question Import from excel to PSSE

I am doing like this:

from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")

def XLSReadValue(xbook,xsheet,cell,x,y): #x,y - offset from cell
  value = xlApp.Workbooks(xbook).Sheets(xsheet).Range(cell).Offset(x+1,y+1).Value
return value

def XLSWriteValue(xbook,xsheet,cell,x,y,value): #x,y - offset from cell
  xlApp.Workbooks(xbook).Sheets(xsheet).Range(cell).Offset(x+1,y+1).Value=value

Than, if I want to get from excel value from cell A1:

n=XLSReadValue('book.xls','sheet1','A1',0,0)
2012-12-18 02:09:34 -0500 answered a question Read from Excel into Python

try to use function str, e.g.

print str(u'R3')

gives for me result 'R3'

2012-11-15 21:28:12 -0500 received badge  Nice Answer (source)
2012-11-15 08:13:33 -0500 answered a question How to check bus current in PSSE?

if you have list of the lines, all currents from them you can get very easy:

lines=[[5001,5013,"1"],
       [5001,5035,"1"]] #put here as many lines as you want

l=len(lines)
for i in range (l):
  error, amp =  psspy.brnmsc(lines[i][0],lines[i][1],lines[i][2],"AMPS")
  if error==0:
    print str(i+1)+". Line: ",lines[i][0],lines[i][1],lines[i][2]," : ",round(amp,2)," A"
  else:
    print str(i+1)+". Line: ",lines[i][0],lines[i][1],lines[i][2]," : ","error in brnmsc"
2012-11-15 05:21:53 -0500 answered a question Slider printing issue

I got the same in psse32.
I see 2 solutions for that: use not filled busbars - in this case printing is ok. Or use export to jpg - if quality of the picture sutisfy you. And of course - write email to psse support - they can make patch for psse32 to fix that issue.

2012-11-15 02:43:11 -0500 received badge  Supporter (source)
2012-11-15 01:59:39 -0500 commented answer Can we create a single line diagram(sld) from raw data using python?

I am not sure what problem did you get running my program, it runs on psse 32 just fine. By the way, I am using this program in connection with excel - in one excel sheet I am putting bus numbers in different cells that corresponds aproximately places where they should appear on sld diagram. Later run little excel vba code that generates buslist for the python program. Formulas for x and y coordinates are simple: x=(cell column number)x1.5 , y=-(cell raw number)x1.5 . Constants 1.5 can be different - depends what distance between buses in the diagram you need.