The code for the dV/dP Feedback Control MPPT algorithm needs to be ported over from Python into the mppt rewrite code.
The base for the code can be taken from MPPTV3/mppt/IC.h. The file should be named FC.h, and the class named FC.
The code to port is in /home/rasbox/UTSVTBox/MPPT/sim/src/mppt_algorithms/mppt_dP_dV_feedback_control.py. The relevant sections are presented below:
error = .05
p_in = v_in * i_in
dP = p_in - self.p_old
dV = v_in - self.v_old
dV_ref = self.calc_perturb_amt(self.v_ref, v_in, i_in, t_in)
if dV == 0: # we reached the mppt in the last iteration, but we need to keep moving in case mppt changes
self.v_ref += .005
elif abs(dP/dV) < error: # we reached the mppt in this iteration, don't move
pass
else:
if dP/dV > 0:
self.v_ref += dV_ref
else:
self.v_ref -= dV_ref
# update values
self.v_old = v_in
self.i_old = i_in
self.p_old = p_in
We also need to add the class to the main.cpp. Follow how it is done for the PandO and IC mppt objects.
First, declare the import in the includes section:
The code for the dV/dP Feedback Control MPPT algorithm needs to be ported over from Python into the mppt rewrite code. The base for the code can be taken from
MPPTV3/mppt/IC.h
. The file should be namedFC.h
, and the class namedFC
. The code to port is in/home/rasbox/UTSVTBox/MPPT/sim/src/mppt_algorithms/mppt_dP_dV_feedback_control.py
. The relevant sections are presented below:We also need to add the class to the
main.cpp
. Follow how it is done for the PandO and IC mppt objects. First, declare the import in the includes section:Then we declare it the globals:
Then we assign it in the CAN command parsing: