Ask Your Question

ypwang's profile - activity

2016-09-29 13:27:55 -0500 received badge  Notable Question (source)
2016-09-29 13:27:55 -0500 received badge  Famous Question (source)
2016-05-09 21:12:11 -0500 marked best answer Is there way to identify all radial lines through PSS\E+Python?

Hello everyone,

I wanted identify all radial lines before creating a list of N-1 branch contingencies. But it is kind of meaningless to create a radial-line contingency especially if that radial line is connected to some loaded bus. So I wonder if there are python modules that can help me do this automatically. So far, I haven't found any modules can do this for me. In a naive way, I can I can use some python module to read the .raw data for branch data's "from/to bus" information and filter those buses that only appear once in from- and to- list and the branch to which it connects should be those radial lines. I know in this way, we will miss some special radial lines that even is connected to two buses, but losing which still will result in an island.

Could anyone advise on this issue.

Really appreciate your kind help and time.

Yp

2016-05-09 21:12:08 -0500 marked best answer Is my understanding correct about creating the distribution factor file?

Hi everyone, When we need to do ACCC, first need to create a distribution factor file.

Here is what I know from the PSS\E manual: Input for the process of creating the Distribution Factor file is contained in three data files: • Subsystem Description Data file; relevant subsystems of the working case are specified in this *.sub file. • Monitored Element Data file; network elements to be monitored for problems are specified in this *.mon file. • Contingency Description Data file; contingencies to be tested are specified in this *.con file.

My understanding is as follows: -Subsystem description file describes the system you want to run contingency analysis using ACCC. You can either include the whole system defined in your working case or .raw file or just specify a subsystem (i.e. using just some specific areas to define a new system you would like to work on, and ignore the rest of the original system as if the rest of system doesn't exist -- I cannot think of an realistic situation for this case though)

-A monitor element data file describes those elements that you want to monitor when you run ACCC. I guess ACCC solution file (i.e. .acc file) will only record the results for these specified elements in the subsystem you defined in the .sub file - maybe that is the purpose of this file -- to save computing time and resources.

Take my case as an example --- I need to do ACCC for a large system consisting 50 areas, but only interested in monitoring those branches and buses residing in areas 1-20. Then the original whole system (including all 50 areas) will by my subsystem, but in the .mon file, I only need to include those branches and buses in the areas 1-20. Basically, monitor file always contain less or equal number of elements than the subsystem. Of course monitor file only include those elements,but subsystem contains the whole topology and other physical information/parameters of the system.

-As for the contingency file, its meaning is very straightforward.

I would like to hear your comments. Please correct me if I am mistaken.

Thanks very much for your help in advance

2016-05-09 21:11:42 -0500 marked best answer How to relate power flow solution to a subsequent contingency analysis process?

Dear everyone,

First, I want to apologize for any misused power system terms in my question because I am not a power system major.

My question might seem silly to you as professional power system engineer. Anyway, let me try to describe my question in a simple way.

What I have: I have a hourly RAW data file for a real power system.

What I want: I want to simply test all N-1 contingency on this system. My current method: I simply use "readrawversion" module to load the RAW hourly data, and generate my .sub, .mon, .con and .dfax files in PSSE GUI (I import the same RAW data in PSSE), then I call "acccwithdsp_2" module to run all the contingency analysis

Where I am stuck: The problem is that I got an error saying "largest mismatch exceeds mismatch tolerance". I am using 0.6MW as the mismatch tolerance. So I eventually have to increase this tolerance until 200MW to get my AC contingency run properly.

Suggested Solution from some power system engineer: Some expert told me that the problem is that I didn't run power flow (I use FNSL(i.e.Full Newton-Raphson method) ) first on the data before I run contingency analysis.

Now comes the question: I kind of understand what he meant-- contingency analysis step needs to use the solution of power flow as a starting point. But as far as I know, the AC contingency analysis only requires input including mismatch tolerance, a bunch of parameters/options and fours files (i.e. .sub, .mon, .con, and .dfax) as necessary arguments. On the other side, module "FNSL" dosen't return solution in any form. So how ACCCWITHDSP_2 module gonna benefit from running a power flow?

My guess: I will just simply run FNSL before ACCCWITHDSP_2 with a small desired mismatch tolerance of 0.6 to see what happens. If problem solved, then I guess PSSE just somehow knows that a power flow has been run for that contingency analysis process.

Could anyone explain to me the underlying mechanism for this to work? Thanks very much for your generous help and time!

Best regards,

Yaping

2016-05-09 21:11:36 -0500 marked best answer How to terminate a running python code within IDLE?

Hi everyone,

A lot of times, I would like to terminate a contingency analysis process (that might take more than half hour) in the middle in the python shell of IDLE, so that I can test my another script. I tried Ctrl+C and Ctrl+Z,but neither worked. I searched through all the drop-down menus of IDLE, no options seem to solve my issue.

Does anyone know the trick? Really appreciate it!

Regards,

Yp

2016-04-11 00:26:04 -0500 marked best answer Questions about running contingency analysis for a large-scale network?

Hi there,

I am new to Python for PSSE. I appreciate that Jervis for setting up such a great learning community for PSSE users who want to use Python.

Right now, I want to use Python to fully automate a comprehensive contingency analysis for a real world large system with over 18,000 buses and 13,000 lines and 2000 generators. I intend to do this in the following steps: First, call ACCC for all possible N-1 contingency for the whole network -Is there a way to automatically generate .sub, .mon and.con files? (now I can only do it through PSSE GUI and can only generate DFAX through Python) -Does anyone know how long it would take for this size of network in PSSE?

Second, based on the solution report, I record the solutions of all the contingencies that violated either the line ratings limit or voltage magnitude limits in the Excel (I know I need to use the PSSEXCEL module). - Since I need to continue work on these results in subsequent steps in Python, I wonder if I can save the the violated contingencies (only the contingency names/indices should be sufficient) to a list. If this won't work, can I save the results in ZIP format and access the specific contingency names/indices in next step?

Third, after finding those violated contingencies, for each specific violated contingency (either generator or branch failure), I first want to create it using some Python module and then iteratively opening a branch (same unknown Python module needed here) using a for loop to find out if there are some branch-opening options are helpful in alleviating the previous violations that were caused by the contingency being considered. - Does any one know the Python module that can be used to create a specific contingency for either generator or branch?

Thanks very much for your valuable time and kind help in advance!!

Please forgive any misconception since I am not a power engineer:-)

2015-04-26 21:02:27 -0500 received badge  Famous Question (source)
2015-03-06 09:55:43 -0500 received badge  Famous Question (source)
2015-02-19 06:34:10 -0500 received badge  Famous Question (source)
2014-09-29 01:42:38 -0500 received badge  Famous Question (source)
2014-09-15 17:28:03 -0500 received badge  Self-Learner (source)
2014-09-15 15:28:56 -0500 commented answer How to terminate a running python code within IDLE?

Actually, Ctrl+C doesn't work in IDLE for cases that take a long time to solve (e.g. ACCC running on more than a thousand number of contingencies). Well, I tested it with success only on cases that only takes less than 1 minute. Don't know why.

2014-09-15 15:28:20 -0500 edited answer How to terminate a running python code within IDLE?

I just figured out a way to make "Ctrl +C" work regardless of how large your python code is: run python from Windows COMMAND LINE mode. Here is a useful link explaining HOW in case any one don't know how to set up command line run mode.

http://stackoverflow.com/questions/46...

Plus, running command line is a little bit faster.

2014-09-12 12:18:32 -0500 received badge  Popular Question (source)
2014-09-12 11:17:30 -0500 received badge  Notable Question (source)
2014-09-12 11:12:18 -0500 received badge  Notable Question (source)
2014-09-04 23:09:23 -0500 received badge  Notable Question (source)
2014-09-04 23:09:23 -0500 received badge  Famous Question (source)
2014-09-04 01:17:56 -0500 received badge  Popular Question (source)
2014-09-04 01:17:46 -0500 received badge  Popular Question (source)
2014-09-03 22:38:11 -0500 received badge  Famous Question (source)
2014-09-02 20:58:21 -0500 commented answer About correctly getting bus voltage after running ACCC.

Hi Eli, thanks a lot for your answer. Like you said, I do have two volt monitoring commands in my .mon file. One is for volt range and one is for volt deviation. I believe those two are used for automatic violation report generation. What I don't understand is that why two voltage for one bus.

2014-09-02 16:53:52 -0500 asked a question How to avoid program abortion if the largest mismatch exceeds mismatch tolerance?

Hello all,

Does any one know how to instruct PSS\E not to abort the ACCC process if largest mismatch exceeds mismatch tolerance. Right now, I am running ACCC on different number of network data and I am required to use a fixed mismatch tolerance of 0.6. I wrote an automatic python code to run ACCC on different data, and I supplied 0.6 as the largest system mismatch for ACCC for each data. Somehow, this tolerance is too small to run ACCC successfully on some data. And the program aborted even when I tried to deal with this exception like below:

# perform ACCC without dispatch model for branch contingency
accc_ierr = psspy.accc_with_dsp_2(0.6, [0,0,0,1,2,1,0,0,0,0], _s, conFileName1+'.dfx', conFileName1+'.acc', _o, _o)
outfile = open('outfile.txt", 'w')               
if accc_ierr != 0:
    outfile.write("accc_with_dsp_2_ierr_brn=" %(accc_ierr))
else:
    smry = pssarrays.accc_summary(conFileName1+'.acc')

I was expecting that PSS\E will just simply output the error code to an text file without aborting the program even there is some error (i.e. largest mismatch is exceeded). Actually this is not working. Does anyone know a way to fix this problem?

Thanks very much.

2014-09-02 16:41:26 -0500 asked a question About correctly getting bus voltage after running ACCC.

Hi everyone,

I am doing contingency analysis using ACCC. After running ACCC, I would like to check the voltage magnitude of each monitored bus. My code goes as below:

# perform ACCC without dispatch model for branch contingency
accc_ierr = psspy.accc_with_dsp_2(0.6, [0,0,0,1,2,1,0,0,0,0], _s, conFileName1+'.dfx', conFileName1+'.acc', _o, _o)

# fetch summary of ACCC solution for debug purpose
 smry = pssarrays.accc_summary(conFileName1+'.acc')        

 for lbl in smry.colabel:

        # for each contingency case
        soln = pssarrays.accc_solution(accfile=conFileName1+'.acc', colabel=lbl, stype='con', busmsm=0.6, sysmsm =5.0)
        # skip some unregular contingencies                    
        if (soln == None or soln.ierr != 0):
            continue

        # if solution converged, continue  
        if (soln.cnvflag):

            # check voltage violations at buses
            sum_UnderVoltVio = 0
            numBuses_UnderVoltVio = 0
            sum_OverVoltVio = 0
            numBuses_OverVoltVio = 0
            for k in range(smry.acccsize.nmvbus):   
                busVolt = soln.volts[k]                            
                if(busVolt < volt_lb):                        
                    sum_UnderVoltVio = sum_UnderVoltVio + (volt_lb - busVolt)
                    numBuses_UnderVoltVio = numBuses_UnderVoltVio + 1

                elif(busVolt > volt_ub):
                    #print "busVolt", busVolt
                    sum_OverVoltVio = sum_OverVoltVio + (busVolt - volt_ub)
                    numBuses_OverVoltVio = numBuses_OverVoltVio + 1

So basically, I know all voltages of all monitored buses are stored in soln.volts array. And I am sure that smry.acccsize.nmvbus is the number of voltage monitored buses. So I was assuming that size of soln.volts array should be equal to smry.acccsize.nmvbus. But this is not the case, the size of soln.volts is actually twice as big as smry.acccsize.nmvbus (see statistics below). And if I don't remember wrong, the values in soln.volts just got repeated twice, which means, the first half is exactly the same the second half.

smry.acccsize.nmvbus= 6244 # is the number of monitored buses.

smry.acccsize.nmvbusrec= 12488 # is the number of voltage monitored bus records

len(soln.volts)= 12488

Notice that smry.acccsize.nmvrec= 2 # is the number of voltage monitored records

I don't why PSSE does this. Maybe it is a bug, but I wanted to make sure I am fetching the correct voltage for each monitored bus. Can anyone help explain why?

Thanks very much!

2014-09-01 04:28:47 -0500 received badge  Popular Question (source)
2014-08-28 22:32:20 -0500 received badge  Notable Question (source)
2014-08-28 14:22:52 -0500 received badge  Famous Question (source)
2014-08-28 00:48:05 -0500 received badge  Nice Answer (source)
2014-08-27 20:47:07 -0500 received badge  Famous Question (source)
2014-08-27 10:07:57 -0500 received badge  Famous Question (source)
2014-08-27 02:38:37 -0500 received badge  Self-Learner (source)
2014-08-26 19:51:44 -0500 received badge  Notable Question (source)
2014-08-26 11:39:53 -0500 commented answer Can you tell if a branch is a transformer or non-transformer based on "fromBus", "toBus" info?

Sorry I didn't look into your first link, which also called "here" :-) I will check out the first post. Thanks very much!

2014-08-26 11:30:52 -0500 answered a question Do you know a better way to find an area's neighboring areas?

I just figured out a way to implement my idea above, let's say I want to find out all neighboring areas for area n:

# define subsystem n and let it only contains area n psspy.bsys(sid=n, usekv=0, numarea=1, areas=[n])

# fetch all tie branches for area n (i.e. subsystem n)
ierr, (frombus,) = psspy.abrnint(n, 1, 2, 3, 1, 'FROMNUMBER')
ierr, (tobus,) = psspy.abrnint(n, 1, 2, 3, 1, 'TONUMBER')

# combine fbus and tbus to one list
tiebuses = frombus + tobus
print "tiebuses", tiebuses

# fetch all bus numbers for entire system 
ierr, (busNums,) = psspy.abusint(-1, 1, 'NUMBER')
ierr, (busAreas,) = psspy.abusint(-1, 1, 'AREA')

# store area number for each toBusnum to a list
nbAreas = []    
for i in tiebuses:
    nbAreas.append(busAreas[busNums.index(i)])

# since nbAreas might contain duplicated area numbers, so remove duplications
nbAreas = list(set(nbAreas))
print "areasincludeCurrOne=", nbAreas

# remove area n itself
nbAreas.pop(nbAreas.index(n))
print nbAreas
2014-08-26 08:53:57 -0500 asked a question Do you know a better way to find an area's neighboring areas?

Hi all, I am thinking of using subsystem tie branch info to detect contiguous neighboring areas for a specified area and then check each tie branch to all neighboring areas for its "toBusId". Then find out which areas those "toBusID" reside.

2014-08-26 07:11:08 -0500 received badge  Popular Question (source)
2014-08-25 21:56:32 -0500 commented answer Can you tell if a branch is a transformer or non-transformer based on "fromBus", "toBus" info?

Thanks a lot, those are great functions. So I need to register as GitHub member to see the complete code of function "subsystem_info"? Since I didn't see the options 'brn' and 'trn'.