What can be wrong with the following code snippet written for search-skip-judge MPPT algorithm. It is based on equipower line in I-V plot that helps skip voltage ranges
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
function [V_mpp, P_mpp, duty_cycle] = SSJ_GMPPT(V_pv, I_pv, V_oc_mod, n, V_out)
% SSJ-GMPPT Maximum Power Point Tracking
%   Inputs:
%     V_pv: PV voltage measurement
%     I_pv: PV current measurement
%     V_oc_mod: Open-circuit voltage of a single PV module
%     V_oc_string: Open-circuit voltage of the PV string
%     n: Number of PV modules in the string
%     V_out: Output voltage of the boost converter
%
%   Outputs:
%     V_mpp: MPP voltage
%     P_mpp: MPP power
%     duty_cycle: Duty cycle for the boost converter
% Persistent Variables
persistent V_ref P_m V_m I_sc_prev j V_end dP_dV_prev V_prev P_prev I_prev I_sc;
% Initialization
if isempty(V_ref)
    % Initialize parameters
    V_ref = 0.6 * V_oc_mod; % Initial operating voltage 
    V_end = 0.9 * n * V_oc_mod; % Ending voltage 
    P_m = 0; % Initialize maximum power
    V_m = 0; % Initialize voltage at maximum power 
    I_sc_prev = 0; % Initialize previous short circuit current
    j = 1; % Initialize module counter 
    dP_dV_prev =0;
    V_prev =0;
    P_prev =0;
    I_prev =0;
    I_sc = 0;
end
dV = 0.2;  % Voltage increment
V_mpp = 0; % Initialize V_mpp to a default value
P_mpp = 0; % Initialize P_mpp to a default value
duty_cycle = 0; % Initialize duty_cycle to a default value
% 1. Searching Process (Incremental Conductance Method)
P_pv = V_pv .* I_pv; % Calculate PV power
% Calculate derivatives
if ~isempty(V_prev)
    dP_dV = (P_pv - P_prev) / (V_pv - V_prev);
    dI_dV = (I_pv - I_prev) / (V_pv - V_prev);
    % IncCond conditions
     if (dP_dV / P_pv)  == (- dI_dV/I_pv)
        P_m = P_pv;
        V_m = V_pv;
        V_ref = V_ref + dV; % Perturb voltage forward
   elseif dP_dV > 0
        V_ref = V_ref + dV; % Perturb voltage forward
    else
         V_ref = V_ref - dV;
    end
else
    dP_dV = 0;
    dI_dV = 0;
    V_ref = V_ref + dV;
end
V_prev = V_pv;
P_prev = P_pv;
I_prev = I_pv;
% 2. Check for SDP (Sign change of dp/dv)
SDP_found = false;
if ~isempty(dP_dV_prev) && (dP_dV_prev < 0 && dP_dV > 0)
    SDP_found = true;
    I_sc = I_pv; % Current of SDP 
end
dP_dV_prev = dP_dV;
% 3. Skipping Process
if SDP_found
    V_ref_new = P_m / I_sc; % New operating voltage 
    if V_ref_new > V_end
        % GMPP found, end algorithm
        V_mpp = V_m;
        P_mpp = P_m;
        % Duty cycle generation
        duty_cycle = V_mpp / V_out;
        return;
    end
    V_ref = V_ref_new;
    j = j + 1; % Increment module counter 
    I_sc_prev = I_sc; % Update previous short circuit current
end
% 4. Judging Process
if SDP_found
     if I_pv > 0.85 * I_sc && dP_dV > 0  % Checking condition 
        % Return to searching process 
    else
        % Return to skipping process 
        V_ref = P_m / I_sc;
        if V_ref > V_end
            V_mpp = V_m;
            P_mpp = P_m;
             % Duty cycle generation
             duty_cycle = V_mpp / V_out;  
            return;
        end
        j = j + 1;
        I_sc_prev = I_sc;
    end
end
% Duty cycle generation
duty_cycle = V_ref / V_out; 
end
0 Commenti
Risposte (0)
Vedere anche
Categorie
				Scopri di più su Electrical Sensors in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
