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:
- Choose which additional channels we want to add to the .snp file
- Add these new channels to the .snp file
- Set up the plot options (min, max, plots per page, etc). We currently do this in the "Plot Template" idv)
- Plot the channels
Any ideas or insight into how other folks are accomplishing a similar task would be greatly appreciated.
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 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.
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.
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.
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.