|
1 | | -export pid, pid_tf, pid_ss, pid_2dof, pid_ss_2dof, pidplots, leadlink, laglink, leadlinkat, leadlinkcurve, stabregionPID, loopshapingPI, placePI, loopshapingPID |
| 1 | +export pid, pid_tf, pid_ss, pid_2dof, pid_ss_2dof, pidplots, leadlink, laglink, leadlinkat, leadlinkcurve, stabregionPID, loopshapingPI, placePI, loopshapingPID, loopshapingPD |
2 | 2 | export convert_pidparams_from_parallel, convert_pidparams_from_standard, convert_pidparams_from_to, convert_pidparams_to_parallel, convert_pidparams_to_standard |
3 | 3 |
|
4 | 4 | """ |
@@ -519,6 +519,27 @@ function loopshapingPI(P0, ωp; ϕl=0, rl=0, phasemargin=0, form::Symbol=:standa |
519 | 519 | (; C, kp, ki, fig, CF) |
520 | 520 | end |
521 | 521 |
|
| 522 | +""" |
| 523 | + C, kp, kd, fig, CF = loopshapingPD(P, ωp; ϕl, rl, phasemargin, form=:standard, doplot=false, Tf, F) |
| 524 | +
|
| 525 | +Selects the parameters of a PD-controller (on parallel form) such that the Nyquist curve of `P` at the frequency `ωp` is moved to `rl exp(i ϕl)` |
| 526 | +
|
| 527 | +The parameters can be returned as one of several common representations |
| 528 | +chosen by `form`, the options are |
| 529 | +* `:standard` - ``K_p(1 + 1/(T_i s) + T_d s)`` |
| 530 | +* `:series` - ``K_c(1 + 1/(τ_i s))(τ_d s + 1)`` |
| 531 | +* `:parallel` - ``K_p + K_i/s + K_d s`` |
| 532 | +
|
| 533 | +If `phasemargin` is supplied (in degrees), `ϕl` is selected such that the curve is moved to an angle of `phasemargin - 180` degrees |
| 534 | +
|
| 535 | +If no `rl` is given, the magnitude of the curve at `ωp` is kept the same and only the phase is affected, the same goes for `ϕl` if no phasemargin is given. |
| 536 | +
|
| 537 | +- `Tf`: An optional time constant for second-order measurement noise filter on the form `tf(1, [Tf^2, 2*Tf/sqrt(2), 1])` to make the controller strictly proper. |
| 538 | +- `F`: A pre-designed filter to use instead of the default second-order filter that is used if `Tf` is given. |
| 539 | +- `doplot` plot the `gangoffourplot` and `nyquistplot` of the system. |
| 540 | +
|
| 541 | +See also [`loopshapingPI`](@ref), [`loopshapingPID`](@ref), [`pidplots`](@ref), [`stabregionPID`](@ref) and [`placePI`](@ref). |
| 542 | +""" |
522 | 543 | function loopshapingPD(P0, ωp; ϕl=0, rl=0, phasemargin=0, form::Symbol=:standard, doplot=false, Tf = nothing, F=nothing) |
523 | 544 | issiso(P0) || throw(ArgumentError("P must be SISO")) |
524 | 545 | if F === nothing && Tf !== nothing |
|
0 commit comments