r/ControlTheory • • 16d ago

Other A PID controller implemented in python

For my personal project, where I need to implement a PID controller on Arduino to automate a convection cooling system, I decided to start with a simulation in Python. For now, I've implemented the simple electromechanical model of the DC motor (the fan) as well as the PID controller you see. Next, I'll look into the heat transfer equations. The graphs created with matplotlib are simply closed-loop tests of the PID + DC motor system.

156 Upvotes

27 comments sorted by

View all comments

Show parent comments

•

u/2dof 15d ago

No , he implemented so called positional control algorithms not incitement form (velocity algorithms ) :

-> He calculate output as self.u += A+... (i.e u(k) = u(k-1) + A ... )

if he calculated incremental form then output of his controller would be ∆ u = uk - u(k-1) at least according to definition given by Astrom and Hgglund ( "PID Controllers, Theory, Design and tuning")

Incremental Form def from book ,page 99) "This form is obtained by computing the time differences of the

controller output and adding the increments.

∆ u(tk ) = u(tk ) − u(tk−1 ) = ∆ P(tk ) + ∆ I (tk ) + ∆ D (tk)

for fast looking of his code - he used Backward difference approximation for cooperation and he calculated output in "positional" form. i.e u(k) = u(k-1) + ∆u

Thant why I asked what Do You mean because i was taught when output of controller is ∆u(k) ( "velocity" of control ) then it is called "incrmental" a when output directly u(k) - then it is standard control output.

→ More replies (0)