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.

TMS320F280025C: How to update the PI controller parameters (Digital control library) in main.c

Part Number: TMS320F280025C
Other Parts Discussed in Thread: SYSCONFIG

Dear Sir,

I am using the syscfg for the DCL controller

Please suggest the procedure for updating the this PI controller:

The PI controller running in

interrupt void INT_myADCA_1_ISR(void)

{

uk = DCL_runPI_C7(&myCONTROLLER0, rk, yk);

}

and updating as below for kp and ki

void main(void) , write:

  // initialize status update of PI controller

    DCL_resetPI(&myCONTROLLER0);

 

    DCL_SET_CONTROLLER_PERIOD(& myCONTROLLER0, 0.01f);

    myCONTROLLER0.sps->Kp = 5.0f;

    myCONTROLLER0.sps->Ki = 0.51f;

    DCL_REQUEST_UPDATE(&myCONTROLLER0);

 

    DCL_updatePI(&myCONTROLLER0);

    DCL_fupdatePI(&myCONTROLLER0);

After including the above line, ADC variables are not updating in expression window. Program is not responding

Please suggest the procedure for updating PI controller parameters.

Regards

Ajeet

  • Hi Ajeet,

    Thank you for using our E2E forums, please allow me to look into this issue and provide necessary support

    Regards,

    Peter

  • Dear Sir

    The above Problem is solved, after adding the interrupt status flag-clearing instruction.

    Please suggest simple steps for updating PI controller parameters Kp, Ki.

    Regards

    Ajeet

  • Hi Ajeet,

    My apologies in the delayed response, the problem is with the macro DCL_REQUEST_UPDATE. This macro is misleading since it isn't actually updating anything but rather set a flag that would block the subsequent controller update request. It is meant to be coupled with DCL_CLEAR_UPDATE_REQUEST to protect a program updating the controller from an ISR whilst the SPS parameters are being adjusted.

    Therefore, all you need is either getting rid of DCL_REQUEST_UPDATE or add the macro DCL_CLEAR_UPDATE_REQUEST before calling either DCL_updatePI or DCL_fupdatePI.

    One minor gimmick, DCL_resetPI resets the "immediate storage" that stores previous feedback and saturation values (i6,i10,i11) and it was already initialized in the sysconfig parameters so your first call to DCL_resetPI isn't necessary.  

    Hope this helps,

    Sen Wang