First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
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()
2 | retagged |
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()