| Copyright | Jonathan Lamothe |
|---|---|
| License | LGPL-3 |
| Maintainer | jlamothe1980@gmail.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Control.PID
Description
Copyright (C) 2018 Jonathan Lamothe jlamothe1980@gmail.com
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Synopsis
- data Settings a = Settings {
- _setpoint :: a
- _pFactor :: a
- _iFactor :: a
- _dFactor :: a
- _bias :: a
- _isReversed :: Bool
- _maxOutput :: a
- data Status a = Status {
- _settings :: Settings a
- _lastError :: a
- _lastIntegral :: a
- setpoint :: forall a. Lens' (Settings a) a
- pFactor :: forall a. Lens' (Settings a) a
- iFactor :: forall a. Lens' (Settings a) a
- dFactor :: forall a. Lens' (Settings a) a
- bias :: forall a. Lens' (Settings a) a
- isReversed :: forall a. Lens' (Settings a) Bool
- maxOutput :: forall a. Lens' (Settings a) a
- settings :: forall a. Lens' (Status a) (Settings a)
- lastError :: forall a. Lens' (Status a) a
- lastIntegral :: forall a. Lens' (Status a) a
- newSettings :: Fractional a => Settings a
- newStatus :: Fractional a => Status a
- run :: (Ord n, Fractional n) => n -> n -> Status n -> (n, Status n)
- resetIntegral :: Num n => Status n -> Status n
Types
PID control loop settings
Constructors
| Settings | |
Fields
| |
PID control loop status
Constructors
| Status | |
Fields
| |
Lenses
The Settings and Status types have lenses which are
automatically generated by makeLenses. See the
lens package for
further details.
lastIntegral :: forall a. Lens' (Status a) a Source #
Default Instances
newSettings :: Fractional a => Settings a Source #
the default PID settings (these will probably need tuning)
newStatus :: Fractional a => Status a Source #
an inital PID state with the default PID settings
Functions
Arguments
| :: (Ord n, Fractional n) | |
| => n | the amount of time elapsed since the PID loop was last run |
| -> n | the current input value |
| -> Status n | the current PID status |
| -> (n, Status n) | the output and updated PID status |
runs the PID loop