Ask Your Question
0

How to save report data to program memory?

asked 2019-07-29 08:18:28 -0500

municipalpower gravatar image

updated 2019-07-29 08:19:42 -0500

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-07-29 12:04:41 -0500

drsgao gravatar image

I kinda get what you mean, but not fully. Advise if I got something wrong.

I think your situcation is that your SAV is shared or you are not the only person modifying it? That's why you don't always know what have got switched out?

If that's case, I think you can do the followings (assuming your bus numbers are not changed and no bus removal or addtion and no branches added or removed).

  1. Use the "abrnint" API to get the status of the all branches. Save the branch data in a CSV (or something else you like and know how to retrive data).
  2. Get rid of the branches that you don't want to change back. You can id them by the "from" and "to" buses. (You can actually do this in step 1 if you know the "from" and "to" buses for these branches.)
  3. After the SAV is changed. Use the previouly saved CSV to switch all of them back (regarless of the status). You can use the "branchchng" API for that. Don't worry about the line params, just use the defaults, e.g., "i", "_f".
  4. Now, switch the lines out accroding the status in the CSV. Again, using the "branch_chng" API.

This work-flow should satify your requirements of swithcing all branches back (except the undersired ones) and then siwth out the ones that are in your record.

You can probably still use the "outs" API with manipulations to perform delimiting and then extract the info.

edit flag offensive delete link more

Comments

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.

municipalpower gravatar imagemunicipalpower ( 2019-07-29 12:18:29 -0500 )edit

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-07-29 08:18:28 -0500

Seen: 62 times

Last updated: Jul 29