args1 = (3300,40,50,57.5,4225,43.75,46.25,48.75,2910,55.8,57,58.2)
args2 = (800, 0,200,0,200,0,100,0,100,0,100,0,100,0,50,0,50,0,50)
cons = con(args2)
x0 = np.random.uniform(10, 400, 9) # 初值
res = minimize(fun(args1), x0, method=‘SLSQP’, constraints=cons)
print(‘FGi-代价:’, res.fun)
print(res.success)
x=res.x
pI11 = x[0]
pI12 = x[1]
pI13 = x[2]
pI21 = x[3]
pI22 = x[4]
pI23 = x[5]
pI31 = x[6]
pI32 = x[7]
pI33 = x[8]
PG1 = 100 + pI11 + pI12 + pI13
PG2 = 100 + pI21 + pI22 + pI23
PG3 = 50 + pI31 + pI32 + pI33
PD=800
线路潮流
PL12 = 0 * PG1 - (2 / 3) * PG2 - (1 / 3) * (PG3 - PD)
PL13 = 0 * PG1 - 0.5 * (1 / 3) * PG2 - (1 / 3) * (PG3 - PD)
PL23 = 0 * PG1 + (1 / 3) * PG2 - (1 / 3) * (PG3 - PD)
原理注解
PL13 = 0.5 * ((0.01 + 0.01) * (PG3 - 800) + 0.01 * PG2) / (0.01 + 0.01 + 0.01)
PL12 = ((0.01 + 0.01) * PG2 + 0.01 * (PG3 - 800)) / (0.01 + 0.01 + 0.01)
PL23 = ((0.01 + 0.01) * (PG3 - 800) + 0.01 * PG1) / (0.01 + 0.01 + 0.01)
print(‘机组PG1=’, PG1)
print(‘机组PG2=’, PG2)
print(‘机组PG3=’, PG3)
print(‘线路PL13=’, np.abs(PL13))
print(‘线路PL12=’, np.abs(PL12))
print(“线路PL23=”, np.abs(PL23))
if name == “main”:
main()
结果