PLL

Description
Single-phase Phase-Locked Loop (PLL) with amplitude estimation (enhanced phase detector).
Inputs: - In: single-phase signal v(t). Parameters: - Ki_pd: amplitude integrator gain. - Kp_lf: proportional gain of the loop filter. - Ki_lf: integral gain of the loop filter. - InitFreq: nominal/initial frequency in Hz. - InitAngle: initial phase in degrees. - InitMag: initial amplitude estimate.
State equations: e = v - A * sin(phi) dA/dt = Ki_pd * e * sin(phi) err_phi = (e * cos(phi)) / max(|A|, 1e-4) dI_lf/dt = Ki_lf * err_phi omega = omega_nom + Kp_lf * err_phi + I_lf dphi/dt = omega
Outputs: - Freq: estimated frequency in Hz (omega / 2pi) - Angle: estimated phase in radians - Mag: estimated amplitude (same unit as input signal)
Library
Control > Math
Pins
| Name | Description |
|---|---|
| In | Input signal |
| Freq | Estimated Frequency [Hz] |
| Angle | Estimated Phase Angle [rad] |
| Mag | Estimated Magnitude |
Parameters
| Name | Description |
|---|---|
| SamplingTime | -none or 0: No sampling. The system will be solved in the Newton loop (default). -auto: Inherit the sampling time of its source device. -Sampling Period: defined in seconds. |