Skip to content

Commit

Permalink
add some tests for pid design (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen authored Jan 17, 2021
1 parent b0e5721 commit 9a8c322
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_pid_design.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,19 @@ gangoffourplot(ss(P),ss(1))
kp,ki,C = loopshapingPI(P,ωp,phasemargin=60, doplot=true)
@test kp 0.82274734724854
@test ki -0.45472580052281375

C = pid(;kp = 1, ki = 1, kd=1)
@test C == tf(1) + tf(1,[1,0]) + tf([1,0],[1])
pidplots(C, :nyquist,:gof,:pz,:controller, grid=true) # Simply test that the functions runs and not errors
pidplots(C, :nyquist,:gof,:pz,:controller, grid=false)
leadlinkcurve()

stabregionPID(tf(1,[1,0]))
stabregionPID(s -> exp(-sqrt(s)))

P = tf(1,[1, 1, 1])
kp,ki,C = loopshapingPI(P,10; phasemargin = 30, doplot = false)
_,_,_,pm = margin(P*C)
@test pm[] > 30

end

0 comments on commit 9a8c322

Please sign in to comment.