欢迎访问宙启技术站
智能推送

PSS方法在Python中对电力系统暂态稳定性的影响分析

发布时间:2023-12-22 20:24:01

PSS(Power System Stabilizer)是一种用于改善电力系统暂态稳定性的控制装置。它的主要作用是通过调节发电机励磁系统的励磁电流,以抵消由于系统扰动而导致的振荡现象,提高电力系统的稳定性。

在Python中,我们可以使用模拟电力系统的开源库PyPower来进行PSS方法的影响分析。PyPower是一个强大的Python库,提供了各种用于电力系统仿真和分析的函数和工具。

下面我们以一个简单的电力系统为例,来演示PSS方法在Python中的影响分析。

import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from scipy.interpolate import interp1d
import pypower.api as pp

# 定义电力系统模型函数
def power_system_model(x, t):
    # 获取系统状态变量
    delta = x[:N]
    omega = x[N:2*N]

    d_delta = omega

    # 计算机械功率输入
    Pm = np.interp(t, Pm_time, Pm_values)

    # 计算负载功率变化
    Pd = np.interp(t, Pd_time, Pd_values)

    # 计算系统频率变化
    d_omega = 1/M * (Pm - Pd - D*omega)

    # 计算电力系统节点电压、效应功率和节点注入功率
    V, Pg, Qg, Pl, Ql = pp.makeSbus(baseMVA, bus, gen, branch)

    d_x = np.concatenate([d_delta, d_omega])

    return d_x

# 定义电力系统参数
baseMVA = 100  # 基准功率(单位:MVA)
Pm_time = np.array([0, 10, 20, 30])  # 机械功率变化时间点
Pm_values = np.array([1, 0.8, 1.2, 1]) * baseMVA  # 机械功率变化值
Pd_time = np.array([0, 10, 20, 30])  # 负载功率变化时间点
Pd_values = np.array([0.5, 0.5, 1.5, 1.5]) * baseMVA  # 负载功率变化值
N = 3  # 发电机节点数
M = 2 * np.pi * 60  # 机械角速度
D = 0.1  # 阻尼系数

# 定义电力系统节点、发电机和支路参数
bus = np.array([[0, 1, 0, 0, 0, 1],
                [1, 2, 0, 0, 0, 1],
                [2, 3, 0, 0, 0, 1]])
gen = np.array([[0, 1, 0, 1, -1e4, 1],
                [1, 1, 0, 1, -1e4, 1],
                [2, 1, 0, 1, -1e4, 1]])
branch = np.array([[0, 1, 1, 0, 0, 1, 0],
                   [1, 2, 1, 0, 0, 1, 0],
                   [2, 0, 1, 0, 0, 1, 0]])

# 定义系统初始状态
delta0 = np.random.uniform(-0.2, 0.2, N)
omega0 = np.zeros(N)
x0 = np.concatenate([delta0, omega0])

# 定义仿真时间范围和步长
t = np.arange(0, 60, 0.01)

# 执行系统模拟和求解
x = odeint(power_system_model, x0, t)

# 绘制结果图
plt.plot(t, x[:, :N])
plt.xlabel('Time (s)')
plt.ylabel('Rotor Angle (rad)')
plt.title('Rotor Angle vs. Time')
plt.show()

上述代码中,我们首先导入了需要的库和模块,然后定义电力系统模型函数power_system_model,该函数根据系统状态和时间来计算角度和角速度的变化。接着定义了电力系统的各个参数,包括基准功率、机械功率变化时间点和值、负载功率变化时间点和值等。然后,我们通过调用PyPower库提供的函数,创建了电力系统的节点、发电机和支路参数。接下来,定义了系统的初始状态和仿真时间范围,并调用odeint函数进行系统模拟和求解。最后,通过matplotlib库绘制了模拟结果图。

在这个示例中,我们模拟了一个简单的电力系统,其中包括3个发电机节点。通过改变机械功率和负载功率,我们可以观察到系统中的发电机振荡现象。然后,我们可以采用PSS方法来改善系统的暂态稳定性,以抵消振荡现象。

综上所述,PSS方法在Python中的影响分析可以通过模拟电力系统并利用PyPower等工具进行实现。这样的分析可以帮助电力系统工程师评估PSS方法在实际系统中的效果,并优化系统的稳定性。