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.

LAUNCHXL-F28379D: Converting Continous Time PI parameters to C2000 DCL PI C1

Part Number: LAUNCHXL-F28379D

Hello,

I've designed a continous time series ideal PI controller which has a form below. However, I want to reflect my Kp and Ki parameters to  DCL PI C1. How can I convert continous time to DCL PI C1 type?

Continous time PI controller :  P (1 + I*(1/s))

By converting I think sampling time will be used. What is the sampling time, clock of CPU?

  • When discretizing, you need to know the rate at which you are running the discrete time controller.  The reciprocal of that is "sampling time" in this context.

    Regards,

    Richard

  • Richard,

    I use my PI controller at ISR loop. My code gets into ISR at 5kHz rate and my bandwidth of PI is adjusted as 1kHz. My CPU works at 100Mhz.

    Thank you in advance.

  • Then your sampling time will be 1/5000 = 0.2ms.

  • Richard,

    Thank you for helping on finding Ts. Then, which formula can I use to convert parameters of continous time series ideal PI into DCL PI C1?

  • I recommend reviewing this video:

    https://training.ti.com/control-theory-seminar-part-4

    The Tustin method is probably the most common.  See from 1:25:47.

    Regards,

    Richard

  • Dear Richard,

    Thank you for your help. I watched all videos about your seminar and it was really helpful to understand the concepts. 

    In this topic, I'm trying to refer my s-domain series ideal PI compansator into my software DCL PI C1 parameters. Both have Kp and Ki, however, DCL PI C1 function works at discrete domain and I have to transform s-domain Kp and Ki to z-domain Kp and Ki in order to be able to insert DCL PI C1 function.

    As you explained at seminar, I can use tustin method but also being careful. I should first use prewarping at desired bandwidth frequency and then apply tustin method. Then, I got a z domain transfer function.

    Now, here question rises.. This z domain transfer function should be inserted to DCL PI C1 parameters as Kp and Ki. Why I need that is I'm aiming to simulate my system using models at folder c:/ti/c2000/.../control/models there are models of DCL PI,PID etc . If I cannot get a formula for conversion, I cannot use those models on simulink. The reason to use those models is because I believed that that models will show most accurate results between simulation and real word.

    I can use zpk3 method to install the transfer function to software and I can still use dcl_runPI_C1 at ISR, as explained at previous topics of forum.

    However, I cannot simulate at my controller at simulink, because there is no model about zpk formatted DCL PI C1.

    Could you please guide me and correct me ,if I had mistakes at above expl.,?

  • Since you already have your Kp * Ki gains for your s domain controller, the simplest thing would be to transform these directly into the PI C1 gains using a Tustin transform. You don't need pre-warping. The equations to do this are:

    kpd = kp * (1 - ki*T);
    kid = ((2 + ki*T) / (2 - ki*T)) - 1;

    Obviously kpd & kid are the PI_C1 gains, kp & ki are your s domain controller gains, and T is the sampling period. You will be able to plug the above gains directly into the Simulink model in the DCL.

    Let me know if this works for you.  Thanks.

    Regards,

    Richard

  • Dear Richard,

    Thank you for your help.

    I tried to convert my s domain PI parameter into DCL PI C1 simulink model parameters and used it in simulation. I used your above formula. My simulink simulation of DCL PI C1 worked in general as expected. Thank you again.

    However, I have one problem.

    I have inner and outer DCL PI C1 simulink models for current mode controlled buck converter,which I use it as battery charger.

    When the outer loop simulink model PI reaches the preset voltage, its output goes low. However, inner loop DCL PI C1 continuoes to generate output and it doesn't follow its referrence input. I don' know why but I guess its because of windup issue.

    What is your comment about my problem and solution about it? I can use another series form PI parameters if others solve it.

    Thank you in advance

  • gG,

    I am working to find another expert to assist with your follow up question above.  Appreciate your patience in the matter.

    Best,

    Matthew

  • Hi gG,

    For your continuous Simulink simulation that works for you, are you using a specific anti-windup technique? You may need to modify the library code to implement the anti-windup technique that works best for you. Thanks.

    Han

  • Hello,

    I'm using DCL PI C1 model. Could you please offer another model or function which performs anti windup inside?

  • There are a lot of different PI anti windup technique in papers and books. The DCL PI C1 implemented one of the most street forward method: lock the integrator when output is saturated. The PI C5 implemented a slightly more complicated method that you can test out.

    But for your specific application, you may want to explore other methods as well to find out which one works best for you. For example, the built-in PI controller in Simulink have two commonly-used anti windup methods that you can try out. 

    Once you find the best method for your application, you can modify the code to implement the specific technique.

  • Do you have any update on this topic? I will close the thread for now and please feel free to post if your got further question. Thanks.

  • Hello,

    I couldn't focus on the topic. However, I will try DCL PI C5 for the simulation. I will inform you about it.

    Thank you.