# How do I get the total generation MW in an Area using python in PSSE?

Hi,

I'm trying to use psspy.scal_2 to adjust an Area load. I'd like to adjust only the MW value, and have the MVAR scaled accordingly. I don't want generation to be scaled. I currently use VBA to create a python text file.

Here is roughly what I'm trying to do (example of changing from 5680->6000): psspy.scal_2(0,0,0,[1,1,0,1,0],[6000,AreaGenMW,0,0,0,0,0])

I know I can scale it based on a percentage and do this: psspy.scal_2(0,0,0,[1,2,0,1,0],[5.63,0,0,0,0,0,0])

But, if I do this, I have to know what the original case load is, which does take a little bit of time. I'd like for python to be able to just read the load as is, and put that into my first example code.

Basically, it seems I'm doing everything right, except for knowing how to do what I'm calling "AreaGenMW".

Thanks!

edit retag close merge delete

Sort by ยป oldest newest most voted

run scal_2 twice. First time to initialize it and get total MW values for load and generation and second time to execute the scaling. I load savnw.sav and for area 1 load, run the code below to scale it 125% :

area = 1
sid = 1
psspy.bsys(sid,0,[ 13.8, 500.],1,[area],0,[],0,[],0,[])
# SCAL_2 defined in API manual
moto, totals, ier = psspy.scal_2(sid,0,1,
[0,0,0,0,0],
[0.0,0.0,0.0,0.0,0.0,0.0,0.0]) #initialize for scaling.
# now totals[2] contains total generation in SID=1, which is area1
MWscale = 1.25
MVARscale = MWscale * 100.0                     #scale factor in percentage
psspy.scal_2(sid,0,2,
[_i,1,0,1,0],

more

Thanks this helped!

( 2018-12-26 12:22:32 -0500 )edit