Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In order to get a load flow case with the P and Q flow between two busses at a particular level, do an iterative process: - run load flow - measure P and Q flow - adjust P and Q for the generator

here is some sample code: def dispatchpandpf(psetpoint, pfsetpoint, pgenbus, qgenbus, Qfrombus, Qtobus, Pfrombus, Ptobus): # itteratively adjusts two machines in the load flow case, until the P and Q flows between the measbus and pocbus match the setpoints. # The machines at which P and Q are afjusted are allowed to be different, for cases where P is set by a genertor and Q by a STATCOM psched = psetpoint
q
sched = defaultpsp sqrt((1/pf_setpoint)*2 - 1) * np.sign(pfsetpoint) count = 0 pgen = psched qgen = qsched print('Perror \tQerror \tPctrl \tQctrl \tPgen \tQgen' ) while count < nbrsolveiterations: psspy.machinechng2(pgenbus,r"""1""",[i,i,i,i,i,i],[ pgen,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f])
psspy.machine
chng2(qgenbus,r"""1""",[i,i,i,i,i,i],[ _f,qgen,qgen,qgen,f,f,f,f,f,f,f,f,f,f,f,f])
psspy.fdns([0,2,0,0,0,0,99,0]) psspy.fdns([0,2,0,0,0,0,99,0]) ierr, pcontrol = psspy.brnmsc(Pfrombus, Ptobus, '1','P') ierr, qcontrol = psspy.brnmsc(Qfrombus, Qtobus, '1','Q') perror = psched - pcontrol qerror = qsched - qcontrol if abs(perror) < errortol and abs(qerror) < errortol : break # the systesm is now set up correctly pgen = pgen + perror if pgen > Pbase: pgen = Pbase
q
gen = qgen + qerror

    count +=1
print('%3.2f \t%3.2f \t%3.2f \t%3.2f \t%3.2f \t%3.2f' % (p_error, q_error, p_control, q_control, p_gen, q_gen))
click to hide/show revision 2
No.2 Revision

In order to get a load flow case with the P and Q flow between two busses at a particular level, do an iterative process: - run load flow - measure P and Q flow - adjust P and Q for the generator

here is some sample code: code:

def dispatchpandpf(psetpoint, pfsetpoint, pgenbus, qgenbus, Qfrombus, Qtobus, Pfrombus, Ptobus):
dispatch_p_and_pf(p_setpoint, pf_setpoint, p_gen_bus, q_gen_bus, Q_from_bus, Q_to_bus, P_from_bus, P_to_bus):
    # itteratively iteratively adjusts two machines in the load flow case, until the P and Q flows between the measbus and pocbus meas_bus and poc_bus match the setpoints.
    # The machines at which P and Q are afjusted adjusted are allowed to be different, for cases where P is set by a genertor generator and Q by a STATCOM
    psched = psetpoint 
q
sched = defaultpsp sqrt((1/pf_setpoint)*2 p_sched = p_setpoint q_sched = default_p_sp *sqrt((1/pf_setpoint)**2 - 1) * np.sign(pfsetpoint) np.sign(pf_setpoint) count = 0 pgen = psched qgen = qsched p_gen = p_sched q_gen = q_sched print('Perror \tQerror \tPctrl \tQctrl \tPgen \tQgen' ) while count < nbrsolveiterations: psspy.machinechng2(pgenbus,r"""1""",[i,i,i,i,i,i],[ pgen,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f])
psspy.machine
chng2(qgenbus,r"""1""",[i,i,i,i,i,i],[ _f,qgen,qgen,qgen,f,f,f,f,f,f,f,f,f,f,f,f])
nbr_solve_iterations: psspy.machine_chng_2(p_gen_bus,r"""1""",[_i,_i,_i,_i,_i,_i],[ p_gen,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f]) psspy.machine_chng_2(q_gen_bus,r"""1""",[_i,_i,_i,_i,_i,_i],[ _f,q_gen,q_gen,q_gen,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f]) psspy.fdns([0,2,0,0,0,0,99,0]) psspy.fdns([0,2,0,0,0,0,99,0]) ierr, pcontrol = psspy.brnmsc(Pfrombus, Ptobus, p_control = psspy.brnmsc(P_from_bus, P_to_bus, '1','P') ierr, qcontrol = psspy.brnmsc(Qfrombus, Qtobus, q_control = psspy.brnmsc(Q_from_bus, Q_to_bus, '1','Q') perror = psched - pcontrol qerror = qsched - qcontrol p_error = p_sched - p_control q_error = q_sched - q_control if abs(perror) abs(p_error) < errortol and abs(qerror) error_tol and abs(q_error) < errortol error_tol : break # the systesm is now set up correctly pgen = pgen p_gen = p_gen + perror p_error if pgen p_gen > Pbase: pgen p_gen = Pbase
q
gen = qgen q_gen = q_gen + qerror

q_error

        count +=1
 print('%3.2f \t%3.2f \t%3.2f \t%3.2f \t%3.2f \t%3.2f' % (p_error, q_error, p_control, q_control, p_gen, q_gen))