Contains the declarations and procedures to implement Phase Locked Loop.
More...
The first step for grid phase detection is to assign suitable compensator values and phase detection error settings for the PLL structure. Once configured the PLL should be run in every cycle to detect the voltage phase. Below programming example further describes the module usage
Grid Voltage Phase Detection
void Init (void)
{
}
void Poll(void)
{
GenerateOutput();
else
DisconnectOutput();
}
@ PLL_LOCKED
Definition pll.h:106
pll_states_t Pll_LockGrid(pll_lock_t *pll)
Lock the grid voltages using PLL.
Definition pll.c:152
void PLL_Init(pll_lock_t *pll)
Initialize the PLL structure.
Definition pll.c:58
float dt
Time interval in seconds for the PI compensator.
Definition dsp_library.h:112
float Kp
Kp parameter for the PI compensator.
Definition dsp_library.h:110
float Ki
Ki parameter for the PI compensator.
Definition dsp_library.h:111
Defines the parameters required by the PLL.
Definition pll.h:136
float dLockMax
Maximum value of D. If in a cycle defined by cycleCount the value remains smaller only than the PLL l...
Definition pll.h:146
float qLockMax
Maximum value of Q. If in a cycle defined by cycleCount the value remains less than this value the PL...
Definition pll.h:142
float dLockMin
Minimum value of D. If in a cycle defined by cycleCount the value remains greater only than the PLL l...
Definition pll.h:144
LIB_COOR_ALL_t * coords
Grid voltage coordinates in different coordinate systems.
Definition pll.h:137
pi_compensator_t compensator
PI compensator for Q adjustment.
Definition pll.h:138
int cycleCount
If the PLL remains lock for this many control loops than it will be considered locked.
Definition pll.h:148
float expectedGridFreq
Expected grid frequency
Definition pll.h:149