Ask Your Question
0

How do i change load in loop?

asked 2019-06-28 09:18:49 -0500

Max Börjesson gravatar image

updated 2019-06-28 09:54:51 -0500

Hi!

I try to change the load at a bus in a loop. Although it successfully changes the load each iteration it only uses the first load change (outputs same results for each iteration). How do i solve this?

busA = int(input('Enter BusA: '))
busB = int(input('Enter BusB: '))
cktAB = str(input('Enter line ID (usually 1): '))

fdist = float(input('Fault distance from BusA [%]: '))
Rff = float(input('Fault resistance [Ohm]: '))
Rf = Rff/((135*135*1e3)/mvabas)

busL = int(input('Enter load bus: '))
Pmax = int(input('Enter maximum P: '))
QPr = float(input('Enter Q/P ratio: '))

psspy.psseinit(0)
psspy.case(CASE)

_i, _f = psspy.getbatdefaults()
for P in range(0,Pmax,50):
    ierr = psspy.load_chng_5(busL,r"""SC""",[_i,_i,_i,_i,_i,_i,_i],[float(P),Qpr*float(P),_f,_f,_f,_f,_f,_f])
    psspy.fnsl()
        options1=0, # disable tap stepping adjustment.
        options5=0, # disable switched shunt adjustment.
    )

    psspy.scmu_2(1,[_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f],cktAB)     # Need to run this first
    psspy.scmu_2(2,[9,busA,busB,1,1,0,0],[Rf,0.0,0.0,0.0,float(fdist)/100],cktAB)   # Fault
    psspy.scmu_2(3,[_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f],cktAB)   # Clear fault

    psspy.scinit()

    error, brnchIPOS_A =  psspy.scbrn2(busA,999999,cktAB,"IPOS")
    error, brnchINEG_A =  psspy.scbrn2(busA,999999,cktAB,"INEG")
    error, brnchIZERO_A = psspy.scbrn2(busA,999999,cktAB,"IZERO")
    error, brnchIA_A =  psspy.scbrn2(busA,999999,cktAB,"IA")
    error, brnchIB_A =  psspy.scbrn2(busA,999999,cktAB,"IB")
    error, brnchIC_A =  psspy.scbrn2(busA,999999,cktAB,"IC")
    error, brnchIPOS_B =  psspy.scbrn2(busB,999999,cktAB,"IPOS")
    error, brnchINEG_B =  psspy.scbrn2(busB,999999,cktAB,"INEG")
    error, brnchIZERO_B = psspy.scbrn2(busB,999999,cktAB,"IZERO")
    error, brnchIA_B =  psspy.scbrn2(busB,999999,cktAB,"IA")
    error, brnchIB_B =  psspy.scbrn2(busB,999999,cktAB,"IB")
    error, brnchIC_B =  psspy.scbrn2(busB,999999,cktAB,"IC")

    psspy.scdone()
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2019-06-28 11:29:29 -0500

Max Börjesson gravatar image

I solved it. PSS/E needs to be closed with:

psspy.pssehalt_2()
edit flag offensive delete link more

Comments

can you plese tell me where it is put?

asd111333555777 gravatar imageasd111333555777 ( 2020-04-29 09:32:46 -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

Stats

Asked: 2019-06-28 09:18:49 -0500

Seen: 420 times

Last updated: Jun 28 '19