Ask Your Question

JDRobers's profile - activity

2018-01-22 09:51:39 -0500 received badge  Taxonomist
2016-01-20 13:32:56 -0500 asked a question Retrieving BINIT from switched shunt in case

Hello, forum.

I am trying to write a program that creates cases using interpolated hourly data so that I can test a set of bulk capacitor settings. In order to model my cases accurately, I need to know the sizes and on/off statuses of all blocks in my switched shunts so that I know that I am only changing ONE shunt.

The problem is that whereas the SWITCHEDSHUNTDATA_3 API call has a BINIT (present switched-on Mvar value) field in the input float array, I see no way to retrieve such a value using the aSwshReal API call. The closest strings I found in the API Guide were "BSWNOM" and "BSWACT", neither of which produce the correct value.

Is there a string I am overlooking in the guide? Or is there another way to retrieve this value?

2015-04-06 07:04:07 -0500 received badge  Good Question (source)
2015-03-31 13:03:04 -0500 commented answer Suppress PSSE output entirely

Using your advice and combining it with the silence() method for the initial copyright printout, I have acheived my goal. Thanks!

2015-03-08 21:05:49 -0500 received badge  Notable Question (source)
2015-03-08 21:05:49 -0500 received badge  Famous Question (source)
2015-03-06 11:41:32 -0500 commented answer Suppress PSSE output entirely

Thank you! That redirect.psse2py() was the missing link.

2015-03-06 11:41:07 -0500 received badge  Supporter (source)
2015-03-06 11:35:17 -0500 received badge  Popular Question (source)
2015-03-06 07:36:36 -0500 received badge  Editor (source)
2015-03-06 07:17:59 -0500 commented question Suppress PSSE output entirely

I tried the contextmanager approach just now, creating the silence() function that you showed in your example, verbatim. Unfortunately, I am still getting the output to console, even for something as simple as containing psseinit inside a "with silence()" block.

2015-03-05 09:14:36 -0500 asked a question Suppress PSSE output entirely

Hello forum,

I have managed to find quite a few roundabout solutions to my problems with PSSE, but this one continues to annoy me.

I want to make it so that when using psspy, I do not get tons of text printed to the terminal. There was a time when I was able to circumvent this by using psspy.report_output to send the output to a text file, but that no longer appears to work.

According to the API manual, there is an option "6" for report_output that states "no output." That would be great if that option actually delivered what it promised, but I still get tons of text output to the command terminal. Is there an easy way to get rid of this?

EDIT:

I have tried chip's approach using contextmanager and setting sys.stdout to os.devnull, but to no avail. I even tried breaking up the use of the "with" statement into two methods like so:

OLD_STDOUT = sys.stdout    #Keep track of what the original output to terminal was
def silence(file_object = None):
    """
    Discard stdout (i.e. write to null device) or
    optionally write to given file-like object.
    """
    if file_object is None:
        file_object = open(os.devnull, 'w')

    try:
        sys.stdout = file_object
    except:
        sys.stdout = OLD_STDOUT
    return

def unsilence():
    """
    Reset stdout to the terminal like normal
    """
    sys.stdout = OLD_STDOUT
    return

And then I even tried something like:

print "Checkpoint 0"
silence()
psspy.psseinit(50000)
print "Checkpoint 1"
unsilence()

However, the text created from psseinit still gets to the terminal somehow. Oddly enough, checkpoint 1 does not get printed. I'm stumped.

2015-02-13 07:47:45 -0500 received badge  Scholar (source)
2015-02-13 07:47:15 -0500 answered a question How to get MVA at "to" end of branch through API

Thanks guys.

What I wound up doing was using the abrnreal API call, and used the entry = 2 parameter to have each branch listed twice; once going from-to and the other going to-from. It takes some filtering and quite a bit of data storage, but I can indeed query P, Q, and MVA at both ends. I just have to see if the entry has been found already first (in which case I am looking at the to-from entry rather than the from-to entry.)

I appreciate the responses!

2015-02-13 05:37:05 -0500 received badge  Nice Question (source)
2015-02-11 22:34:10 -0500 received badge  Famous Question (source)
2015-02-11 17:04:30 -0500 received badge  Notable Question (source)
2015-02-10 20:33:02 -0500 received badge  Popular Question (source)
2015-02-10 04:17:31 -0500 received badge  Student (source)
2015-02-09 12:59:58 -0500 asked a question psspy report output to pipe

Hello everyone,

In an effort to save time and disk I/O, I am trying to get PSSE to redirect its report output to a named pipe. I am having a great deal of trouble with this and was hoping you could help.

In the past, I have used psspy.report_output to redirect PSSE output for functions like DIFF to a specific file, which I would later read in with a different part of my program. However, this uses a lot of I/O, and therefore time.

The problem is that os.pipe generates a set of integers that represent addresses for reading and writing, and psspy.report_output requires a string for the destination file/device. If I try to wrap the read and write ends of the pipe with file descriptors, both wind up being interpreted as read-only files, and as a result PSSE does not actually write to the pipe.

Are there any API calls that would allow me to do this the way I want to?

2015-01-26 01:31:06 -0500 received badge  Famous Question (source)
2015-01-20 23:11:52 -0500 received badge  Popular Question (source)
2015-01-20 23:11:52 -0500 received badge  Notable Question (source)
2015-01-15 10:26:28 -0500 asked a question How to get MVA at "to" end of branch through API

Hello forum,

For starters, I am using PSSE version 33.4.

I am trying to create a program that calculates and reports adjusted MVA values for branches. However, I need to report the maximum adjusted MVA for each branch, as in:

max(MVAfrom/frombusperunitvoltage, MVAto/tobusperunitvoltage)

The problem is that the API documentation for abrnreal suggests that I can only get either the MVA at the from bus, or the MAXMVA, meaning either the MVA at the from bus or the to bus, whichever is greater. But if the maximum MVA happens to be at the from bus, then I can't possibly read the MVA at the to bus end.

Is there another way to just get the MVA at the to bus end?

2014-10-06 19:00:15 -0500 received badge  Teacher (source)
2014-10-06 19:00:15 -0500 received badge  Self-Learner (source)
2014-10-03 07:36:52 -0500 answered a question How do I read the Impedance Correction Table data?

Well, I'll tell you what I managed to discover on my own. It's kind of a backroute way to do this, but it avoids having to import a whole other module.

The LIST API call with option 14 outputs the impedance correction table data to a report (you just need to redirect the report output to a specific file.) Then I can read the report file to gather the data.

It does still annoy me that there is no direct API call for impedance table data like there are for areas, zones, buses, branches, and so on (like aAreaInt), but at least I have some means of retrieving the data. I can only hope that the next version of PSSE cleans this up.

2014-10-03 07:33:43 -0500 received badge  Famous Question (source)
2014-10-02 20:22:21 -0500 received badge  Notable Question (source)
2014-10-02 20:22:21 -0500 received badge  Popular Question (source)
2014-10-01 07:08:49 -0500 asked a question How do I read the Impedance Correction Table data?

I am using PSSE version 33.4, and there is a section in the model for Impedance Correction data. I have found the API call IMPEDANCE CORRECTION DATA (with underscores, of course), which can be used to update the table, but at the moment, I cannot find a way to merely read said data.

Does such an API call exist?

Thanks.