Ask Your Question

municipalpower's profile - activity

2019-10-30 05:59:22 -0500 received badge  Famous Question (source)
2019-10-21 07:56:28 -0500 received badge  Notable Question (source)
2019-10-18 08:05:00 -0500 commented question Philosophy for choosing channels to plot

No, we copy the network data from the .sav that corresponds to the specific .snp. This is to determine what buses, machines, etc. are included in that case year. The .idv that is produced is run on the corresponding .snp. This is all part of an effort to switch entirely to a Python-based workflow.

2019-10-18 03:04:26 -0500 received badge  Popular Question (source)
2019-10-17 11:41:46 -0500 commented question Philosophy for choosing channels to plot

@drsgao Help me understand what you mean. I have the original (old) .snp. I need a way to add additional channels for certain buses/machines from .sav case (and a way to select these elements) to this .snp, to create the new file. Then, I need to choose which channels from the new .snp to plot.

2019-10-17 09:19:56 -0500 asked a question Philosophy for choosing channels to plot

I will describe below our current process for plotting channels from our dynamic simulations:

  • Get updated .sav case and snap files every year. The .snp file has a number of channels in it, which were added by the party who created the case.
  • Copy the network data from the .sav case (particularly Bus Number, Bus Name, Base kV, and Area Num columns) into an Excel worksheet (Bus Export tab). Same procedure for machines (on the "Machine Export" tab) and branches.
  • Flag the buses which were not included in the original channels in the .snp file and that we would like to plot channels for (by typing an 'x' in the cell beside it).
  • Through Excel formulas, a column in the Bus Export Tab generates the code for an .idv which we call "Channel Update". When we run this .idv, it adds additional channels to the .snp file, starting on the next available channel in the original .snp file. (rotor angle, apparent impedance, Pout, Qout for machines, bus voltages, angles, and frequency, branch flows, etc.)
  • Go into the updated .snp file (from the GUI) and copy the channel data to an Excel worksheet (Plot Export tab).
  • Flag which of these channels we would like to plot, again, by typing an 'x' next to it (We don't want to plot every single channel for every bus, machine, or branch that was added).
  • Again, through Excel formulas, a column in the "Plot Export" tab generates the code for an .idv (Plot Template.idv) which plots the channels. This essentially uses PSSPLT to produce the plots.

We are looking to transform the way that we run our dynamic simulation from an .idv-based system, to running more Python scripts. For the purpose of plotting, what ideas do you have for accomplishing this task? I have experimented with some scripts that use Matplotlib and also Dyntools to plot channels from .out files.

However, there is a bit more complexity to our setup than what I have seen done using Python, given that we need a way to:

  1. Choose which additional channels we want to add to the .snp file
  2. Add these new channels to the .snp file
  3. Set up the plot options (min, max, plots per page, etc). We currently do this in the "Plot Template" idv)
  4. Plot the channels

Any ideas or insight into how other folks are accomplishing a similar task would be greatly appreciated.

2019-08-27 02:10:14 -0500 received badge  Famous Question (source)
2019-08-13 10:29:15 -0500 received badge  Notable Question (source)
2019-08-09 05:39:10 -0500 received badge  Famous Question (source)
2019-08-09 04:43:50 -0500 received badge  Famous Question (source)
2019-08-06 13:10:47 -0500 commented answer How to identify circuit id using psspy.abrnint()

In the .SAV cases that I use, the ID is usually represented by a number (ckt #1 or ckt #2). So, I figured I would find this under .abrnchar(). Come to find out it's actually a string. Thanks for the answer!

2019-08-06 04:19:56 -0500 received badge  Popular Question (source)
2019-08-05 15:19:05 -0500 answered a question How to identify circuit id using psspy.abrnint()

I will not delete this question because it may help somebody else, but I just realized that this can be easily done using the psspy.abrnchar API function. I had originally missed this while reading through the API functions.

2019-08-05 15:13:55 -0500 asked a question How to identify circuit id using psspy.abrnint()

I am using psspy.abrnint to get a list of branches in the working case, and creating a list of branches that are not in service. The abrnint API using the STRING parameter to tell it the information to pull from the branch. I am passing it 'FROMNUMBER', 'TONUMBER', and 'STATUS'. For double circuits, I don't see a way to distinguish between circuits #1 and 2.

Is there perhaps a different API function that is better-suited to get the information about branches that includes the circuit id?

2019-08-05 09:38:48 -0500 received badge  Notable Question (source)
2019-08-05 09:38:48 -0500 received badge  Popular Question (source)
2019-08-05 09:38:34 -0500 received badge  Enthusiast
2019-07-30 12:17:12 -0500 received badge  Notable Question (source)
2019-07-30 08:44:40 -0500 received badge  Popular Question (source)
2019-07-29 12:18:29 -0500 commented answer How to save report data to program memory?

Yes, this explains my situation. The regional entity in my state releases weekly SAV cases for each day of the week, which have forecasted line outages, generation dispatch, load, etc. which we use for system operations. I think your solution will work. I will go in that direction. Thanks.

2019-07-29 08:19:42 -0500 received badge  Editor (source)
2019-07-29 08:18:28 -0500 asked a question How to save report data to program memory?

I am trying to save data retrieved from reporting API functions into a variable. For example, if I want to have a list of all branches that are out of service in the working case, and I use psspy.outs(), the only way that I see to use this data is to save it out to a file (or the other 'devices' as noted in report_output).

For a next-day study, I have a list of lines that will actually be out of service that day stored in a variable. The working case (created by our regional entity for that day) should already have most of these lines out of service, but plans may have changed since the case was created until now. The list that I have is the most updated status of line outages. I want to put every outaged line in the case back in service (with the exception of N.O branches and reactor bypasses), then apply the outages that are in my list. This is to protect against the situation where a line was scheduled to be out of service, so it is out in the case, but the outage was canceled. In this case, the line will be out in the working case, but it will not be in my list of outages, so I wouldn't know to put it back in.

Using the outs routine seems like a perfect way to get a list of outaged lines in the case, then loop through all of these to put them in service. Is the only way to utilize this data to save it out to a file (maybe .csv?) and then read that file back to manipulate the data?

2019-07-29 07:44:24 -0500 asked a question Using Dyntools to Plot Many .OUT Files

I am trying to use Dyntools to plot each .OUT file in a directory, one by one. What I am doing is setting up my optnchn dictionary, then looping through each .OUT file in the directory, creating a chnf object, updating the filename, and calling .xyplots() to plot it. This works fine, in the sense that I get a pdf file output for each .OUT file, but I get the following error:

C:\Python34\lib\site-packages\matplotlib\cbook\deprecation.py:107: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance. In a future version, a new instance will always be created and returned. Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.

What ends up happening is that each subsequent plot is overlapping the previous plot. It seems to be 're-using' the previous plot that was created. The only way around this that I have found is to run each plot individually one by one. I have tried many things like moving the .xyplots() call to its own function, and returning chnf. I have also tried to put a .plots_close after the plot is created, and this just terminates the program. Code is inserted below. Any ideas as to what I am missing?

# Create list with all .OUT files in directory
outlist = glob.glob(r'C:\Users\Manny\Documents\PRC-12\2019_____SPS_Effectiveness_Study\results\dynamics\Phase_I\_OUT\*.out')

# Setup Channels - Each .OUT file has 7 plots, with 6 channels each.
optnchn = {1:{'chns':[7,9,53,55,59,79]},
            2:{'chns':[15,25,37,39,71,73]},
            3:{'chns':[17,43,47,57,65,75]},
            4:{'chns':[92,93,95,96,107,115]},
            5:{'chns':[98,102,104,111,112,114]},
            6:{'chns': [100,103,105,109,119,120]},
            7:{'chns': [81,83,85,86,88,89]}
            }

# Counter for filenames
j = 1

# Loop thru each .OUT file
for i in outlist:

    # Create object with current out file, set options
    chnf = dyntools.CHNF(i)
    optn = {'size': 'Letter', 'orientation': 'Landscape', 'title': '2019 ___SPS Effectiveness Study - Phase I', 'dpi': 300, 'showttl': True}

    # Set Filename for current .OUT file plot results
    plotfile1 = r'C:\Users\Manny\Documents\PRC-12\2019____SPS_Effectiveness_Study\results\plot_logs\PHASE I\SimPlots'
    plotfile2 = j
    plotfile3 = '.pdf'
    plotfile = plotfile1 + str(plotfile2) + plotfile3
    j = j+1

    # Produce Plot
    ierr = chnf.xyplots(optnchn, optn, plotfile)

    if ierr:
        print('Errors Were Found')

    else:
        print('No Errors Found')