Skip to content

Commit 729f724

Browse files
committed
add option for PI controller without zero
1 parent 5f4c438 commit 729f724

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

autotune/autotune.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,17 @@ def updateClosedLoop(self):
544544
kff = self.kff
545545
Gd = ctrl.TransferFunction([1], np.append([1], np.zeros(self.sys_id_delays)), dt)
546546
Gz2 = ctrl.TransferFunction(num, den, dt)
547-
(pid_num, pid_den) = gainsToNumDen(kc, ki, kd, dt)
548-
PID = ctrl.TransferFunction(pid_num, pid_den, dt)
549-
Gcl = (kff * Gd * Gz2 + PID * Gd * Gz2) / (1 + PID * Gd * Gz2)
547+
Gi = ctrl.TransferFunction([ki * dt, ki * dt], [2, -2], dt)
548+
549+
if True:
550+
# PI controller without zero
551+
Gcp = ctrl.feedback(kc * Gz2, [1])
552+
Gcl = ctrl.feedback(ctrl.series(Gi, Gcp), [1])
553+
else:
554+
# Standard PI controller
555+
pi = ctrl.series(kc, ctrl.parallel([1], Gi))
556+
Gcl = ctrl.feedback(ctrl.series(pi, Gz2), [1])
557+
550558
t_out,y_out = ctrl.step_response(Gcl, T=np.arange(0,1,dt))
551559
self.plotClosedLoop(t_out, y_out)
552560
w = np.logspace(-1, 3, 40).tolist()

0 commit comments

Comments
 (0)