Skip to content

Commit 9372faf

Browse files
committed
fix Td in PID
1 parent c56daf0 commit 9372faf

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Blocks/continuous.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function PID(; name, k = 1, Ti = false, Td = false, Nd = 10, xi_start = 0, xd_st
228228
@named Izero = Constant(k = 0)
229229
end
230230
if with_D
231-
@named der = Derivative(k = 1 / Td, T = 1 / Nd, x_start = xd_start)
231+
@named der = Derivative(k = Td, T = 1 / Nd, x_start = xd_start)
232232
else
233233
@named Dzero = Constant(k = 0)
234234
end

test/Blocks/continuous.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ end
169169
@testset "PID" begin
170170
re_val = 2
171171
@named ref = Constant(; k = re_val)
172-
@named pid_controller = PID(k = 3, Ti = 0.5, Td = 100)
172+
@named pid_controller = PID(k = 3, Ti = 0.5, Td = 1 / 100)
173173
@named plant = Plant()
174174
@named fb = Feedback()
175175
@named model = ODESystem([
@@ -280,7 +280,7 @@ end
280280
@testset "LimPID" begin
281281
re_val = 1
282282
@named ref = Constant(; k = re_val)
283-
@named pid_controller = LimPID(k = 3, Ti = 0.5, Td = 1/100, u_max = 1.5, u_min = -1.5,
283+
@named pid_controller = LimPID(k = 3, Ti = 0.5, Td = 1 / 100, u_max = 1.5, u_min = -1.5,
284284
Ni = 0.1 / 0.5)
285285
@named plant = Plant()
286286
@named model = ODESystem([
@@ -342,7 +342,7 @@ end
342342
end
343343
@testset "set-point weights" begin
344344
@testset "wp" begin
345-
@named pid_controller = LimPID(k = 3, Ti = 0.5, Td = 1/100, u_max = 1.5,
345+
@named pid_controller = LimPID(k = 3, Ti = 0.5, Td = 1 / 100, u_max = 1.5,
346346
u_min = -1.5, Ni = 0.1 / 0.5, wp = 0, wd = 1)
347347
@named model = ODESystem([
348348
connect(ref.output, pid_controller.reference),
@@ -363,7 +363,7 @@ end
363363
@test all(-1.5 .<= sol[pid_controller.ctr_output.u] .<= 1.5) # test limit
364364
end
365365
@testset "wd" begin
366-
@named pid_controller = LimPID(k = 3, Ti = 0.5, Td = 1/100, u_max = 1.5,
366+
@named pid_controller = LimPID(k = 3, Ti = 0.5, Td = 1 / 100, u_max = 1.5,
367367
u_min = -1.5, Ni = 0.1 / 0.5, wp = 1, wd = 0)
368368
@named model = ODESystem([
369369
connect(ref.output, pid_controller.reference),

0 commit comments

Comments
 (0)