hsPID-0.1.2: PID control loop

CopyrightJonathan Lamothe
LicenseLGPL-3
Maintainerjlamothe1980@gmail.com
Safe HaskellNone
LanguageHaskell2010

Control.PID

Contents

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

Types

data Settings a Source #

PID control loop settings

Constructors

Settings 

Fields

Instances
Eq a => Eq (Settings a) Source # 
Instance details

Defined in Control.PID

Methods

(==) :: Settings a -> Settings a -> Bool #

(/=) :: Settings a -> Settings a -> Bool #

Show a => Show (Settings a) Source # 
Instance details

Defined in Control.PID

Methods

showsPrec :: Int -> Settings a -> ShowS #

show :: Settings a -> String #

showList :: [Settings a] -> ShowS #

data Status a Source #

PID control loop status

Constructors

Status 

Fields

Instances
Eq a => Eq (Status a) Source # 
Instance details

Defined in Control.PID

Methods

(==) :: Status a -> Status a -> Bool #

(/=) :: Status a -> Status a -> Bool #

Show a => Show (Status a) Source # 
Instance details

Defined in Control.PID

Methods

showsPrec :: Int -> Status a -> ShowS #

show :: Status a -> String #

showList :: [Status a] -> ShowS #

Lenses

The Settings and Status types have lenses which are automatically generated by makeLenses. See the lens package for further details.

setpoint :: forall a. Lens' (Settings a) a Source #

pFactor :: forall a. Lens' (Settings a) a Source #

iFactor :: forall a. Lens' (Settings a) a Source #

dFactor :: forall a. Lens' (Settings a) a Source #

bias :: forall a. Lens' (Settings a) a Source #

maxOutput :: forall a. Lens' (Settings a) a Source #

settings :: forall a. Lens' (Status a) (Settings a) Source #

lastError :: forall a. Lens' (Status a) a Source #

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

run Source #

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

resetIntegral Source #

Arguments

:: Num n 
=> Status n

the PID status being reset

-> Status n

the updated PID status

resets the integral of a PID loop