acquisition-0.1: Generic interface for digital multimeters and data loggersSource codeContentsIndex
System.Hardware.Acquisition.Adaptor.PID
Synopsis
data Parameters = Parameters {
kp :: Value
ti :: Value
td :: Value
}
adaptor :: MonadIO m => Channel -> IORef Parameters -> Adaptor m
Documentation
data Parameters Source
Constructors
Parameters
kp :: Valuegain; proportional constant
ti :: Valueintegral time
td :: Valuederivative time
show/hide Instances
adaptorSource
:: MonadIO m
=> ChannelsetPoint: desired value of process variable
-> IORef Parameters
-> Adaptor m

PID (proportional-integral-derivative) controller. Implements a discrete version of the following idealised equation:

out[t] = kp ( ϵ[t]  +  1/ti × ∫ϵ[t]dt  +  td × dϵ[t]/dt )

where ϵ[t] = setPoint[t] − in[t]; increasing values of t refer to earlier inputs. The actual implementation is:

out[t] = kp ( ϵ[t]  +  1/ti × ∑ϵ[t]  +  td × (in[t] - in[t-1]) )

Note that the derivative term is modified to measure changes to in[t] rather than ϵ[t], to avoid discontinuities caused by instantaneous step changes to the setPoint.

The setPoint and Parameters are set via IORefs, and may be changed at run-time. (TODO: Perhaps these inputs ought to be Protocols or Channels? At least the setPoint, to allow for cascaded PID controllers...)

See http://en.wikipedia.org/wiki/PID_controller for more details.

Produced by Haddock version 2.3.0