JuliaControl / ControlSystems.jl

A Control Systems Toolbox for Julia
https://juliacontrol.github.io/ControlSystems.jl/stable/
Other
503 stars 85 forks source link

`pid` with zero proportional gain #897

Closed mzaffalon closed 8 months ago

mzaffalon commented 9 months ago

pid fails when the proportional gain is 0. This is because the coefficients are converted to the standard form which assumes a non-zero proportional gain.

julia> pid(0, 1; form=:parallel) # expected 1/s
TransferFunction{Continuous, ControlSystemsBase.SisoRational{Float64}}
NaNs
----
1.0
albheim commented 9 months ago

Hmm, that's not good.

I think using the standard form as the "default" that was used in conversion was something I just picked, didn't really think it through. Probably would have been better to have the parallel form for this since the parameters are not tied together and thus won't (?) lead to these problems. On the whole that code is not too pretty, and maybe adding another special case would be the simplest for now.

baggepinnen commented 9 months ago

Yeah, using parallel form by default is probably better in general

albheim commented 9 months ago

So maybe just replace the convert_pidparams_(to/from)_standard with convert_pidparams_(to/from)_parallel and change surrounding code accordingly. Wasn't too many places that called them directly so should be relatively easy I think.

Anyone want to have a look? Otherwise I could probably have a go during the week.

mzaffalon commented 9 months ago

Anyone want to have a look? Otherwise I could probably have a go during the week.

Let me have a go.