public class PIDFController
extends java.lang.Object
Constructor and Description |
---|
PIDFController(double[] coeff)
Pre-Condition: coeff is a four-element array: {kP, kI, kD, kF}
|
PIDFController(double[] coeff,
double sp,
double pv,
double period)
This is the full constructor for the PIDF controller.
|
Modifier and Type | Method and Description |
---|---|
boolean |
atSetPoint()
Returns true if the error is within the percentage of the total input range, determined by
setTolerance(double) . |
double |
calculate()
Calculates the next output of the PIDF controller.
|
double |
calculate(double pv)
Calculates the control value, u(t).
|
double |
calculate(double pv,
double sp)
Calculates the next output of the PIDF controller.
|
double[] |
getCoefficients() |
double |
getPeriod() |
double |
getPositionError() |
double |
getSetPoint()
Returns the current setpoint of the PIDFController.
|
double[] |
getTolerance() |
double |
getVelocityError() |
void |
reset() |
void |
setSetPoint(double sp)
Sets the setpoint for the PIDFController
|
void |
setTolerance(double positionTolerance)
Sets the error which is considered tolerable for use with
atSetPoint() . |
void |
setTolerance(double positionTolerance,
double velocityTolerance)
Sets the error which is considered tolerable for use with
atSetPoint() . |
public PIDFController(double[] coeff)
The period
is automatically set to 0.02.
public PIDFController(double[] coeff, double sp, double pv, double period)
coeff
- The coefficient array as specified in the pre-condition of the basic constructor.sp
- The setpoint of the pid control loop.pv
- The measured value of he pid control loop. We want sp = pv, or to the degree
such that sp - pv, or e(t) < tolerance.period
- The interval of time between the iteration of the control loop.public void reset()
public void setTolerance(double positionTolerance)
atSetPoint()
.positionTolerance
- Position error which is tolerable.public void setTolerance(double positionTolerance, double velocityTolerance)
atSetPoint()
.positionTolerance
- Position error which is tolerable.velocityTolerance
- Velocity error which is tolerable.public double getSetPoint()
public void setSetPoint(double sp)
sp
- The desired setpoint.public boolean atSetPoint()
setTolerance(double)
.public double getPeriod()
public double[] getCoefficients()
public double getPositionError()
public double[] getTolerance()
public double getVelocityError()
public double calculate()
calculate(double)
.public double calculate(double pv, double sp)
pv
- The given measured value.sp
- The given setpoint.calculate(double)
.public double calculate(double pv)
pv
- The current measurement of the process variable.