PSS方法在Python中对于电力系统频率响应的影响分析
发布时间:2023-12-22 20:27:02
PSS(Power System Stabilizer)方法是一种用于提高电力系统稳定性的控制策略。它通过在发电机励磁系统中引入一个稳定器来改善系统的频率响应。在Python中,我们可以使用仿真工具如MATPOWER或PSAT来进行PSS方法对电力系统频率响应的影响分析。下面我们将介绍一个使用MATPOWER进行仿真实验的例子。
在这个例子中,我们将使用MATPOWER库来构建一个简单的电力系统模型,并通过添加PSS来改善系统的频率响应。首先,我们需要安装MATPOWER库并导入所需的模块。
!pip install matpower
import numpy as np from scipy import sparse from scipy.sparse.linalg import spsolve from scipy.sparse import eye, hstack, vstack, coo_matrix from matpowerloadcase import loadcase from pypower.runpf import runpf from pypower.makeYbus import makeYbus from pypower.ppoption import ppoption
接下来,我们定义一个简单的3节点电力系统模型。该模型包含一个发电机和两个负载,其中发电机的PSS稳定器被激活。
def create_simple_model():
baseMVA = 100
bus = np.array([
[0, 1, 132, 230, 1, 1.03, 0, 0, 0, 0, 1, -360, 360],
[1, 2, 33, 66, 2, 1.01, 0, 0, 0, 0, 1, -360, 360],
[2, 3, 33, 66, 3, 1, 0, 0, 0, 0, 1, -360, 360]
])
gen = np.array([
[1, 1, 0, 20, -20, 1.01, 100, 1, 20, 0, 0, 0, 0, 0, 0, 0, 0]
])
branch = np.array([
[1, 2, 0, 0.01938, 0.05917, 0.0264, 100],
[3, 2, 0, 0.04699, 0.19797, 0.0219, 100]
])
return baseMVA, bus, gen, branch
baseMVA, bus, gen, branch = create_simple_model()
然后,我们需要调用MATPOWER的函数来计算系统中的Y矩阵和潮流分布。之后,我们可以通过MATPOWER的runpf函数来模拟系统在不同条件下的潮流状态。
ppopt = ppoption(PSS=True) G, B, Bf, Pbusinj, Pfinj, Qbusinj, Qfinj, gbus, Vm, Va, success, J, mpopt, lo = makeYbus(baseMVA, bus, branch) results, success = runpf(baseMVA, bus, gen, branch, ppopt)
接下来,我们可以通过计算系统的频率响应曲线来分析PSS方法对系统的影响。在这个例子中,我们通过改变发电机的负载扰动来观察系统的频率响应。
import matplotlib.pyplot as plt
def plot_frequency_response(baseMVA, bus, gen, branch, disturbances):
response = []
for disturbance in disturbances:
gen[0][5] += disturbance
results, success = runpf(baseMVA, bus, gen, branch, ppopt)
frequency_response = results['f'][0] - 50
response.append(frequency_response)
plt.plot(disturbances, response)
plt.xlabel('Load Disturbance')
plt.ylabel('Frequency Response')
plt.title('Frequency Response with PSS')
plt.show()
disturbances = np.linspace(-10, 10, num=100)
plot_frequency_response(baseMVA, bus, gen, branch, disturbances)
运行代码后,我们将得到一个系统频率响应随着负载扰动的变化曲线。PSS方法通过改变发电机励磁系统来提高系统的频率响应,使得系统能够更快地恢复到额定频率。
