PLL在双馈风机中的作用
时间: 2024-06-22 11:02:52 浏览: 5
PLL(Phase-Locked Loop,锁相环路)在双馈风力发电机中起着关键的作用。双馈发电机通常用于风能转换,它允许发电机的定子和转子电路独立控制,这为效率优化和故障保护提供了灵活性。PLL的主要任务是:
1. **频率跟踪**:由于风速的变化,发电机输出的交流电频率会波动。PLL负责跟踪电网的实际频率,确保发电机输出与电网同步。
2. **相位锁定**:PLL通过比较电网电压和发电机电压,确保它们之间的相位差恒定,这对于电网的并网至关重要。
3. **无功功率控制**:通过调整电压幅值和相位,PLL能够控制发电机输出的无功功率,帮助电网稳定和提高整体电能质量。
4. **故障检测与隔离**:当系统发生故障时,PLL可以快速识别并隔离异常,防止故障扩大对整个风电系统的影响。
相关问题
PLL在stm32中是什么意思
在STM32微控制器中,PLL是Phase Locked Loop的缩写,即锁相环电路。它是一种电路,可以将输入时钟信号的频率倍增或者分频,从而得到更高精度和稳定性的时钟信号。在STM32中,PLL电路通常由一个或多个可编程分频器、一个相位比较器和一个可编程振荡器组成。PLL电路可以将输入时钟信号的频率放大几倍,从而得到更高频率的系统时钟信号。例如,当外部晶体振荡器提供8MHz的时钟信号时,通过PLL电路可以将其倍频至72MHz或者更高频率。这样可以提高系统的运行速度和精度,从而满足更高要求的应用场景。
在PMSM中的SMO+PLL代码
以下是一个基于STM32的PMSM电机控制器中,使用了基于滑模观察器(SMO)和锁相环(PLL)的代码示例:
```
#include "stm32f4xx.h"
#include "arm_math.h"
#define PI 3.14159265358979323846f
#define SQRT3 1.73205080756887729352f
// Motor parameters (需要根据具体电机的参数进行修改)
#define R_PHASE 0.83f
#define L_D 0.000354f
#define L_Q 0.000354f
#define POLE_PAIRS 7
// SMO parameters
#define SMO_LAMBDA 10.0f
#define SMO_BETA 1.0f
// PLL parameters
#define PLL_KP 0.5f
#define PLL_KI 0.01f
// Sampling frequency
#define FS 10000.0f
// Global variables
float32_t V_alpha, V_beta, V_d, V_q, I_alpha, I_beta, I_d, I_q, theta_elec, theta_mech;
float32_t Id_error, Iq_error, Id_ref, Iq_ref, Id_out, Iq_out, Vd_out, Vq_out;
float32_t smo_estimated_flux_d, smo_estimated_flux_q, smo_estimated_speed;
float32_t pll_estimated_speed, pll_error, pll_integral, pll_proportional;
float32_t sector_angle, sector_duty_cycle, period_ticks, pwm_ticks;
float32_t sin_theta, cos_theta, sin_theta_120, cos_theta_120, sin_theta_240, cos_theta_240;
// Sine and cosine lookup tables
const float32_t sin_table[360] = {...};
const float32_t cos_table[360] = {...};
// SMO function
void SMO(float32_t V_alpha, float32_t V_beta, float32_t I_alpha, float32_t I_beta, float32_t dt)
{
float32_t Lm, Ls, Rs, inv_Ls, sm_alpha, sm_beta, sm_d, sm_q, sm_flux_norm;
float32_t smo_error_d, smo_error_q, smo_error_norm, smo_psi_alpha, smo_psi_beta;
Lm = L_D + L_Q + (R_PHASE * dt) / 2.0f;
Ls = L_D + L_Q - (R_PHASE * dt) / 2.0f;
Rs = R_PHASE;
inv_Ls = 1.0f / Ls;
// Clarke transform
sm_alpha = I_alpha;
sm_beta = SQRT3 * I_beta - SQRT3 / 2.0f * I_alpha;
// Park transform
sm_d = cos_theta * sm_alpha + sin_theta * sm_beta;
sm_q = -sin_theta * sm_alpha + cos_theta * sm_beta;
// Compute estimated flux
smo_estimated_flux_d += dt * (-smo_estimated_flux_d * SMO_LAMBDA / Lm + sm_d);
smo_estimated_flux_q += dt * (-smo_estimated_flux_q * SMO_LAMBDA / Lm + sm_q);
sm_flux_norm = arm_sqrt_f32(smo_estimated_flux_d * smo_estimated_flux_d + smo_estimated_flux_q * smo_estimated_flux_q);
// Compute error between estimated and actual flux
smo_psi_alpha = Lm * Id_out + smo_estimated_flux_d;
smo_psi_beta = Lm * Iq_out + smo_estimated_flux_q;
smo_error_d = sm_d - (smo_psi_alpha * cos_theta + smo_psi_beta * sin_theta) * inv_Ls;
smo_error_q = sm_q - (-smo_psi_alpha * sin_theta + smo_psi_beta * cos_theta) * inv_Ls;
smo_error_norm = arm_sqrt_f32(smo_error_d * smo_error_d + smo_error_q * smo_error_q);
// Update estimated speed
smo_estimated_speed = (smo_estimated_flux_q * smo_error_d - smo_estimated_flux_d * smo_error_q) / (sm_flux_norm * sm_flux_norm + SMO_BETA);
// Compute d and q current estimates
Id_out = smo_psi_alpha * inv_Ls + smo_estimated_speed * smo_estimated_flux_q / sm_flux_norm;
Iq_out = smo_psi_beta * inv_Ls - smo_estimated_speed * smo_estimated_flux_d / sm_flux_norm;
}
// PLL function
void PLL(float32_t V_alpha, float32_t V_beta, float32_t I_alpha, float32_t I_beta, float32_t dt)
{
float32_t V_d_filtered, V_q_filtered, I_d_filtered, I_q_filtered, V_cross, I_cross;
// Clarke transform
I_alpha = I_alpha;
I_beta = SQRT3 * I_beta - SQRT3 / 2.0f * I_alpha;
// Park transform
I_d = cos_theta * I_alpha + sin_theta * I_beta;
I_q = -sin_theta * I_alpha + cos_theta * I_beta;
// Compute Vd and Vq
V_d = V_alpha - Rs * I_d - smo_estimated_speed * smo_estimated_flux_q;
V_q = V_beta - Rs * I_q + smo_estimated_speed * smo_estimated_flux_d;
// Low-pass filter Vd and Vq
V_d_filtered += dt * (V_d - V_d_filtered) / (L_D * 2.0f * PI * 1000.0f + dt);
V_q_filtered += dt * (V_q - V_q_filtered) / (L_Q * 2.0f * PI * 1000.0f + dt);
// Low-pass filter Id and Iq
I_d_filtered += dt * (I_d - I_d_filtered) / (L_D * 2.0f * PI * 1000.0f + dt);
I_q_filtered += dt * (I_q - I_q_filtered) / (L_Q * 2.0f * PI * 1000.0f + dt);
// Compute V and I cross products
V_cross = V_d_filtered * I_q_filtered - V_q_filtered * I_d_filtered;
I_cross = I_d_filtered * smo_estimated_flux_q - I_q_filtered * smo_estimated_flux_d;
// Compute estimated speed
pll_error = V_cross / (V_cross * V_cross + I_cross * I_cross);
pll_integral += pll_error * dt;
pll_proportional = pll_error * PLL_KP;
pll_estimated_speed = pll_proportional + pll_integral * PLL_KI;
}
// PWM function
void PWM(float32_t duty_cycle)
{
if (duty_cycle < 0.0f) {
duty_cycle = 0.0f;
} else if (duty_cycle > 1.0f) {
duty_cycle = 1.0f;
}
if (duty_cycle > 0.0f) {
TIM1->CCR1 = (uint16_t)(duty_cycle * pwm_ticks);
TIM1->CCR2 = (uint16_t)(duty_cycle * pwm_ticks);
TIM1->CCR3 = (uint16_t)(duty_cycle * pwm_ticks);
} else {
TIM1->CCR1 = 0;
TIM1->CCR2 = 0;
TIM1->CCR3 = 0;
}
}
// Main function
int main(void)
{
// Initialize GPIO pins, timers, ADC, etc.
// Main loop
while (1) {
// Read ADC values and convert to currents and voltages
V_alpha = ...;
V_beta = ...;
I_alpha = ...;
I_beta = ...;
// Compute electrical and mechanical angles
theta_elec += 2.0f * PI * (pll_estimated_speed / (POLE_PAIRS * FS));
if (theta_elec >= 2.0f * PI) {
theta_elec -= 2.0f * PI;
}
theta_mech = theta_elec / POLE_PAIRS;
// Compute sector angle and duty cycle
sector_angle = theta_mech / (2.0f * PI / 3.0f);
if (sector_angle < 0.0f) {
sector_angle += 3.0f;
}
if (sector_angle >= 3.0f) {
sector_angle -= 3.0f;
}
if (sector_angle < 1.0f) {
sector_duty_cycle = sin_theta / 2.0f + cos_theta / SQRT3 * sin_theta_120 / 2.0f;
} else if (sector_angle < 2.0f) {
sector_duty_cycle = cos_theta / SQRT3 * sin_theta_120 / 2.0f - sin_theta / 2.0f;
} else {
sector_duty_cycle = -cos_theta / SQRT3 * sin_theta_120 / 2.0f - cos_theta / 2.0f;
}
// Compute period and PWM ticks
period_ticks = (uint32_t)(SystemCoreClock / (POLE_PAIRS * FS));
pwm_ticks = (uint32_t)(period_ticks * sector_duty_cycle);
// Run SMO and PLL
SMO(V_alpha, V_beta, I_alpha, I_beta, 1.0f / FS);
PLL(V_alpha, V_beta, I_alpha, I_beta, 1.0f / FS);
// Compute Id and Iq references
Id_error = Id_ref - Id_out;
Iq_error = Iq_ref - Iq_out;
// Run PI controllers for Id and Iq
Vd_out = Id_error * L_D * 2.0f * PI * 1000.0f + Iq_error * smo_estimated_speed * L_Q * 2.0f * PI * 1000.0f;
Vq_out = Iq_error * L_Q * 2.0f * PI * 1000.0f - Id_error * smo_estimated_speed * L_D * 2.0f * PI * 1000.0f;
// Run PWM
PWM(sector_duty_cycle);
}
}
```
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)