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.

TMS320F28069: V/F example for inverter

Part Number: TMS320F28069
Other Parts Discussed in Thread: CONTROLSUITE

Looking for an example program to implement variable frequency SPWM, such that input voltage/reference sine wave frequency ratio remains unchanged. Please help.

  • Hi ! Are you a beginner in inverter coding ?
  • Hello, yes I'm new to inverter coding. I have referred to a simulation for inverter with sine modulated PWM, using op-amps. Please if you can provide necessary guidance it would be helpful.
  • Hi !   OK..I"m sending you a single phase inverter source code based in 28069, but it's I thing available in all of models of MCU....

    void device_start(void)
        {
        if(!FAULT)
     {
     switch(OPERATION_MODE)
     {
     case 0:
     FULL_SYSTEM_DISABLE();
     INV_COUNTING++;
     if(INV_COUNTING>SEC_5)
     { INV_COUNTING = SEC_5;
     Control_Init();
     OPERATION_MODE = 1;
     INV_COUNTING = 0;
     if ( I_bat  < -2.0 ) {FULL_SYSTEM_DISABLE();FAULT = 4; }}
     break;

     case 1:
     if (V_dc > (0.98*INV_START))
     {INV_COUNTING++;
     if(INV_COUNTING>(SEC_1))
     {INV_PWM_ENABLE();
     OPERATION_MODE = 2; AC_PEAK_SETTING = 0.05;
     INV_COUNTING = 0;}}

     if (V_dc < DC_CRITICAL_POINT)             {FULL_SYSTEM_DISABLE(); FAULT = 9;}
     if (I_bat > BAT_CUR_MAX)                    {FULL_SYSTEM_DISABLE(); FAULT = 4;}
     if ( I_bat  < -2.0 )                     {FULL_SYSTEM_DISABLE(); FAULT = 5;}
     break;

     case 2:
     V_dc_ref = INV_START;  cur_cntl();
     V_ac_ref = sin1_value; AC_PEAK_SETTING+=0.00007;
     RELAY_LOAD_ON;
     if (AC_PEAK_SETTING > 0.9 )
     { AC_PEAK_SETTING = 0.9;
     INV_COUNTING++;
     if(INV_COUNTING>(SEC_1))
     {INV_COUNTING = SEC_1;
     OPERATION_MODE = 3;
     INV_COUNTING = 0;}}

     if (V_dc < DC_OUT_MIN)                   {FULL_SYSTEM_DISABLE(); FAULT = 3;}
     if (V_dc < DC_CRITICAL_POINT)             {FULL_SYSTEM_DISABLE(); FAULT = 4;}
     if (I_bat > BAT_CUR_MAX)                    {FULL_SYSTEM_DISABLE(); FAULT = 5;}
     if ( I_bat  < -2.0 )                     {FULL_SYSTEM_DISABLE(); FAULT = 5;}
     break;

     case 3:
     V_dc_ref = INV_START;
     cur_cntl();
     V_ac_ref = sin1_value;
     pi_control(vol_err,AC_VOL_SET_PEAK,V_ac_peak_f,V_ac_sum,sample_time,AC_VOL_KP,AC_VOL_KI,-20.0,20.0);
     V_ac_kp = AC_VOL_KP*(AC_VOL_SET_PEAK - V_ac_peak_f);
     V_ac_peak_ref = (AC_VOL_SET_PEAK+vol_err);
     AC_PEAK_SETTING = V_ac_peak_ref / V_dc ;

     INV_COUNTING++;
     if(INV_COUNTING>(SEC_5))
     {INV_COUNTING = SEC_5;
     OPERATION_MODE = 4;
     INV_COUNTING = 0;}
     if (V_dc > (1.02*INV_START)) { no_load_cntl();}
     else
     { V_dc_ref = INV_START; cur_cntl();
     V_ac_ref = sin1_value; INV_CONTROL = 6.0;
     pi_control(vol_err,AC_VOL_SET_PEAK,V_ac_peak_f,V_ac_sum,sample_time,AC_VOL_KP,AC_VOL_KI,-20.0,20.0);
     V_ac_kp = AC_VOL_KP*(AC_VOL_SET_PEAK - V_ac_peak_f);
     V_ac_peak_ref = (AC_VOL_SET_PEAK+vol_err);
     AC_PEAK_SETTING = V_ac_peak_ref / V_dc ;}

     if (V_dc < DC_OUT_MIN)                   {FULL_SYSTEM_DISABLE(); FAULT = 3;}
     if (V_dc < DC_CRITICAL_POINT)             {FULL_SYSTEM_DISABLE(); FAULT = 4;}
     if (I_bat > BAT_CUR_MAX)                    {FULL_SYSTEM_DISABLE(); FAULT = 5;}
     if ( I_bat  < -2.0 )                     {FULL_SYSTEM_DISABLE(); FAULT = 5;}
     break;

     }
     FAULT_CHECKING();
     INV_PWM_CREATING();
      }
        }

      void open_loop_cntl(void)
     {
        est_theta   +=DELTA_THETA_60Hz; ////  DELTA_THETA_60Hz =  2 * 3.14 * 60 * sample_time ;
        if(est_theta>PI) {est_theta = est_theta - PI2;}
        if(est_theta<-PI){est_theta = est_theta + PI2;}
        }

        void INV_PWM_CREATING()
        {
        if (V_ac_ref > 0)   { VOL_POLE = 1; }
        else                      { VOL_POLE = 0; }

        switch(VOL_POLE)
        { case 1:
        inv_ref                     =   AC_PEAK_SETTING * V_ac_ref;
        PWM_COUNT_INV_REF[0]   =  (int16)(inv_ref*PWM_COUNT_INV_MAX);
        PWM_COUNT_INV_REF[1]  =  bound1(PWM_COUNT_INV_REF[0],PWM_COUNT_INV_MAX);
        EPwm1Regs.CMPA.half.CMPA = PWM_COUNT_INV_REF[1];
        EPwm2Regs.CMPA.half.CMPA    = 0;
        break;

        case 0:
        inv_ref                     =   - AC_PEAK_SETTING * V_ac_ref;
        PWM_COUNT_INV_REF[2]   =  (int16)(inv_ref*PWM_COUNT_INV_MAX);
        PWM_COUNT_INV_REF[3]  =  bound1(PWM_COUNT_INV_REF[2],PWM_COUNT_INV_MAX);
        EPwm1Regs.CMPA.half.CMPA = 0;
        EPwm2Regs.CMPA.half.CMPA    = PWM_COUNT_INV_REF[3];}}

        void INV_PWM_ENABLE(void)
        {
     INV = 1; FD = 0.0;
     EALLOW;
     GpioCtrlRegs.GPAMUX1.bit.GPIO0  = 1;
     GpioCtrlRegs.GPAMUX1.bit.GPIO1  = 1;
     GpioCtrlRegs.GPAMUX1.bit.GPIO2  = 1;
     GpioCtrlRegs.GPAMUX1.bit.GPIO3  = 1;
     EDIS;
        }

     Switching pattern used here is based to dual modulation . I thing it'll be helpful  for you ...

    BY !

  • We have one motor control example using V/F Control

    Please see here

    C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1\HVACI_Scalar
  • Sir,
    I have imported the C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1\HVACI_Scalar for 28069 device. I'm getting PWM output with build level 1, I wanted to know should PWM DAC also work ? I don't see any output at EPWM6 and 7. Does the change in device have any limitations ?
    Please guide.

  • Ravi,

    i believe the original project was done on F2803x and there may be some changes in the GPIO mux that may be causing some issue in PWM Dac showing up..

    you can alternatively look at the variables in the DLOG window..
  • Sir, 

    Are there any examples of inverter with sine modulated PWM individually or sine modulated PWM with V/F (the motor example has used space vector)?

    I have tried using PWM in up-down mode and updated the compare register with (Total_period/2)+((Total_period/2) *A* sin(2*pi*f*t)) in the ISR, by which I'm able to generate varying PWM and able to get a sine wave after a filter. Can you please tell me is this how it is done?

  • Have   you   tested   the   code   I've   sent   you  ?

  • eeddii iiiiii said:

    Have   you   tested   the   code   I've   sent   you  ?

    Thanks that you want to help me. I will try dual modulation after generating a 3 phase sine modulated PWM having required deadband.
     
  • Hiii, iam doing single phase inerter with c2000 f28027 micro controller. will this above code help me in generating pulses from f28027 controller? please reply me.