This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

五段式SVPWM一相电压恒高的问题



void svgendq_calc(SVGENDQ *v)

 _iq Va,Vb,Vc,t1,t2,t7;
 unsigned long Sector = 0;  // Sector is treated as Q0 - independently with global Q
                 
// Inverse clarke transformation
    Va = v->Ubeta;
    Vb = _IQmpy(_IQ(-0.5),v->Ubeta) + _IQmpy(_IQ(0.8660254),v->Ualpha);  // 0.8660254 = sqrt(3)/2
    Vc = _IQmpy(_IQ(-0.5),v->Ubeta) - _IQmpy(_IQ(0.8660254),v->Ualpha);  // 0.8660254 = sqrt(3)/2
 //Vb=(float)((double)(_IQ(-0.5)) *(double)(v->Ubeta) + (double)(_IQ(0.8660254)) *(double)(v->Ualpha));                       // Vb = 1/2*(sqrt(3)*Ud - Uq)         sqrt(3)/2=0.866
    //Vc=(float)((double)(_IQ(-0.5)) *(double)(v->Ubeta) - (double)(_IQ(0.8660254)) *(double)(v->Ualpha));                       // Vc = -1/2*(sqrt(3)Ud + Uq)
// 60 degree Sector determination
    //if (Va>_IQ(0))
 if (Va>0.0000001)
       Sector = 1;
    //if (Vb>_IQ(0))
 if (Vb>0.0000001)
       Sector = Sector + 2;
    //if (Vc>_IQ(0))
    if (Vc>0.0000001) 
       Sector = Sector + 4;
      
// X,Y,Z (Va,Vb,Vc) calculations
    //Va = v->Ubeta;                                                       // X = Va
    //Vb = _IQmpy(_IQ(0.5),v->Ubeta) + _IQmpy(_IQ(0.8660254),v->Ualpha);   // Y = Vb
    //Vc = _IQmpy(_IQ(0.5),v->Ubeta) - _IQmpy(_IQ(0.8660254),v->Ualpha);   // Z = Vc
    //Vb=_IQ(-0.5) * v->Ubeta + _IQ(0.8660254) * v->Ualpha;                       // Vb = 1/2*(sqrt(3)*Ud - Uq)         sqrt(3)/2=0.866
    //Vc=_IQ(-0.5) * v->Ubeta - _IQ(0.8660254) * v->Ualpha;
    if (Sector==0)  // Sector 0: this is special case for (Ualpha,Ubeta) = (0,0)
    {
       v->Ta = _IQ(0.5);
       v->Tb = _IQ(0.5);
       v->Tc = _IQ(0.5);
    }
    if (Sector==1)  // Sector 1: t1=Z and t2=Y (abc ---> Tb,Ta,Tc)  1
    {
       //t1 = Vc;
       //t2 = Vb;
    t1 = Vb;
       t2 = Vc;
    t7 = _IQ(1)-t1-t2;
      
    //v->Tc = 0;      // tbon = (1-t1-t2)/2
       //v->Ta = t1;                             // taon = tbon+t1
       //v->Tb = t1+t2;                             // tcon = taon+t2
    v->Tc = t7;      // tbon = (1-t1-t2)/2
       v->Ta = t1+t7;                             // taon = tbon+t1
       v->Tb = t1+t2+t7;                             // tcon = taon+t2
    }
    else if (Sector==2)  // Sector 2: t1=Y and t2=-X (abc ---> Ta,Tc,Tb) 5
    {
       //t1 = Vb;
       //t2 = -Va;
    t1 = -Va;
       t2 = Vb;
    t7 = _IQ(1)-t1-t2;
      
    //v->Tb = 0;      // taon = (1-t1-t2)/2
       //v->Tc = t1;                             // tcon = taon+t1
       //v->Ta = t1+t2;                             // tbon = tcon+t2
    v->Tb = t7;      // taon = (1-t1-t2)/2
       v->Tc = t1+t7;                             // tcon = taon+t1
       v->Ta = t1+t2+t7;                             // tbon = tcon+t2
    }     
    else if (Sector==3)  // Sector 3: t1=-Z and t2=X (abc ---> Ta,Tb,Tc) 0
    {
       t1 = -Vc;
       t2 = Va;
    t7 = _IQ(1)-t1-t2;
      
    //v->Tc = 0;      // taon = (1-t1-t2)/2
       //v->Tb = t1;                             // tbon = taon+t1
       //v->Ta = t1+t2;                             // tcon = tbon+t2
    v->Tc = t7;      // taon = (1-t1-t2)/2
       v->Tb = t1+t7;                             // tbon = taon+t1
       v->Ta = t1+t2+t7;    
    }  
    else if (Sector==4)  // Sector 4: t1=-X and t2=Z (abc ---> Tc,Tb,Ta) 3
    {
       //t1 = -Va;
       //t2 = Vc;
    t1 = Vc;
       t2 = -Va;
    t7 = _IQ(1)-t1-t2;
      
    //v->Ta = 0;      // tcon = (1-t1-t2)/2
       //v->Tb = t1;                             // tbon = tcon+t1
       //v->Tc = t1+t2;                             // taon = tbon+t2
    v->Ta = t7;      // tcon = (1-t1-t2)/2
       v->Tb = t1+t7;                             // tbon = tcon+t1
       v->Tc = t1+t2+t7;                             // taon = tbon+t2
    }  
    else if (Sector==5)  // Sector 5: t1=X and t2=-Y (abc ---> Tb,Tc,Ta) 2
    {
       t1 = Va;
       t2 = -Vb;
    t7 = _IQ(1)-t1-t2;
      
    //v->Ta = 0;      // tbon = (1-t1-t2)/2
       //v->Tc = t1;                             // tcon = tbon+t1
       //v->Tb = t1+t2;                             // taon = tcon+t2
    v->Ta = t7;      // tbon = (1-t1-t2)/2
       v->Tc = t1+t7;                             // tcon = tbon+t1
       v->Tb = t1+t2+t7;                             // taon = tcon+t2
    }  
    else if (Sector==6)  // Sector 6: t1=-Y and t2=-Z (abc ---> Tc,Ta,Tb) 4
    {
       t1 = -Vb;
       t2 = -Vc;
    t7 = _IQ(1)-t1-t2;
      
    //v->Tb = 0;      // tcon = (1-t1-t2)/2
       //v->Ta = t1;                             // taon = tcon+t1
       //v->Tc = t1+t2;                             // tbon = taon+t2
    v->Tb = t7;      // tcon = (1-t1-t2)/2
       v->Ta = t1+t7;                             // taon = tcon+t1
       v->Tc = t1+t2+t7;                             // tbon = taon+t2
    }
   
// Convert the unsigned GLOBAL_Q format (ranged (0,1)) -> signed GLOBAL_Q format (ranged (-1,1))
//    v->Ta = _IQmpy(_IQ(2.0),(v->Ta-_IQ(0.5)));
//    v->Tb = _IQmpy(_IQ(2.0),(v->Tb-_IQ(0.5)));
//    v->Tc = _IQmpy(_IQ(2.0),(v->Tc-_IQ(0.5)));       

}


我搞五段式SVPWM,一相电压恒低的情况下电机可以转了,但是一相电压恒高时不转。

大侠看看有什么问题。谢谢!