PEController BSP v4
Board Support Package for PEController from Taraz Technologies
 
Loading...
Searching...
No Matches
Phase Locked Loop

Contains the declarations and procedures to implement Phase Locked Loop. More...

Modules

 Macros
 
 Type Definitions
 
 Structures
 
 Functions
 

Detailed Description

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

pll_lock_t pll = {0};
// Initializes the PLL module
void Init (void)
{
pll.coords = &gridTie.vCoor;
pll.compensator.Kp = .001f;
pll.compensator.Ki = .8f;
pll.compensator.dt = PWM_PERIOD_s;
pll.expectedGridFreq = 50;
pll.qLockMax = 10;
pll.dLockMin = 255;
pll.dLockMax = 375;
pll.cycleCount = (int)((1 / PWM_PERIOD_s) * 2);
PLL_Init(&pll);
}
// Poll the PLL module on every cycle and connect to the output if PLL is locked else disconnect
void Poll(void)
{
if (Pll_LockGrid(&pll) == PLL_LOCKED)
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