Ask Your Question
0

Philosophy for choosing channels to plot

asked 2019-10-17 09:19:56 -0500

municipalpower gravatar image

updated 2019-10-17 09:20:41 -0500

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.

edit retag flag offensive close merge delete

Comments

I see, you basically need a 'diff' for the channels. This is actually doable. Consider extract all the channel IDs from the old and new and then perform a string based diff. Shouldn't be difficult after you solve this.

drsgao gravatar imagedrsgao ( 2019-10-17 10:52:49 -0500 )edit

@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.

municipalpower gravatar imagemunicipalpower ( 2019-10-17 11:41:46 -0500 )edit

Do you mean you produce the channels using the info from the SAV? Since the SAV does not have the dynamic channels in it. Take a look at @jconto 's answer also, changing your workflow may make things a lot eaiser.

drsgao gravatar imagedrsgao ( 2019-10-18 03:34:26 -0500 )edit

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.

municipalpower gravatar imagemunicipalpower ( 2019-10-18 08:05:00 -0500 )edit

1. Save an uninitialized snapshot then code the channel additions with chsb after you load the snapshot. When complete initialize then run your case. 2. Use matplotlib manual and automatic plot functions to get it like you want it. From experience, about 10 plots per page is reasonable.

GaryB gravatar imageGaryB ( 2019-10-30 21:36:16 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2019-10-29 14:18:31 -0500

In order to covert the excel portions of your dynamics analysis workflow to python, I recommend that you use the python Pandas library as the basis for your program. Using the psspy subsystem data retrieval commands you can easily extract the network data from your cases and store them in a Pandas Dataframe. You can then use the built in Pandas functions to perform a full outer join of your two sav / snp cases and determine what new channels are needed.

When it comes to visiualizion of your dynamics results using python, I recommend using the matplotlib package if you want to generate publication quality figures. I recommend using the Bokeh package if you want to create interactive html plots for data exploration and analysis.

edit flag offensive delete link more
0

answered 2019-10-17 16:51:52 -0500

jconto gravatar image

I prefer a python-based process to run simulations and plot channels.

A *.snp file does not have to have channels in it. I prefer not to include channels when making an *.snp file or clear the channel 'memory' from pre-defined ones. Use the Channel Wizard and subsystems to create channels needed for the study. The 'final' channels definition is in a (multiple) script file(s) (IDV or PY), added by the run-simulation script.

Plotting is done using Channels (a python plotting tool I developed using Matplotlib and dyntools for the data extraction). Search the forum for 'Channels - tool to process out files' for more information. In addition to 'plain' plots to pdf, it also supports 'only-in-violation' plots and other minor features not found in pssplt.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2019-10-17 09:19:56 -0500

Seen: 97 times

Last updated: Oct 29