某三节点系统如下图所示。线路阻抗标幺值 $Z_{L}=j0.1,\frac{Y_{l}}{2}=j0.01$ ,节点1: $S_{1}=2.8653+j1.2244$ ,节点2:$P_{2}=0.6661,U_{2}=1.05$ ,节点3:$U_{3}=1,\theta=0$ ,用牛顿拉夫逊法和P-Q解耦法计算潮流。并计算线路功率 。
In [25]:
from pypower.runpf import runpf
from numpy import array
from pypower.ppoption import ppoption
"""
Power flow data for 3 bus, 2 gen case from CTS.
Require pypower to run.
"""
from numpy import array
def case3():
"""Power flow data for 3 bus, 2 gen case from Cheng Tianshi.
Please see L{caseformat} for details on the case file format.
@return: Power flow data for 3 bus, 2 gen case from Cheng Tianshi.
"""
ppc = {"version": '2'}
ZL=0.1
YL=0.02
S1=2.8653+1.2244j
P2=0.6661
U2=1.05
##----- Power Flow Data -----##
## system MVA base
ppc["baseMVA"] = 100
S1=S1*ppc["baseMVA"]
P2=P2*ppc["baseMVA"]
## bus data
# bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
ppc["bus"] = array([
[1, 1,S1.real,S1.imag,0, 0, 1, 1, 0, 110, 1, 1.1, 0.9],
[2, 2, P2, 0, 0, 0, 1, 1, 0, 1, 110, 1.1, 0.9],
[3, 3, 0, 0, 0, 0, 1, 1, 0, 1, 110, 1.1, 0.9]
])
## generator data
# bus, Pg, Qg, Qmax, Qmin, Vg, mBase, status, Pmax, Pmin, Pc1, Pc2,
# Qc1min, Qc1max, Qc2min, Qc2max, ramp_agc, ramp_10, ramp_30, ramp_q, apf
ppc["gen"] = array([
[2, 0, 0, 300, -300, U2, 100, 1, 250, 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[3, 0, 0, 300, -300, 1, 100, 1, 250, 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
])
## branch data
#fbus, tbus, r, x, b, rateA, rateB, rateC, ratio, angle, status, angmin, angmax
ppc["branch"] = array([
[1, 2, 0, ZL, YL, 0, 0, 0, 0, 0, 1, -360, 360],
[1, 3, 0, ZL, YL, 0, 0, 0, 0, 0, 1, -360, 360],
[2, 3, 0, ZL, YL, 0, 0, 0, 0, 0, 1, -360, 360]
])
return ppc
ppopt=ppoption()
ppopt['PF_ALG']=1
ppopt['PF_MAX_IT']=10
ppopt['PF_TOL']=1e-3
result=runpf(casedata=case3(),ppopt=ppopt)
In [26]:
from math import cos ,sin,radians
cp=lambda m,d: complex(m*cos(radians(d)),m*sin(radians(d)))
U1=cp(0.948,-12.6)
U2=cp(1.05,-8.011)
Y12=10j
Y10=0.01j
S12=(U1**2)*Y10.conjugate()+(U1*(U1.conjugate()-U2.conjugate())*Y12.conjugate())
S12
Out[26]:
In [27]:
ppopt['PF_ALG']=2
ppopt['PF_MAX_IT']=10
result=runpf(casedata=case3(),ppopt=ppopt)