public class SineError extends Object implements Multidimensional
Multidimensional interface that returns a
measure of the goodness-of-leveling of the PID.| Modifier and Type | Class and Description |
|---|---|
static class |
SineError.Parse
A command-line frontend to the sine-error class.
|
private static class |
SineError.Relaxation
A class that simulates the reaction of the system to an offset.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ABSOLUTESUM
The indicator for absoulte error-sum quality measure.
|
private double[] |
amplitude
The coefficients of the input function, amplitude.
|
private double |
deadtime
The deadtime until the system starts reacting, in PID-t units.
|
private double[] |
frequency
The coefficients of the input function, frequency.
|
private double |
lag
Latency until the system has reached the new output, in PID units.
|
private int |
maxrelevant
The maximum number of offsets allowed.
|
private double |
noise
The coefficient for thw gaussian noise.
|
private static double |
OVERREACT
If the PID starts to oscilate, the correction will be higher as.
|
private double[] |
phase
The coefficients of the input function, phase.
|
private PIDControl |
pid
The PIDController handling the error function.
|
private double |
pidfreq
The frequency at which the PID is queried.
|
private boolean |
pionly
If true, only optimize PI parameters, keep D fixed.
|
private int |
qualitymeasure
The quality measure, 0-3.
|
private int |
relaxfreq
The period at which offsets are generated in PID-periods.
|
private static int |
RESOLUTION
The number of steps skipped for error determination.
|
static int |
SQUARESUM
The indicator for error square-sum quality measure.
|
static int |
TABSOLUTESUM
The indicator for absolute error times t sum quality measure.
|
private static double |
TINY
A small number to prevent division-by-zero in oscillating test.
|
static int |
TSQUARESUM
The indicator for error squared times t sum quality measure.
|
private Random |
white
The random number generator.
|
| Constructor and Description |
|---|
SineError(double[] a,
double[] f,
double[] phi)
Constructs a new sine error function specifiying the coefficients
of the error function.
|
SineError(double[] a,
double[] f,
double[] phi,
double random)
Constructs a new sine error function specifiying the coefficients
of the error function.
|
| Modifier and Type | Method and Description |
|---|---|
int |
dimension()
Return three for the three PID parameters.
|
double |
evaluateWithNan(VectorG pidvals)
Evaluate the PID.
|
double |
getErrorFunction(double t)
Calculates the error function at the given time.
|
double |
getMinimumFrequency()
Returns the time step of the simulation.
|
double |
runPID(PrintWriter out)
Runs an entire loop using the specified PID and the underlying
error function.
|
void |
setDelay(double newdeadtime)
Sets the deadtime time.
|
void |
setLatencySpeed(double newlag)
Sets the lag time.
|
void |
setMaxRelaxations(int relaxcount)
Sets the number of maximal concurrent active relaxation processes.
|
void |
setPID(PIDControl handle)
Sets the PIDControler that should level the error function.
|
void |
setPIDFrequency(double f)
Sets the PID frequency.
|
void |
setPIOnly(boolean onlypi)
Sets the desired optimization strategy.
|
void |
setQualityMeasure(int newqual)
Sets the quality measurement.
|
void |
setRelaxationPeriod(int relaxperiod)
Set the frequency of the PID corrections as a multiple of the
PID internal period.
|
public static final int SQUARESUM
public static final int ABSOLUTESUM
public static final int TSQUARESUM
public static final int TABSOLUTESUM
private double[] amplitude
private double[] frequency
private double[] phase
private double noise
private Random white
private PIDControl pid
private double pidfreq
private int relaxfreq
private int maxrelevant
private double deadtime
private double lag
private int qualitymeasure
private boolean pionly
private static final int RESOLUTION
private static final double OVERREACT
private static final double TINY
public SineError(double[] a,
double[] f,
double[] phi)
public SineError(double[] a,
double[] f,
double[] phi,
double random)
public void setPID(PIDControl handle)
public void setPIDFrequency(double f)
public void setMaxRelaxations(int relaxcount)
public void setRelaxationPeriod(int relaxperiod)
public void setQualityMeasure(int newqual)
#RESPONSE.public void setDelay(double newdeadtime)
public void setLatencySpeed(double newlag)
public void setPIOnly(boolean onlypi)
public double getErrorFunction(double t)
f = Σiaiċsin(2πfi*t+φi
public double getMinimumFrequency()
public double runPID(PrintWriter out)
#getTimeStep until we reach t >= 1.#addError.#getCorrection and feed the difference of the error function
and the correction into the PID as the new error.public int dimension()
dimension in interface Multidimensionalpublic double evaluateWithNan(VectorG pidvals)
evaluateWithNan in interface Multidimensional