Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

what is the calculation delay in PID used for?

+1 vote
1,094 views
Hello everybody!

I am using the PID example giving in buck converter current mode control. First, I could not find where it is found in the library so I used the example given in the models.

secondly, whenever I put the calculation delay in the Digital C-Script-based PI to 0 value, my system crashes and shows errors, anyone can clarify what is it about?

Thank you
asked Feb 7, 2018 by EMdude (75 points)

1 Answer

+1 vote
Hi EMdude,

The PI controller is not in the library, but you can use the one from the example in your models.

Setting the calculation delay to zero is not a valid input for the C-Script based PI-Contreller. However you may put in a very small value to make it's effect negligible.

Understanding the C-Script requires deeper knowledge of the PLECS system and using it is not recommended for the beginner. The C-Script chapter in the documentation is a good read and also gives some examples.

Cheers

Falk
answered Feb 7, 2018 by Falk Kyburz (253 points)
Hi Falk, I appreciate your response.

I have another question related to PID which is stupid but I have to ask it because I am cunfused all the time about it. in the example given of  C-Script based PI-Contreller.

I am not sure what I actually should insert in the Kp and Ki variable, is it

Kp=0.45*Ku

Ki=Kp/Ti.

or

Kp=k

Ki= Ti

 

please find the picture attached

cheers,

EMdude
If you open the Controller block, you can have a look at the implementation (Ctrl+U) of the digital as well as the analog controller. The digital version is implemented using a C-Script block and the analog one uses gain blocks and a continuous time integrator. Both versions are implemented in the known parallel controller structure (as opposed to serial).

I would suggest you use the analog version if you don't have experience in discrete time domain modelling. The PI-element can be expressed as a n inverted zero in the s-domain. R. W. Erickson has some good lecture notes on bode plots, google it.

G(s) = k_r * (1 + w_c / s)

When packing the Analog PI version of the controller into an equation, we get

G(s) = k_p + k_i / s.

Using coefficient comparison you, can determine the values for k_p and k_i:

k_r  + k_r * w_c / s  = k_p + k_i / s

->> k_p = k_r

->> k_i = k_r * w_c

For the digital version, there is more stuff involved.

Hope this helps.

Falk
...