% ECEN5807 % find maximum power point in the PV module/array data generated by pv_array_char.mdl % the manual switch should be in the "single curve" position % (if the manual switch is in the "family of curves" position, simulation % time Tsim should ne increased to 5 seconds) % S = 1000; % solar irradiation [W/m^2] Tsim = 1; % simulate over one second, enough for one curve maxstep = 0.001; % use short time step to improve accuracy of finding MPP sim('pv_array_char.mdl'); % run Simulink % % find maximum and display result in the main MATLAB window pmax = max(PV.signals.values(:,2)); vrange = max(PV.signals.values(:,1)); irange = max(PV.signals.values(:,3)); [tf,index]=ismember(pmax,PV.signals.values(:,2)); disp(' MPP power: ') disp(PV.signals.values(index,2)); disp(' MPP voltage: ') disp(PV.signals.values(index,1)); disp(' MPP current: '); disp(PV.signals.values(index,3)); % % plot characteristics figure(1) plot(PV.signals.values(:,1),PV.signals.values(:,2)); % plot P(Vpv) axis([0 vrange 0 pmax]); grid on; figure(2) plot(PV.signals.values(:,1),PV.signals.values(:,3)); % plot Ipv(Vpv) axis([0 vrange 0 irange]); grid on;