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.

TMDSCNCD28P65X: DCL_runPI_L1 parameters

Part Number: TMDSCNCD28P65X

Tool/software:

Hi,

I am having trouble figuring out the limits parameters in DCL_runPI_L1. Does it have both the integrator limit (Imax, Imin) and control limit(Umax,Umin) in the .asm? I cannot tell explicitly.

I need the integrator flag most importantly for my application; The lk flag equivalent in TI PID sample codes.

Thank you in advance.

  • Hello,

    DCL_runPI_L1 is the CLA version of DCL_runPI_C1/C2 (serial PI) and it does not have an integrator limit, only a saturation clamp.

    The only PI controller that uses an integrator limit is DCL_runPI_C5. Which is C-source of parallel PI w/ enhanced anti-windup. And unfortauntely we don't have a C28 assmembly  nor CLA version of the code.

    But since CLA takes in C-syntax code. We could easily adapt C5 into CLA. The only difference is that anything regarding CSS and SPS struct needs to be removed. I.e:

    // CLA source code of DCL_runPI_C5 -> parallel pi with enhanced anti-windup
    static inline float32_t DCL_runPI_L6(DCL_PI_CLA *p, float32_t rk, float32_t yk)
    {
        float32_t v1, v5, v7, v8;
        uint16_t l11, l12, l14, l17, l18, l19;
        
        asm(" MSETFLG   RNDF32=1");
        v1 = rk - yk;
        v5 = (v1 * p->Ki * p->i6) + p->i10;
        p->i10 = v5;
        v7 = (v1 * p->Kp) + v5;
        v8 = (v7 > p->Umax) ? p->Umax : v7;
        v8 = (v8 < p->Umin) ? p->Umin : v8;
        l17 = ((v7 - v8) == 0) ? 1U : 0U;
        l11 = (v5 >= p->Imax) ? 1U : 0U;
        l12 = (v5 <= p->Imin) ? 1U : 0U;
        l19 = (v5 > 0) ? 1U : 0U;
        l14 = (v1 > 0) ? 1U : 0U;
        l18 = l17 & (!(l11 | l12) | (l19 ^ l14));
        p->i6 = (l18 == 0U) ? 0.0f : 1.0f;
    
    
        return(v8);
    }

    Alternatively, you can also just use serial/parallel PID controllers that's already written in assembly for CLA (DCL_runPID_L1 & L2).

    Please let me know if you have any addintional questions.

    Best,

    Sen Wang

  • Understood. How many cycles would DCL_runPI_L6 take? An estimate is also fine in this case.

    Andrew.

  • Hi Andrew,

    I can provide a rough estimate based on existing benchmarks from the DCL user's guide:

    Judging by how DCL_runPI_C6 and DCL_runPI_L5 are roughly similar (PI w/ tustin integrator in C28 C-source vs CLA C-source). The CLA C-source variant of C5 benchmark will be similar to DCl_runPI_C5 (~190 cycles). 

    In contrast, the assembly variant of CLA implementations are much faster, DCL_runPID_L1/L2 are 53 & 45 cycles. And the regular L1/L2 PIs are 34 & 33 cycles.

    Therefore, I would recommend to just use PID controller instead in CLA, if performance is a concern. (serial/parallel: DCL_runPID_L1/L2).

    Best,

    Sen Wang