# PSSPY.(what?) Reactive power

I am using PSSE33. I need to know the API for Python to modify the reactive power of any type of bus (load or no-load, generator, non-generator) from a list of buses.

In addition, I wonder if it's better to modify shunt adjustments or to modify the reactive power load.

edit retag close merge delete

@Hector, what is the outcome you are after here?

( 2013-04-04 19:26:37 -0500 )edit

Sort by ยป oldest newest most voted

There is more than one right way to do it. What are you trying to achieve @Hector?

Different buses will require different types of control.

• PQ where you can directly control the Power and Reactive Power; and
• PV where you can control the Power and Voltage. The reactive power will change to support the set voltage.

I'm sure you already know the above, but some other students reading might not.

Are you writing a QV Curve generator?

Here is some starter code:

def main():

buses = [101, 102, 103] # these should be PQ type buses
for bus in buses
load = {'ql': 20} # Constant MVAr


and if you were curious about where that add_load_to function comes from? Here is the code.

import uuid

Returns load dictionary with new id ('id') and bus number ('i') set
"""
bus,
id=newid,
realar1=load.get('pl', 0)    # set PL [default 0]
realar2=load.get('ql', 0)    # set QL [default 0]
)

"""Returns a random available load id for a bus."""
while True:
newid = uuid.uuid4().hex[:2]
if newid not in taken_ids:
break
return newid

"""returns existing load ids in a list for a bus."""
-1,                # all buses
string=["NUMBER"]) # get bus number
-1,                # all buses

# converts [[101], [102]] and [['1'], ['2']] to [[101, '1'], [102, '2']]
allbuses = zip(zip(*buses)[0], zip(*ids)[0])
return [id for (bus, id) in allbuses if target_bus == bus]


I didn't test this code out with PSSE. I think it should work though.

(edit) Compare using add_load_to with load_data_3 or load_data_4:

load = {'ql': 20}

# versus



The problem with load_data_4 is that if there is already a load with id '1 ' then it will be overwritten, add_load_to never overwrites a load because it creates a new unique load id for you.

more

That's good. I have to define "add_load_to" for Python, isn't it? Now I have found the function "load_data_4" from PSSE to do the same. I am using it but id does not work. I get this in the prompt:

( 2013-04-05 08:43:14 -0500 )edit

ierr = psspy.load_data_4(x, 1, [1,1,1,1,0,0], [20,20,0,0,0,0]) File ".\psspy.py", line 22150, in load_data_4 TypeError: must be string, not int I don't understand what argument should be a string. In the API document for load_data_4 there is no string.

( 2013-04-05 08:44:22 -0500 )edit

I fixed it. The second argument is a string: '1'.

( 2013-04-05 08:53:14 -0500 )edit

yep the second argument is a string, I believe you can still use load_data_3 in PSSE33 is that right? So unless I make a mistake in my code (it isn't tested) it should work fine. so my function add_load_to is a wrapper for load_data_x where x can be 3 or 4.

( 2013-04-05 17:10:12 -0500 )edit