TI中文支持网
TI专业的中文技术问题搜集分享网站

dsp里面的PI控制器程序问题

interrupt void MainIsr(void)
{

    ILo = iLo;
    ILo_ref = ILO_REF;
    ILo_error = ILo_ref-ILo;
    ILo_Inter += ILo_error*ILo_I;
    if(ILo_Inter > 400)
     ILo_Inter = 400000;
    else if(ILo_Inter < -400)
     ILo_Inter = -400000;
    ILo_out = ILo_Inter+ILo_P*ILo_error;
    if(ILo_out > 500)
     ILo_out = 5000000;
    else if(ILo_out < -500)
     ILo_out = -5000000;
    Uzaibo = ILo_out*0.00009;
//     Uzaibo_out = -Uzaibo*30000/2+30000/2;

    EPwm2Regs.TBPHS.half.TBPHS = 0.0*30000;//1.06*30000;
    EPwm3Regs.TBPHS.half.TBPHS = 1.0*30000;//1.1538*30000;
    EPwm4Regs.TBPHS.half.TBPHS = (1.1+0.5*Uzaibo)*30000;//0.1438*30000;+0.5*Uzaibo
    EPwm5Regs.TBPHS.half.TBPHS = (0.1+0.5*Uzaibo)*30000;//0.1438*30000;

    EPwm2Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;//+Uzaibo
    EPwm3Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;
    EPwm4Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;
    EPwm5Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;

    //EPwm1Regs.CMPA.half.CMPA=30000/2;
    //EPwm2Regs.CMPA.half.CMPA=30000/2;

        EPwm1Regs.ETCLR.bit.INT =1;
        PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; //响应本次接收中断;
//        return;

}
请问这个中断函数的问题在哪里,PI控制器的写法是不是有问题,因为我从结果得出的结论是PI控制器没有起作用!

Green Deng:你好,建议更清楚得描述一下你的问题。比如芯片型号,是否有参考的例程?

interrupt void MainIsr(void)
{

    ILo = iLo;
    ILo_ref = ILO_REF;
    ILo_error = ILo_ref-ILo;
    ILo_Inter += ILo_error*ILo_I;
    if(ILo_Inter > 400)
     ILo_Inter = 400000;
    else if(ILo_Inter < -400)
     ILo_Inter = -400000;
    ILo_out = ILo_Inter+ILo_P*ILo_error;
    if(ILo_out > 500)
     ILo_out = 5000000;
    else if(ILo_out < -500)
     ILo_out = -5000000;
    Uzaibo = ILo_out*0.00009;
//     Uzaibo_out = -Uzaibo*30000/2+30000/2;

    EPwm2Regs.TBPHS.half.TBPHS = 0.0*30000;//1.06*30000;
    EPwm3Regs.TBPHS.half.TBPHS = 1.0*30000;//1.1538*30000;
    EPwm4Regs.TBPHS.half.TBPHS = (1.1+0.5*Uzaibo)*30000;//0.1438*30000;+0.5*Uzaibo
    EPwm5Regs.TBPHS.half.TBPHS = (0.1+0.5*Uzaibo)*30000;//0.1438*30000;

    EPwm2Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;//+Uzaibo
    EPwm3Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;
    EPwm4Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;
    EPwm5Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;

    //EPwm1Regs.CMPA.half.CMPA=30000/2;
    //EPwm2Regs.CMPA.half.CMPA=30000/2;

        EPwm1Regs.ETCLR.bit.INT =1;
        PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; //响应本次接收中断;
//        return;

}
请问这个中断函数的问题在哪里,PI控制器的写法是不是有问题,因为我从结果得出的结论是PI控制器没有起作用!

user5878224:

回复 Green Deng:

芯片型号是:28335

interrupt void MainIsr(void)
{

    ILo = iLo;
    ILo_ref = ILO_REF;
    ILo_error = ILo_ref-ILo;
    ILo_Inter += ILo_error*ILo_I;
    if(ILo_Inter > 400)
     ILo_Inter = 400000;
    else if(ILo_Inter < -400)
     ILo_Inter = -400000;
    ILo_out = ILo_Inter+ILo_P*ILo_error;
    if(ILo_out > 500)
     ILo_out = 5000000;
    else if(ILo_out < -500)
     ILo_out = -5000000;
    Uzaibo = ILo_out*0.00009;
//     Uzaibo_out = -Uzaibo*30000/2+30000/2;

    EPwm2Regs.TBPHS.half.TBPHS = 0.0*30000;//1.06*30000;
    EPwm3Regs.TBPHS.half.TBPHS = 1.0*30000;//1.1538*30000;
    EPwm4Regs.TBPHS.half.TBPHS = (1.1+0.5*Uzaibo)*30000;//0.1438*30000;+0.5*Uzaibo
    EPwm5Regs.TBPHS.half.TBPHS = (0.1+0.5*Uzaibo)*30000;//0.1438*30000;

    EPwm2Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;//+Uzaibo
    EPwm3Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;
    EPwm4Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;
    EPwm5Regs.CMPA.half.CMPA = (0.4+Uzaibo)*30000;

    //EPwm1Regs.CMPA.half.CMPA=30000/2;
    //EPwm2Regs.CMPA.half.CMPA=30000/2;

        EPwm1Regs.ETCLR.bit.INT =1;
        PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; //响应本次接收中断;
//        return;

}
请问这个中断函数的问题在哪里,PI控制器的写法是不是有问题,因为我从结果得出的结论是PI控制器没有起作用!

Green Deng:

回复 user5878224:

可以参考一下这个帖子里面的内容以及涉及的例程:e2e.ti.com/…/690039

赞(0)
未经允许不得转载:TI中文支持网 » dsp里面的PI控制器程序问题
分享到: 更多 (0)