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.

TMS320F280049: DCL_runClamp_C1 in the DCL library

Part Number: TMS320F280049

Dear Champs,

I am asking this for our customer.

What is DCL_runClamp_C1 used for?

In Example_F28069_PID.c, it's before DCL_runPID_C4.

Is this has anything to do with l(k)?

Would you please explain it in more detail?

Wayne Huang

  • Wayne,

    Correct.  The clamp function is there to guarantee lk is either 1.0 or 0.0.  This variable is used as an argument to DCL_runPID_C4 where it denotes an external saturation.  When lk is 1.0 there is no external saturation; when lk is 0.0 saturation has occurred.  The controller then clamps the integrator to avoid wind-up.

    This example was re-written for DCL v3.3 to make this clearer.  The revised code is below:

    // read ADC channel

    yk = ((float) AdcResult.ADCRESULT0 - 2048.0f) / 2047.0f;

    // run PID controller
    uk = DCL_runPID_C4(&pid1, rk, yk, lk);

    // external clamp for anti-windup reset
    clampactive = DCL_runClamp_C1(&uk, upperlim, lowerlim);
    lk = (clampactive == 0U) ? 1.0f : 0.0f;

    Version 3.3 will be released in March.

    Regards,

    Richard