AngeloCasi / FUGU-ARDUINO-MPPT-FIRMWARE

An open source Arduino ESP32 MPPT Charger firmware equipped with charging algorithms, WiFi, LCD menus & more!
Creative Commons Zero v1.0 Universal
514 stars 130 forks source link

P&O Algorithm #17

Open Shaopus opened 2 years ago

Shaopus commented 2 years ago

Hi I have a problem with mppt algorithm about your code, as follow:

if(powerInput>powerInputPrev && voltageInput>voltageInputPrev)     {PWM--;}  //  ↑P ↑V ; →MPP  //D--
else if(powerInput>powerInputPrev && voltageInput<voltageInputPrev){PWM++;}  //  ↑P ↓V ; MPP←  //D++
else if(powerInput<powerInputPrev && voltageInput>voltageInputPrev){PWM++;}  //  ↓P ↑V ; MPP→  //D++
else if(powerInput<powerInputPrev && voltageInput<voltageInputPrev){PWM--;}  //  ↓P ↓V ; ←MPP  //D--
else if(voltageOutput<voltageBatteryMax)                           {PWM++;}  //  MP MV ; MPP Reached - 

About P&O Algorithm, if(powerInput>powerInputPrev && voltageInput>voltageInputPrev), should increase PWM. However,your code is the opposite of it, Can you explain? Thank you!

Tomsan83 commented 2 years ago

i think it is ok, when power goes up and voltage as well, you are climbing on the curve of power on the right drection so you need to decrease PWM. You increase PWM when moving left and decrease when moving right. It is because the fact when voltage is MAX, the current is MIN and opposite. For detail go to Angelo project page: https://www.instructables.com/DIY-1kW-MPPT-Solar-Charge-Controller/ chart called PV iV graph op.regions.