This design is meant to work for 50Hz or 60Hz as mentioned at page#18 of this application under the topic "Line Lock Detection".
If you can ask specific questions to the implementation of code,it will be possible for us to answer.
The issue is, I haven't understood the code in depth. For instance I know what each section of the code is supposed to do but I cannot understand what each line of the code does.
The first section that I tried to understand was mppt portion. I opened the mppt.c page and had a look at it for days. I know that in the switch case different states are being monitored such as a Self-Test, Wait and so on as shown in Page#20 of AN. But I can't understand what is happening inside each switch case.
If I start from the beginning of the .c file, then please could you tell me what the below mentioned macros are for?
#define MPPT_AVG_POWER_SIG (analog_Pslr_z3 >> 16)
#define MPPT_AVG_CURRENT_SIG (analog_Islr_z2 >> 16)
#define MPPT_AVG_VOLTAGE_SIG (analog_Vslr_z2 >> 16)
#define MPPT_CURRENT_SIG analog_Islr
#define MPPT_VOLTAGE_SIG analog_Vslr
And also how and why these scales are calculated? I did read the comments associated with it but I can't completely understand what is it for.
#define MPPT_UV_SCALING 62259
#define MPPT_BACKOFF_SCALING 62913