Use the software Phase Locked Loop.
Introduction
The PllSinus
is used to track sinusoid and extract angle and pulsation.
It is included in the filters.cpp
module.
Parameters:
- We set \(f_0\) the frequency of the signal to track linked with \(\omega_0=2.\pi.f_0\).
- \(\Delta \omega\) has been arbitrarily fixed to be 20% of \(\omega_0\).
- \(K_p, T_i\) parameters are computed using the
rise_time
of the closed loop, which fix the dynamic of the PLL and we have also to take into account of theamplitude
of the signal.
Use of the PllSinus
filter.
The use of the `PllSinus is based on 3 steps.
- Object instanciation (declaration).
- Initialisation.
- Execution.
Example
We define constants used to initialize the parameter structure.
#include "filters.h"
static float32_t amplitude = 16.0F; // amplitude of the voltage sinus to track.
static float32_t f0 = 50.0; // frequency assumed of the signal to track [Hz]
static float32_t rise_time = 50.e-3F; // dynamic of the loop [s].
static float32_t Ts = 100.0e-6F; // sampling time [s]
We define the variable pll
which is an instance of PllSinus
object.
In the setup_routine()
of the OwnTech Power API,
you must initialize the PllSinus
with its parameters.
In the loop_critical_task()
you can call the method calculateWithReturn()
pll_datas
is a structure which kept the results of the PllSinus calculation for one step.
the PllData structure has 3 fields:
struct PllDatas {
float32_t w; // estimated pulsation [rad/s]
float32_t angle; // estimated angle [rad]
float32_t error; // angle error [rad]
};
Note
Remind that the loop_critical_task()
is called at the sampling time you define and
must be equal to \(T_s\).
Example
You can find a pll use with the grid following example which requires a synchronisation to inject current in parallel with a voltage source.