easy implementation for c code for mppt algo

MisterBill2

Joined Jan 23, 2018
19,414
The best explanation I read for understanding the Maximum POwer POint Did not describe any programming, but rather the logic involved. Programming language is for after you understand what is being done.
 

nsaspook

Joined Aug 27, 2009
13,552
The best explanation I read for understanding the Maximum POwer POint Did not describe any programming, but rather the logic involved. Programming language is for after you understand what is being done.
This is the age of AI. Just ask one of the new-fangled language search engines for the C code. No need to understand anything.

https://ww1.microchip.com/downloads/en/appnotes/00001521a.pdf
Practical Guide to Implementing Solar Panel MPPT Algorithms
 

Papabravo

Joined Feb 24, 2006
21,307
I forgot to mention that there are multiple choices for an MPPT algorithm. Knowing the characteristics of the panel will be useful in evaluating the alternatives. I think you might be a long way from that point.
 

MisterBill2

Joined Jan 23, 2018
19,414
There are two ways to repair things that have a failure: Either understand what the cause is and change out the cause, or simply check and replace parts until the problem stops. That may, or not effect a permanent fix, but it is almost always more costly and it usually takes much longer, and there almost always lurks the question of what was really the cause.
With software it is even more difficult because often the failure is more subtle.
 

nsaspook

Joined Aug 27, 2009
13,552
...
With software it is even more difficult because often the failure is more subtle.
and often the cause of the failure is like a water drip. You see the spot here, but the cause is up over there. Not being fooled is something you only learn from experience.
 

MisterBill2

Joined Jan 23, 2018
19,414
and often the cause of the failure is like a water drip. You see the spot here, but the cause is up over there. Not being fooled is something you only learn from experience.
"Experience" is similar to understanding what it is doing, or at least what it is supposed to be doing.
 

nsaspook

Joined Aug 27, 2009
13,552
"Experience" is similar to understanding what it is doing, or at least what it is supposed to be doing.
Understanding is the knowing about things. Experience is the knowing of things. You need both to be effective.

It's like knowing about twisting wires at a robot arm but not knowing of a slip-ring.
 
Last edited:

Juhahoo

Joined Jun 3, 2019
302
MPPT is not just one single method, there are several different approaches, here are the main ones explained.

https://www.hindawi.com/journals/ijp/2016/1728398/
https://www.ripublication.com/iraer-spl/iraerv4n2spl_10.pdf
https://www.greentechrenewables.com/article/whats-behind-mppt-algorithm
https://www.scitepress.org/papers/2017/64615/64615.pdf

code and implementation:
https://ww1.microchip.com/downloads/en/appnotes/00001521a.pdf
https://imperix.com/doc/implementation/maximum-power-point-tracking-mppt
https://coder-tronics.com/c2000-solar-mppt-tutorial-pt3/

As a starting point, I would go with the closed loop MPPT which allows you to seek constantly the MPPT and notes temperature, load and radiation conditions.
 
Last edited:

Jerry-Hat-Trick

Joined Aug 31, 2022
588
Information about finding the maximum power point is usually accompanied by a flow chart - a particularly good example of why I hate flow charts as they are usually harder to follow than a clear explanation in plain language.

Typically, the graph of current versus voltage of a PV panel is shown as:
1678183201556.png

For a PV panel the simplest approach is to have an algorithm which loops through small increments of increasing the current drawn (starting at the lower right of the blue curve), measuring the voltage, and multiplying the values to get power. As you move up the curve with increasing current the measured voltage will slowly drop. The power, being the product of voltage and current will continue to increase until you pass over the knee where the voltage drops significantly for a small increase in current - you've just passed the Maximum Power Point and, for a given luminosity, you have that value of voltage and current and power.

Once you are in the right region, or have just gone past the maximum power point, reduce the current by a small amount and check if the power is greater, smaller or the same. If the same, you are on the cusp of the maximum power point and can toggle back to the previous current, greater you can reduce the current by a(nother) small amount, smaller you can increase the current by a small amount. It's really simple code, an if statement with two else ifs. I think it's called "peturb and observe" algorithm. There are others which look at the slope of the curve etc. but what I have described is simple and robust.

Typically, you'd not start from a very low current but somewhere based on the open circuit voltage of the panel.

I now wait to be shot down............
 
Top