• Nenhum resultado encontrado

NPC

Neste Apêndice apresenta o código escrito em linguagem C utilizado na geração dos pulsos do inversor NPC.

/*---*/

/* Filename: modulacao_vetorial.c */

/* Author: Antônio Cabral */

/* Date: 06/12/2010 */

/* Description: Gerador de pulsos */

/* Status: ok */

/*---*/ #define S_FUNCTION_NAME modulacao_vetorial

#define S_FUNCTION_LEVEL 2 #include "simstruc.h" #include "math.h" #ifndef MATLAB_MEX_FILE #include <brtenv.h> #endif

#define U(element) (*uPtrs[element]) /* Pointer to Input Port0 */

/* Define input and output widths */

#define NINPUTS 7

#define NOUTPUTS 12

/* Define number of states and assign labels*/

#define DSTATES 0

#define NPARAMS 0

//Constant coefficients and parameters

#define h 1.25e-4 // Sample time of pwm + controller

#define Ts 1.25e-4 // Período de chaveamento

/*====================* * S-function methods * *====================*/

ssSetNumContStates(S, 0); ssSetNumDiscStates(S, DSTATES); if (!ssSetNumInputPorts(S, 1)) return; ssSetInputPortWidth(S, 0, NINPUTS); ssSetInputPortDirectFeedThrough(S, 0, 1); if (!ssSetNumOutputPorts(S, 1)) return; ssSetOutputPortWidth(S, 0, NOUTPUTS); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0);

/* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE);

}

/* Function: mdlInitializeSampleTimes =========================================*/ static void mdlInitializeSampleTimes(SimStruct *S)

{ ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME); ssSetOffsetTime(S, 0, 0.0); } #define MDL_INITIALIZE_CONDITIONS /* Function: mdlInitializeConditions ========================================*/ static void mdlInitializeConditions(SimStruct *S)

{

real_T *x0 = ssGetRealDiscStates(S); }

#define MDL_START

static void mdlStart(SimStruct *S) {

#ifndef MATLAB_MEX_FILE

/* define IO group pins (0..7) as output */ ds1103_bit_io_config(DS1103_DIO1_OUT); /* write HIGH to pin IO1 */

ds1103_bit_io_set(DS1103_DIO1_SET); #endif

}

/* Function: mdlOutputs =======================================================*/ static void mdlOutputs(SimStruct *S, int_T tid)

{

real_T *x = ssGetRealDiscStates(S);

InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);

/* Local variables */

/* Temporary variables */

/* Variáveis do PWM */

real_T Chave_a1, Chave_a2, Chave_b1, Chave_b2, Chave_c1, Chave_c2; real_T Chave_a3, Chave_a4, Chave_b3, Chave_b4, Chave_c3, Chave_c4; real_T u1a, u2a, u3a, u4a, u5a, u6a, u7a;

real_T u1b, u2b, u3b, u4b, u5b, u6b, u7b; real_T u1c, u2c, u3c, u4c, u5c, u6c, u7c;

real_T taupa_ref, tauna_ref, taupb_ref, taunb_ref, taupc_ref, taunc_ref, Triang;

/* Assign inputs to local variables */

taupa_ref = U(0); // Length of stay of the key A phase in the state P

tauna_ref = U(1); // Length of stay of the key A phase in the state N

taupb_ref = U(2); // Length of stay of the key B phase in the state P

taunb_ref = U(3); // Length of stay of the key B phase in the state N

taupc_ref = U(4); // Length of stay of the key C phase in the state P

taunc_ref = U(5); // Length of stay of the key C phase in the state N

Triang = U(6);

// Generation of pulses of arm A \\

u1a = Triang; u2a = taupa_ref; u3a = Ts-tauna_ref; u4a = Ts; u5a = Ts+tauna_ref; u6a = 2*Ts-taupa_ref; u7a = 2*Ts; if (u2a>u1a) { //Da=P; Chave_a1 = 1; Chave_a2 = 1; Chave_a3 = 0; Chave_a4 = 0; } else if (u3a>u1a) { //Da=O; Chave_a1 = 0; Chave_a2 = 1; Chave_a3 = 1; Chave_a4 = 0; } else if (u4a>u1a) { //Da=N; Chave_a1 = 0; Chave_a2 = 0; Chave_a3 = 1; Chave_a4 = 1; }

} else if (u6a>u1a) { //Da=O; Chave_a1 = 0; Chave_a2 = 1; Chave_a3 = 1; Chave_a4 = 0; } else if (u7a>u1a) { //Da=P; Chave_a1 = 1; Chave_a2 = 1; Chave_a3 = 0; Chave_a4 = 0; }

// Generation of pulses of arm B\\

u1b = Triang; u2b = taupb_ref; u3b = Ts-taunb_ref; u4b = Ts; u5b = Ts+taunb_ref; u6b = 2*Ts-taupb_ref; u7b = 2*Ts; if (u2b>u1b) { //Db=P; Chave_b1 = 1; Chave_b2 = 1; Chave_b3 = 0; Chave_b4 = 0; } else if (u3b>u1b) { //Db=O; Chave_b1 = 0; Chave_b2 = 1; Chave_b3 = 1; Chave_b4 = 0; } else if (u4b>u1b) { //Db=N; Chave_b1 = 0; Chave_b2 = 0; Chave_b3 = 1; Chave_b4 = 1; } else if (u5b>u1b) { //Db=N; Chave_b1 = 0; Chave_b2 = 0; Chave_b3 = 1; Chave_b4 = 1;

} else if (u6b>u1b) { //Db=O; Chave_b1 = 0; Chave_b2 = 1; Chave_b3 = 1; Chave_b4 = 0; } else if (u7b>u1b) { //Db=P; Chave_b1 = 1; Chave_b2 = 1; Chave_b3 = 0; Chave_b4 = 0; }

// Generation of pulses of arm C\\

u1c = Triang; u2c = taupc_ref; u3c = Ts-taunc_ref; u4c = Ts; u5c = Ts+taunc_ref; u6c = 2*Ts-taupc_ref; u7c = 2*Ts; if (u2c>u1c) { //Dc=P; Chave_c1 = 1; Chave_c2 = 1; Chave_c3 = 0; Chave_c4 = 0; } else if (u3c>u1c) { //Dc=O; Chave_c1 = 0; Chave_c2 = 1; Chave_c3 = 1; Chave_c4 = 0; } else if (u4c>u1c) { //Dc=N; Chave_c1 = 0; Chave_c2 = 0; Chave_c3 = 1; Chave_c4 = 1; } else if (u5c>u1c) { //Dc=N; Chave_c1 = 0; Chave_c2 = 0; Chave_c3 = 1; Chave_c4 = 1; } else if (u6c>u1c) { //Dc=O;

{ //Dc=P; Chave_c1 = 1; Chave_c2 = 1; Chave_c3 = 0; Chave_c4 = 0; } /* Compute outputs */ y[0]=Chave_a1; y[1]=Chave_a2; y[2]=Chave_a3; y[3]=Chave_a4; y[4]=Chave_b1; y[5]=Chave_b2; y[6]=Chave_b3; y[7]=Chave_b4; y[8]=Chave_c1; y[9]=Chave_c2; y[10]=Chave_c3; y[11]=Chave_c4; } #define MDL_UPDATE /* Function: mdlUpdate ====================================================== */ static void mdlUpdate(SimStruct *S, int_T tid)

{

real_T *x = ssGetRealDiscStates(S);

InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);

}

/* Function: mdlTerminate ===================================================== */ static void mdlTerminate(SimStruct *S)

{

UNUSED_ARG(S); /* unused input argument */ }

#ifdef MATLAB_MEX_FILE /* Is this file being compiled as a MEX-file? */

#include "simulink.c" /* MEX-file interface mechanism */

#else

#include "cg_sfun.h" /* Code generation registration function */

[1] M. Bollen, Understanding Power Quality Problems: Voltage Sags and Interruptions, 1aed. Mc. Graw-Hill Book Company, 1999.

[2] R. Dugan, M. Mcgranaghan, S. Santoso, and H. Beaty, Electrical Power Systems Quality,2aed. Mc. Graw-Hill Book Company, 2002.

[3] Y. He, J. Liu, J. Tang, Z. Wang, and Y. Zou, “An Novel Deadbeat Control Method for Active Power Filters with Three-Level NPC Inverter,” Power Electronics Specialist

Conference, 2008.

[4] H. Akagi, “Trends in Active Power Line Conditioners,” IEEE Transactions on

Industrial Electronics, vol. 49, no. 3, pp. 263–268, August 1994.

[5] H. Sasaki and T. MAchida, “A New Method to Eliminate AC Harmonic Currents by Magnetic Flux Compensation - Considerations on Basic Design,” IEEE Transactions

on Power Apparatus and Systems, vol. PAS-90, pp. 2009–2019, September 1971.

[6] L. Gyugyi and E. Strycula, “Active ac Power Filters,” in Conference Record IEEE-IAS

Anual Meeting, vol. 19, pp. 529–535, October 1976.

[7] N. Moran, H. A. Peterson, W. F. Long, G. R. Dreifuerst, and J. Vithaythil, “Active Filters for ac Harmonic Suppression,” Presented at IEEE/PES Winter Meeting, 1977. [8] H. A. Akagi, “Active Harmonic Filters,” Proceedings of the IEEE, vol. 93, no. 12, pp.

2128–2141, December 2005.

[9] B. Singh, K. Al-Haddad, and A. Chandra, “A Review of Active Filters for Power Quality Improvement,” IEEE Transactions on Industrial Electronics, vol. 46, pp. 960– 971, August 1999.

[10] V. Aburto, M. Schneider, L. Morán, and J. Dixon, “An Active Power Filter Implemented with a Three-Level NPC Voltage-Source Inverter,” Power Electronics Specialist

Conference, vol. 2, 1997.

,” IEEE Transactions on Power Electronics, vol. IA-17, pp. 518–523, September 1981. [13] T. Meynard and H. Foch, “Multi-level conversion: high voltage choppers and

voltage-source inverters,” PESC’92, vol. 1, pp. 397–403, June-July 1992.

[14] R. Baker and L. Bannister, “Electric Power Converter,” U.S. Patent 3 867 643, Estados

Unidos, 1975.

[15] F. Souza, “Correção do Fator de Potência Para Instalações de Baixa Potência Empregando Filtros Ativos,” Ph.D. dissertation, Universidade Federal de Santa Catarina-UFSC, 2000.

[16] C. Quinn and N. Mohan, “Active filtering of harmonic currents in three-phase four-wire systems with three-phase and single-phase non-linear loads,” in Proc. IEEE APEC’92, pp. 829–835, August 1992.

[17] L. Bor-Ren, C. Huann-Keng, and Y. Kai-Tsang, “Shunt Active Filter with Three-Phase Four-Wire NPC Inverter,” IEEE International Midwest Symposium on Circuits and

Systems, vol. 2, pp. II281–II284, November 2004.

[18] L. Asiminoaei, F. Blaabjerg, and S. Hansen, “Detection is Key - Harmonic detection methods for active power filter applications,” Industry Applications Magazine, IEEE, vol. 13, pp. 22–33, July 2007.

[19] K. Vardar, E. Akpinar, and T. Surgevil, “Evaluation of reference current extraction methods for DSP implementation in active power filters,” Electric Power Systems

Research, 2009.

[20] A. Massound, S. Finney, and B. Williams, “Review of Harmonic Current Extraction Techniques for an Active Power Filter,” Harmonics and Quality of Power, 2004. 11th

International Conference, 2004.

[21] H. Zhang, S. Finney, A. Massoud, and B. Williams, “An SVM Algorithm to Balance the Capacitor Voltages of the Three-Level NPC Active Power Filter,” IEEE Transactions

on Power Electronics, vol. 23, no. 6, pp. 2694–2702, November 2008.

[22] H. Zhang, S. Finney, A. Massoud, J. Fletcher, and B. Williams, “Operation of a Three-level NPC Active Power Filter with Unbalanced and Nonlinear Loads,” 4th IET

[23] J. Allmeling, “A Control Structure for Fast Harmonics Compensation in Active Filters,”

Power Electronics Specialists Conference, 2002. pesc 02. 2002 IEEE 33rd Annual,

vol. 1, pp. 376–381, November 2002.

[24] J. Carvalheiro and R. Castro, “Power Conditioning Performance Analysis for a Fuel Cell Power Plant,” 9oCongreso Hispano Luso de Ingeniaría Electrotécnica, Marbella (Málaga), 2005.

[25] N. Mendalek and K. Al-Haddad, “Modeling and Nonlinear Control of Shunt Active Power Filter in the Synchronous Reference Frame,” The 9th Conference International

on Harmonics and Quality of Power, vol. 1, no. 8, pp. 30–35, November 2000.

[26] I. Pereira, “Projectar, Simular e Implementar um Inversor Multinível,” Master’s thesis, Faculdade de Engenharia da Universidade do Porto, 2008.

[27] J. Yao and T. Green, “DC-Link Capacitors Sizing for Three-Level Neutral-Point-Clamped Inverters in Four-Wire Distributed Generation Systems,” IEEE, 2005

International Conference on, 2005.

[28] M. A. M. Severo, “Técnicas de Modulação em largura de pulso vetoriais para multiníveis,” Ph.D. dissertation, Universidade Federal de Minas Gerais-UFMG, 2000. [29] P. Krause, O. Wasinczuk, and S. Sudhoff, Analysis of Electric Machinery and Drive

Systems,1aed. Mc. Graw-Hill Book Company, 2002.

[30] D. Novotny and T. Lipo, Vector Control and Dynamics of AC Drives,1a ed. Oxford Science Publications, 1996.

[31] V. Kaura and V. Blasko, “Operation of a Phase Locked Loop System Under Distorted Utility Conditions,” IEEE TRANSACTIONS ON INDUSTRY APPLICATIONS, vol. 33, no. 1, pp. 58–63, JANUARY-FEBRUARY 1997.

[32] L. R. Limongi, R. Bojoi, C. Pica, F. Profumo, and A. Tenconi, “Analysis and Comparison of Phase Locked Loop Techniques for Grid Utility Applications,” Power

Conversion conference-Nagoya, 2007.

[33] W. Madhukar and P. Agarwal, “Comparison of Control Strategies for Multilevel Inverter based Active Power Filter used in High Voltage Systems,” Power Electronics,

Drives and Energy Systems (PEDES) & 2010 Power India, 2010 Joint International Conference on, vol. 1, pp. 1–6, February 2010.

[35] G. Azevedo, “Sistema de Conversação de Energia Fotovoltaica com Compensação Baseada em Corrente e Tensão,” Master’s thesis, Universidade Federal de Pernambuco-UFPE, 2007.

[36] S. Bhattacharya, D. Divan, and B. Banerjee, “Syschronous Frame Harmonic Isolator Using Active Series Filter,” Proceedings of The European Power Electronics

Conference EPE, 1991.

[37] S. Round and D. Ingram, “An Evaluation of Techniques for Determining Active Filter Compensating Currents in Unbalanced Systems,” European Power Electronics

Conference EPE’97, vol. 4, pp. 4767–4772, 1997.

[38] L. Limongi, R. Bojoi, G. Griva, and A. Tenconi, “Comparing the Performance of Digital Signal Processor-Based Current Controllers for Three-Phase Active Power Filters,” IEEE Industrial Electronics Magazine, vol. 3, no. 1, pp. 20–31, March 2009. [39] R. Bojoi, L. R. Limongi, D. Roiu, and A. Tenconi, “Frequency-Domain Analysis of

Resonant Current Controllers for Active Power Conditioners,” Industrial Electronics,

2008. IECON 2008. 34th Annual Conference of IEEE, pp. 3141–3148, January 2008.

[40] R. Bojoi, G. Griva, L. Limongi, C. Pica, and A. Tenconi, “Perfornance Comparison of Frequency Selective Current Controllers for three-phase Active Power Filters,”

Industrial Electronics Society, 2007. IECON 2007. 33rd Annual Conference of the IEEE, pp. 1845–1850, March 2007.

[41] M. Sonnenschein and MWeinhold, “Comparison of Time-domain and Frequency-Domain Control Schemes for Shunt Active Filters,” Conf. Rec. ETEP, vol. 1, pp. 5–16, January 1999.

[42] S. Bhattacharya, T. Frank, D. Divan, and B. Banerjee, “Parallel Active Filter System Implementation and Design Issues for Parallel Active Filter System Implementation and Design Issues for Utility Interface of Adjustable Speed Drive Systems,” Conference

Record IEEE-IAS Annual Meeting., vol. 2, 1996.

[43] L. R. Limongi, “Control Strategies for Power Quality Improvement and Active Power Generation in Grid Connected Applications,” Ph.D. dissertation, Politecnico Di Torino, 2009.

[44] R. Bojoi, G. Griva, V. Bostan, M. Guerriero, F. Farina, and F. Profumo, “Current Control Strategy for Power Conditioners Using Sinusoidal Signal Integrators in Synchronous Reference Frame,” IEEE Transactions on Power Electronics, vol. 20, pp. 1402–1412, November 2005.

Documentos relacionados