SVPWMËã·¨Éè¼Æ_ ÏÂÔØ±¾ÎÄ

SVPWMËã·¨Éè¼Æ

½øÈëÖжÏISR¹ØÖжÏIntDisablePIDµ÷½ÚVd£¬Vq ÄæPARK±ä»»InverseParkV¦Á£¬V¦Â ¼ÆËãÉÈÇøSectorCalculatorSVPWM³ÌÐòSvpwm¼ÆËã×÷ÓÃʱ¼äTimeCalculator¸üбȽÏÖµCompUpdate¿ªÖжÏIntEnableÍ˳öÖжÏͼ1 SVPWMÔÚÖжϷþÎñ³ÌÐòÖеÄλÖÃ

Ò» Ëã·¨Ô­Àí£º

1£¬ÄæPARK±ä»»£¨InversePark()£©£¬Ðý×ª×ø±êϵµ½¾²Ö¹×ø±êϵµÄ±ä»»

ÓÉÓÚʸÁ¿¿ØÖÆËã·¨ÊÇÔÚÐý×ª×ø±êϵd-q×ø±êϵÖÐÍê³ÉµÄ£¬µ±¸ø¶¨Á¿£¨Vd, Vq£©¼ÆËã³öÀ´ºó,ÐèҪת»»³É¾²Ö¹×ø±êϵ£¬×îÖÕת»¯³É¶Ô¶¨×Ó½»Á÷Á¿µÄ¿ØÖÆ¡£ÄæPARK±ä»»¹«Ê½ÈçÏ£º

?V???cos? ?V???????sin??sin???Vd??V?(¦È

cos????q?Ϊµç½Ç¶È£¬dÖáÓë¦ÁÖáµÄ¼Ð½Ç)

2£¬SVPWMËã·¨£¨Svpwm()£©

1) ¼ÆËãÉÈÇøN

´Óµçѹ¿Õ¼äʸÁ¿Í¼¿ÉÒÔ¿´³ö£¬µ±VrefÔÚ0 - 60¶Èʱ£¬Î»ÓÚIVÉÈÇø£»ÔÚ60 ¨C 120¶Èʱ£¬Î»ÓÚVIÉÈÇø£»ÔÚ120 ¨C 180¶Èʱ£¬Î»ÓÚIIÉÈÇø£»ÔÚ180 ¨C 240¶Èʱ£¬Î»ÓÚIIIÉÈÇø£»ÔÚ240-300¶Èʱ£¬Î»ÓÚIÉÈÇø£»ÔÚ300 ¨C 360

1

¶Èʱ£¬Î»ÓÚVÉÈÇø¡£

Va?V?ÁVb?1/2(3V??V?)(ÄæCLARK±ä»»2/3)

Vc?1/2(?3V??V?)ÕâÈý¸öµçѹֵµÄÕý¸º¾ö¶¨Á˵çѹʸÁ¿ËùÊôµÄÉÈ

011 Çø¡£×Ü½á¹æÂÉ£¬ÉÈÇøµÄ¼ÆËã¿É±íʾΪ£º

if(Va>0) a=0; else a=1; if(Vb>0) b=0; else b=1; if(Vc>0) c=0; else c=1; N=a+2*b+4*c;

2) ¼ÆËãʸÁ¿×÷ÓÃʱ¼ätstart£¬tendÓëtZ

ͼ2 µçѹ¿Õ¼äʸÁ¿Í¼

¶ÔÒ»¸ö¸ø¶¨µÄʸÁ¿Vref,¿ÉÒÔÓÃÏàÁÚµÄÁ½¸ö·ÇÁãʸÁ¿ÓëÁ½¸öÁãʸÁ¿(V0,V7)¸ù¾Ýƽ¾ùÖµµÈЧµÄÔ­ÔòµÃµ½¡£µ±VrefÔÚIVÉÈÇøÊ±£¬¼ÆË㹫ʽÈçÏ£º

Vref?T?V4?t4?V6?t6?VZ?tZT?t4?t6?tZ´Ó¶øµÃµ½£¬ t6?(3T/VDC)?V?tZ?T?t4?t6ÀàËÆµÄ£¬µ±VrefÔÚVIÇøÊ±£¬

t4?(3T/VDC)?1/2(3Va?V?)

t6?(3T/VDC)?1/2(3V??V?) t2?(3T/VDC)?1/2(?3V??V?)

tZ?T?t2?t6µ±VrefÔÚIIÇøÊ±£¬

t2?(3T/VDC)?V? t3?(3T/VDC)?1/2(?3V??V?)

tZ?T?t2?t3×Ü½á¹æÂÉÈçϱí(ÁîK?3T/VDC)

ÉÈÇø IV VI II III I V tstatrt/K Vb tend/K Va -Vc -Vb Va Vc -Vb -Va Vc Vb -Va -Vc ÒÔÉÏÊÇÔÚµçѹʸÁ¿ÄæÊ±ÕëÐýתʱµÄ¹æÂÉ£¬tstart¡¢tendÊÇ˳×ŵçѹʸÁ¿

Ðýת·½ÏòǰºóÁ½ÏàÁÚʸÁ¿µÄ×÷ÓÃʱ¼ä¡£Ë³Ê±ÕëÐýתʱֻÐèÒª°Ñtstart

2

Óëtendµ÷»»¼´¿É¡£

¸ù¾Ý¾¡¿ÉÄÜÉÙµÄÇл»¹¦ÂÊ¿ª¹ØµÄÔ­Ôò£¬¸÷¸öÉÈÇøµÄePWM²¨ÐÎÈçͼ2¹æ»®£¬ÕâÑùÿ´ÎÖ»ÐëÇл»Ò»¸öÇű۵ŦÂÊ¿ª¹Ø¡£ÀýÈçÔÚIVÇøÊ±£¬Ê¸Á¿Çл»Ë³ÐòÊÇ£ºV0(tz/4) -> V4(tstart/2) -> V6(tend/2) ->V7(tz/2) -> V6(tend/2)-> V4(tstart/2)-> V0(tz/4)¡£

3) ¼ÆËã²¢¸üбȽÏÖµ

EPWMÈí¼þÄ£¿é³õʼ»¯£¨ÉèÖóÉͬ²½¡¢»¥²¹¡¢Up-Downģʽ£©Íê³ÉºóÐèҪʵʱ¸üбȽÏÖµEpwm1Regs.CMPA.half.CMPA, Epwm2Regs.CMPA. half.CMPA, ºÍEpwm3Regs.CMPA.half.CMPA¡£ÔÚµÚËÄÇøÊ±£¬±È½ÏÖµµÄ¼ÆËã·½·¨£º

1 2 3

Udc

A

B

C

ͼ3 EPWMÓ²¼þÔ­ÀíʾÒâ

Epwm1Regs.CMPA.half.CMPA?TBPRD?Epwm2Regs.CMPA.half.CMPA?TBPRD?tz2Ttz?2tstart2T tz?2tstart?2tendEpwm3Regs.CMPA.half.CMPA?TBPRD?2T

3

¶þ º¯ÊýÃèÊö

1. Ö÷³ÌÐò³õʼ»¯ÖÐEPWMÄ£¿é³õʼ»¯£¨£©

//EPWM Module 1 Initial

EPwm1Regs.TBPRD =EPWMPRD>>1; // ÖÜÆÚÉ趨£¬EPWMÖÜÆÚ = 2*TBPRD EPwm1Regs.TBPHS.half.TBPHS=0; // Ïàλ¼Ä´æÆ÷Öµ=0 EPwm1Regs.TBCTL.bit.CTRMODE=TB_COUNT_UPDOWN; // ¶Ô³ÆÄ£Ê½ EPwm1Regs.TBCTL.bit.PHSEN=TB_DISABLE; // Ö÷Ä£¿éÉ趨

EPwm1Regs.TBCTL.bit.PRDLD=TB_SHADOW; //ÖÜÆÚ¼Ä´æÆ÷ʹÄÜÓ³ÏñÔØÈë EPwm1Regs.TBCTL.bit.SYNCOSEL=TB_CTR_ZERO; //TBCTR=0ʱÊä³öͬ²½ÐźŠEPwm1Regs.CMPCTL.bit.SHDWAMODE=CC_SHADOW; //A±È½ÏÆ÷ÉèÖÃΪӳÏñģʽ EPwm1Regs.CMPCTL.bit.SHDWBMODE =CC_SHADOW; //B±È½ÏÆ÷ÉèÖÃΪӳÏñģʽ EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // AÔÚCTR=0Ê±ÔØÈëÓ³ÏñÖµEPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // BÔÚCTR=0ʱ¼ÓÔØÓ³ÏñÖµ EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // EPWM1A¶¯×÷ÉèÖà EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;

EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; //ʹÄÜËÀÇøÄ£¿é

EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; //ÉèÖÃ¸ßµçÆ½ÓÐЧ£¨A£©»¥²¹Ä£Ê½

//BΪµÍµçƽÓÐЧ

EPwm1Regs.DBFED = DBPRD; // ϽµÑØËÀÇøÊ±¼ä¼ÆÊýÆ÷ÉèÖÃEPwm1Regs.DBRED = DBPRD; // ÉÏÉýÑØËÀÇøÊ±¼ä¼ÆÊýÆ÷ÉèÖà //¡­¡­

2. ÄæPARK±ä»»£¨InversePark(Vd, Vq, Theta)£©

¹¦ÄÜ£º½«Ö¸ÁîµçѹʸÁ¿Ö¸Áî´ÓÐý×ª×ø±êϵ£¨d-q£©×ª»»µ½¹Ì¶¨×ø±êϵ£¨¦Á-¦Â£©¡£ ÊäÈëÁ¿£ºVd, Vq, Theta(d, qÖáµçѹ·ÖÁ¿£¬É¨Ãèµ½µÄµç½Ç¶È) Êä³öÁ¿£ºVal, Vbe£¨¦Á£¬¦ÂÖáµçѹ·ÖÁ¿£© Ëã·¨ÃèÊö: define Vd, Vq, Theta;

Val=cos(Theta)*Vd-sin(Theta)*Vq; Vbe=sin(Theta)*Vd+cos(Theta)*Vq; return(Val,Vbe); 3. SVPWM³ÌÐò£¨Svpwm(Val£¬Vbe)£©

¹¦ÄÜ£ºÊ¹EPWMÄ£¿é·¢³öPWM²¨£¬½ø¶ø¿ØÖƹ¦ÂÊ¿ª¹Ø²úÉúSVPWM²¨ÐΡ£ ÊäÈëÁ¿£ºVal,Vbe£¨¦Á£¬¦ÂÖáµçѹ·ÖÁ¿£©

Êä³öÁ¿£ºEpwmXRegs.CMPA.half.CMPA(EPWM±È½Ï¼Ä´æÆ÷µÄÖµ) Ëã·¨ÃèÊö£º

define Val,Vbe,Va,Vb,Vc,n; // Va,Vb,Vc¿ÉÉèΪȫ¾Ö±äÁ¿ Va=Vbe;

Vb=0.5*(1.732*Val-Vbe);

Vc=0.5*((-1.732)*Val-Vbe); //ÄæCLARK±ä»»2/3 SectorCalculator()£» //¼ÆËãÉÈÇø

TimeCalculator()£» //¼ÆËãʸÁ¿ËùÐèµÄ×÷ÓÃʱ¼ä

CompUpdate()£» //¸üбȽϼĴæÆ÷ÖбȽÏÖµ end;

4

1)¼ÆËãÉÈÇø(SectorCalculator()) ¹¦ÄÜ£º¼ÆËãVrefËùÔÚµÄÉÈÇøn¡£

ÊäÈëÁ¿£ºVal,Vbe£¨¦Á£¬¦ÂÖáµçѹ·ÖÁ¿£© Êä³öÁ¿£ºn(ËùÔÚÉÈÇøÐòÊý) Ëã·¨ÃèÊö£º

if(Va>0) a=0; else a=1; if(Vb>0) b=0; else b=1; if(Vc>0) c=0; else c=1; n=a+2*b+4*c; return n;

2)¼ÆËã×÷ÓÃʱ¼ä(TimeCalculator())

¹¦ÄÜ£º¼ÆËãÓëVrefÏàÁÚÁ½Ê¸Á¿¸÷×ÔËùÐèÒªµÄ×÷ÓÃʱ¼ä¡£

ÊäÈëÁ¿£ºVa, Vb, Vc, Vdc, n, TBPRD; (TBPRDΪTBͬ²½Ê±ÖÓÖÜÆÚ) Êä³öÁ¿£ºTstart, Tend, Tz; (ÏàÁÚÁ½Ê¸Á¿×÷ÓÃʱ¼ä£¬ÁãʸÁ¿×÷ÓÃʱ¼ä) Ëã·¨ÃèÊö£º

define K=1.732*TBPRD/Vdc; switch (n)

{ n=4: Tstart=K*Vb; Tend=K*Va;

n=6: Tstart= (-1)*K*Vc; Tend= (-1)*K*Vb; n=2: Tstart=K*Va; Tend=K*Vc;

n=3: Tstart= (-1)*K*Vb; Tend= (-1)*K*Va; n=1: Tstart=K*Vc; Tend=K*Vb;

n=5: Tstart= (-1)*K*Va; Tend= (-1)*K*Vc; }

Tz=TBPRD-Tstart-Tend; 3)¸üбȽÏÖµ£¨CompUpdate()£©

¹¦ÄÜ£º¸üбȽϼĴæÆ÷ÖеıȽÏÖµ¡£ ÊäÈëÁ¿£ºTstart, Tend, Tz£¬n

Êä³öÁ¿£ºTact1£¬Tact2£¬Tact3(3¸ö¶¯×÷ʱ¼äµã£¬·Ö±ð¶ÔÓ¦3¸öEPWM±È½Ï

¼Ä´æÆ÷µÄÖµ)

Ëã·¨ÃèÊö£º switch (n) {

n=4: Tact1=Tz/4;

Tact2=Tz/4+Tstart/2;

Tact3=Tz/4+Tstart/2+Tend/2; n=6: Tact1= Tz/4+Tend/2; Tact2= Tz/4;

Tact3= Tz/4+Tstart/2+Tend/2; n=2: Tact1= Tz/4+Tstart/2+Tend/2; Tact2= Tz/4;

Tact3= Tz/4+Tstart/2;

n=3: Tact1= Tz/4+Tstart/2+Tend/2; Tact2= Tz/4+Tend/2;

5

Tact3= Tz/4;

n=1: Tact1= Tz/4+Tstart/2;

Tact2= Tz/4+Tstart/2+Tend/2; Tact3= Tz/4; n=5: Tact1= Tz/4;

Tact2= Tz/4+Tstart/2+Tend/2; Tact3= Tz/4+Tend/2; }

Èý ±äÁ¿±í£º

Éϼ¶¸ø¶¨Á¿£ºVref->d, Vref->q, Vref->theta;//Vd, Vq ¶¨£¬theta±ä£¬

¹¹Ôìºã·ù¿Õ¼äʸÁ¿£»

Êä³ö±äÁ¿£ºComp1A£¬Comp2A£¬Comp3A£»

ËùÓõ½µÄ±äÁ¿: Vref->d, Vref->q, Vref->theta; g_Vd, g_Vq, g_Theta; Valfabeta->alfa, Valfabeta->beta; Sector, Vdc, Tact1, Tact2, Tact3.

ËÄ ¹¤³ÌÎļþÇåµ¥£º

svpwm.h:svpwmËùÐèÒªµÄ±äÁ¿£¬½á¹¹Ì嶨ÒåºÍº¯ÊýÉùÃ÷

svpwm.c£ºÈ«¾Ö±äÁ¿¶¨Òå¼°³õʼ»¯£¬ÏµÍ³³õʼ»¯£¨°üÀ¨EPWM³õʼ»¯£©£¬Äæ

PARK±ä»»º¯Êý£¬¼ÆËãsvpwm×÷ÓÃʱ¼äº¯Êý£¬EPWMÖжϷþÎñ³ÌÐò,ÐéÄâ¸ø¶¨½Ó¿Úº¯Êý£¬ËÀÑ­»·´¦Àí¡£

Îå ¸½Í¼£º

1£¬»ùÓÚÒÔÉÏÅäÖòúÉúµÄ²¨ÐÎͼ£» 2£¬Êµ¼Ê¹Û²â²¨ÐÎͼ¡£

6

110ʸÁ¿×÷ÓÃʱ¼ä100T6/2000T4/2Tz/4111Tz/2110100100110111110100000TZ_INT ÅäÖÃ000(TBCTR=0)¼ÓÔØPRD,CMPÒõÓ°ÖµEPWMX INTTBCTR=PRD(¸üбȽÏÖµ)CADCAUTBCLK1REDEPWM1FEDCAUCADTBCLK2EPWM2CADCAUTBCLK3EPWM3ͬ²½ÐźÅʸÁ¿Î»ÓÚµÚËÄÉÈÇøÊ±µÄ²¨ÐÎͼ

7

IIÉÈÇø

II ¡ª>III

IIIÉÈÇø

8

9

10