Power Electronic Converters for Microgrids (Sharkh/Power Electronic Converters for Microgrids) ||...

4
Appendix B DC-Link Capacitor Current Numerical Calculation % MATLAB code for numerical calculation of (normalized) dc-link capacitor % rms current and peak-peak voltage ripple for NPC and CHB 3L inverters. %INPUTS %------------------------------- M = 2/sqrt(3); % Modulation index phi = 30/180*pi; % Power angle in rads strategy = 2; % 1:SPWM, 2:SPWM+1/6 3rd harm., 3: SVM HBperPh = 2; % Number of H-bridge cells (per phase) for the ML CHB %------------------------------- %NORMALISATION %------------------------------- f = 1; % Reference frequency in Hz C = 1; % Capacitance of dc-link capacitors in F Io_mag = sqrt(2); % Magnitude of phase current in A %------------------------------- %CALCULATION %------------------------------- dTheta = 2*pi/180; count = 0; i_d_NPC_rmssq = 0; % i.e. i_d_NPC_rms square i_d_NPC_dc = 0; i_d_CHB_rmssq = 0; % i.e. i_d_CHB_rms square i_d_CHB_dc = 0; i_d_NPC = zeros(1); Power Electronic Converters for Microgrids, First Edition. Suleiman M. Sharkh, Mohammad A. Abusara, Georgios I. Orfanoudakis and Babar Hussain. © 2014 John Wiley & Sons, Ltd. Published 2014 by John Wiley & Sons, Ltd. Companion Website: www.wiley.com/go/sharkh

Transcript of Power Electronic Converters for Microgrids (Sharkh/Power Electronic Converters for Microgrids) ||...

Page 1: Power Electronic Converters for Microgrids (Sharkh/Power Electronic Converters for Microgrids) || DC-Link Capacitor Current Numerical Calculation

Appendix B

DC-Link Capacitor CurrentNumerical Calculation

% MATLAB code for numerical calculation of (normalized)dc-link capacitor% rms current and peak-peak voltage ripplefor NPC and CHB 3L inverters.

%INPUTS%-------------------------------M = 2/sqrt(3); % Modulation indexphi = 30/180*pi; % Power angle in radsstrategy = 2; % 1:SPWM, 2:SPWM+1/6 3rd harm., 3: SVMHBperPh = 2; % Number of H-bridge cells (per phase) for the ML CHB%-------------------------------

%NORMALISATION%-------------------------------f = 1; % Reference frequency in HzC = 1; % Capacitance of dc-link capacitors in FIo_mag = sqrt(2); % Magnitude of phase current in A%-------------------------------

%CALCULATION%-------------------------------dTheta = 2*pi/180;count = 0;i_d_NPC_rmssq = 0; % i.e. i_d_NPC_rms squarei_d_NPC_dc = 0;i_d_CHB_rmssq = 0; % i.e. i_d_CHB_rms squarei_d_CHB_dc = 0;i_d_NPC = zeros(1);

Power Electronic Converters for Microgrids, First Edition. Suleiman M. Sharkh, Mohammad A. Abusara,Georgios I. Orfanoudakis and Babar Hussain.© 2014 John Wiley & Sons, Ltd. Published 2014 by John Wiley & Sons, Ltd.Companion Website: www.wiley.com/go/sharkh

Page 2: Power Electronic Converters for Microgrids (Sharkh/Power Electronic Converters for Microgrids) || DC-Link Capacitor Current Numerical Calculation

282 Appendix B: DC-Link Capacitor Current Numerical Calculation

i_d_CHB = zeros(1);i_d_CHB_rmssq_ml = zeros(10);i_d_CHB_dc_ml = zeros(10);i_d_CHB_ml = zeros(1,1);duty_ml = zeros(1);

for theta = 0:dTheta:2*pi-dThetacount = count + 1;

%Duty cycle calculationdutyA = M*cos(theta);dutyB = M*cos(theta - 2*pi/3);dutyC = M*cos(theta + 2*pi/3);

cmSignal = 0; % Common-mode voltage reference signalif strategy == 2

cmSignal = -1/6*M*cos(3*theta);else if strategy == 3

dutyABC = [dutyA dutyB dutyC];cmSignal = -0.5*(max(dutyABC) + min(dutyABC));

endenddutyA = dutyA + cmSignal;dutyB = dutyB + cmSignal;dutyC = dutyC + cmSignal;

%Three-phase currentsiA = Io_mag*cos(theta-phi);iB = Io_mag*cos(theta-phi-2*pi/3);iC = Io_mag*cos(theta-phi+2*pi/3);I3ph = [iA iB iC];

%NPC inverter calculations[dutySorted, indices] = sort([dutyA*(dutyA > 0) dutyB*(dutyB > 0)dutyC*(dutyC > 0)], ’ascend’);

duty1 = dutySorted(1);duty2 = dutySorted(2);duty3 = dutySorted(3);i1 = I3ph(indices(1));i2 = I3ph(indices(2));i3 = I3ph(indices(3));

i_d_NPC_rmssq = i_d_NPC_rmssq + (duty2-duty1)*(i2+i3)ˆ2 +(duty3-duty2)*(i3)ˆ2;

i_d_NPC(count) = iA*dutyA*(dutyA > 0) + iB*dutyB*(dutyB > 0) +iC*dutyC*(dutyC > 0);

i_d_NPC_dc = i_d_NPC_dc + i_d_NPC(count);

%CHB inverter calculationsi_d_CHB_rmssq = i_d_CHB_rmssq + iAˆ2*abs(dutyA);

Page 3: Power Electronic Converters for Microgrids (Sharkh/Power Electronic Converters for Microgrids) || DC-Link Capacitor Current Numerical Calculation

Appendix B: DC-Link Capacitor Current Numerical Calculation 283

i_d_CHB(count) = iA*dutyA;i_d_CHB_dc = i_d_CHB_dc + i_d_CHB(count);

%Multilevel CHB (CHB ML) inverter calculationsHBhigh = floor(abs(dutyA)*HBperPh); % Number

of cells with duty cycle = +/-1 (for phase A)HBduty = HBperPh * mod(abs(dutyA), 1/HBperPh);

for n = 1:HBperPhif n <= HBhigh

duty_ml(n) = sign(dutyA); % Duty cycle of theHBhigh lower cells

elseduty_ml(n) = 0; % Duty cycle of the (HBhigh+2) up

to the highest-level cellend

endduty_ml(HBhigh + 1) = sign(dutyA)*HBduty; % Duty cycle of

the (HBhigh+1)-level cell

for n = 1:HBperPhi_d_CHB_rmssq_ml(n) = i_d_CHB_rmssq_ml(n) +

iAˆ2*abs(duty_ml(n));i_d_CHB_ml(count,n) = iA*duty_ml(n);i_d_CHB_dc_ml(n) = i_d_CHB_dc_ml(n) + i_d_CHB_ml(count,n);

end

end

%RESULTS%-------------------------------

%NPC inverter resultsfprintf(’\n\nNPC\n-----------------’);i_d_NPC_rmssq = i_d_NPC_rmssq*dTheta/(2*pi);i_d_NPC_dc = i_d_NPC_dc*dTheta/(2*pi);i_C_NPC_rms = sqrt(i_d_NPC_rmssq - i_d_NPC_dcˆ2) %Capacitor rmscurrent for NPC

i_C_NPC = i_d_NPC - i_d_NPC_dc;dQ_C_NPC = i_C_NPC.*dTheta/(2*pi*f);Q_C_NPC = cumsum(dQ_C_NPC);Q_C_NPCpp = max(Q_C_NPC) - min(Q_C_NPC);V_C_NPCpp = Q_C_NPCpp/C %Capacitor peak-peak voltage ripple for NPC

%CHB inverter resultsfprintf(’\n\nCHB\n-----------------’);i_d_CHB_rmssq = i_d_CHB_rmssq*dTheta/(2*pi);i_d_CHB_dc = i_d_CHB_dc*dTheta/(2*pi);i_C_CHB_rms = sqrt(i_d_CHB_rmssq - i_d_CHB_dcˆ2) %Capacitor rmscurrent for CHB

Page 4: Power Electronic Converters for Microgrids (Sharkh/Power Electronic Converters for Microgrids) || DC-Link Capacitor Current Numerical Calculation

284 Appendix B: DC-Link Capacitor Current Numerical Calculation

i_C_CHB = i_d_CHB - i_d_CHB_dc;dQ_C_CHB = i_C_CHB.*dTheta/(2*pi*f);Q_C_CHB = cumsum(dQ_C_CHB);Q_C_CHBpp = max(Q_C_CHB) - min(Q_C_CHB);V_C_CHBpp = Q_C_CHBpp/C %Capacitor peak-peak voltage ripple for CHB

%CHB ML inverter resultsfor n = 1:HBperPh

fprintf(’\n\nML CHB, Cell %d \n-----------------’,n);i_d_CHB_rmssq_ml(n) = i_d_CHB_rmssq_ml(n)*Dtheta/(2*pi);i_d_CHB_dc_ml(n) = i_d_CHB_dc_ml(n)*Dtheta/(2*pi);i_C_CHB_rms_ml = sqrt(i_d_CHB_rmssq_ml(n) - i_d_CHB_dc_ml(n)ˆ2)

i_C_CHB_ml = i_d_CHB_ml(:,n) - i_d_CHB_dc_ml(n);dQ_C_CHB_ml = i_C_CHB_ml.*Dtheta/(2*pi*f);Q_C_CHB_ml = cumsum(dQ_C_CHB_ml);Q_C_CHBpp_ml = max(Q_C_CHB_ml) - min(Q_C_CHB_ml);V_C_CHBpp_ml = Q_C_CHBpp_ml/C

end