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.

CCS/TMS320F28335: TMS320F28335

Part Number: TMS320F28335
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi,

I am trying to implement the transfer function of the controller designed for buck converter in Code Composer Studio for closed loop duty ratio control.

The controller transfer function in s domain is this

Hc(s) = (958s^2 +5.2e6s + 6.9e9) / (s^3 + 117140 s^2 + 3.43e9s)

The controller transfer function in z domain is this

Hc(z) = (2.3e-4 - 2.3e-4z^-1 - 2.3e-4 z^-2 + 2.3e-4 z^-3) / (1 - 2.94z^-1 + 2.8z^-2 - 0.9431z^-3)

In discrete domain, the controller transfer function is found to be

u(n) = 2.9*u(n-1) - 2.8*u(n-2) + 0.94*u(n-3) + 2.3e-4*e(n) - 2.3e-4*e(n-1) - 2.3e-4*e(n-2) + 2.3e-4*e(n-3)

where e(n) = input to controller = error

and u(n) = output of controller = duty ratio

Now I have trouble implementing this transfer function in C. Can you please tell me how to program this in code composer studio?


Thanks a lot.

  • I recommend downloading the latest version of C2000Ware. It contains a Digital Control Library with routines for implementing 3P3Z control laws like this. If you install C2000Ware in the default path, the library will be at:

    C:\ti\c2000\C2000Ware_1_00_06_00\libraries\control\DCL

    In the context of the library, the structure you should be using is called "DF23". There are support functions to help you initialize and update the controller, all of which are described in the documentation.

    In you case you'll do something like this (I think):

    #include "DCLF32.h"

    DCL_DF23 ctrl = DF23_DEFAULTS;
    float uk;

    main() {
    ctrl.a1 = -2.94f;
    ctrl.a2 = 2.8f;
    ctrl.a3 = -0.9431;
    ctrl.b0 = 2.3e-4f;
    ctrl.b1 = -2.3e-4f;
    ctrl.b2 = -2.3e-4f;
    ctrl.b3 = 2.3e-4f;

    ...
    ek = ...
    uk = DCL_runDF23_C1(&ctrl, ek);

    You can also load the coefficients directly from the pole-zero description using a ZPK3 structure.

    Regards,

    Richard