stella.util
Class TelescopeError

java.lang.Object
  extended by stella.util.TelescopeError
All Implemented Interfaces:
Multidimensional

public class TelescopeError
extends Object
implements Multidimensional

A class that models a time-dependend shift according to an overlay of sine functions. A PID is then used to correct for this shift, and as a test, the difference between the PID response and the true function is feed into the PID. For optimal performance, the frequencies should be plain integers.
To allow optimization of the PID with a simplex algorithm, this class also implements the Multidimensional interface that returns a measure of the goodness-of-leveling of the PID.


Nested Class Summary
static class TelescopeError.Parse
          A command-line frontend to the sine-error class.
 
Field Summary
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 seconds.
private  double diameter
          The diameter of the guiding telescope in meters.
private  double expose
          The exposure time on the guiding unit in sec.
private static double IMPOSSIBLE
          If the PID returns a correction higher then this, we cannot follow.
private  double jerk
          The jerk of the axis, in deg/s^3
private static double[] motion
          For optimizing runs, we use the same random image motion.
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[] period
          The coefficients of the input function, period.
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 static int RESOLUTION
          The number of steps skipped for error determination.
private  double seeing
          The seeing in arc-sec, if seeing should be included.
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.
private  double wind
          The wind speed, only if seeing > 0.
 
Constructor Summary
TelescopeError(double[] a, double[] p, double[] phi)
          Constructs a new sine error function specifiying the coefficients of the error function.
TelescopeError(double[] a, double[] p, double[] phi, double random)
          Constructs a new sine error function specifiying the coefficients of the error function.
 
Method Summary
 int dimension()
          Return three for the three PID parameters.
 double evaluate(VectorG pidvals)
          Evaluate the PID.
 double getErrorFunction(double t)
          Calculates the error function at the given time.
 double getMaximumPeriod()
          Returns the period of the error function after which it repeats itself.
 double runPID(PrintWriter out)
          Runs an entire loop using the specified PID and the underlying error function.
 void setAxisJerk(double newjerk)
          Sets the jerk of the motor axis in degs/s^3.
 void setDelay(double newdeadtime)
          Sets the deadtime time.
 void setGuiderExpose(double newexpose)
          Sets the guider exposure time.
 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 setSeeing(double newseeing)
          Sets the seeing level.
 void setTelescopeSize(double newsize)
          Sets the size of the guider telescope.
 void setWindSpeed(double newwind)
          Sets the wind speed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQUARESUM

public static final int SQUARESUM
The indicator for error square-sum quality measure.

See Also:
Constant Field Values

ABSOLUTESUM

public static final int ABSOLUTESUM
The indicator for absoulte error-sum quality measure.

See Also:
Constant Field Values

TSQUARESUM

public static final int TSQUARESUM
The indicator for error squared times t sum quality measure.

See Also:
Constant Field Values

TABSOLUTESUM

public static final int TABSOLUTESUM
The indicator for absolute error times t sum quality measure.

See Also:
Constant Field Values

amplitude

private double[] amplitude
The coefficients of the input function, amplitude.


period

private double[] period
The coefficients of the input function, period.


phase

private double[] phase
The coefficients of the input function, phase.


noise

private double noise
The coefficient for thw gaussian noise.


white

private Random white
The random number generator.


pid

private PIDControl pid
The PIDController handling the error function.


pidfreq

private double pidfreq
The frequency at which the PID is queried.


deadtime

private double deadtime
The deadtime until the system starts reacting, in seconds.


jerk

private double jerk
The jerk of the axis, in deg/s^3


seeing

private double seeing
The seeing in arc-sec, if seeing should be included.


wind

private double wind
The wind speed, only if seeing > 0.


diameter

private double diameter
The diameter of the guiding telescope in meters. Only if seeing > 0.


expose

private double expose
The exposure time on the guiding unit in sec. Only if seeing > 0.


motion

private static double[] motion
For optimizing runs, we use the same random image motion.


qualitymeasure

private int qualitymeasure
The quality measure, 0-3.


pionly

private boolean pionly
If true, only optimize PI parameters, keep D fixed.


RESOLUTION

private static final int RESOLUTION
The number of steps skipped for error determination.

See Also:
Constant Field Values

OVERREACT

private static final double OVERREACT
If the PID starts to oscilate, the correction will be higher as.

See Also:
Constant Field Values

IMPOSSIBLE

private static final double IMPOSSIBLE
If the PID returns a correction higher then this, we cannot follow.

See Also:
Constant Field Values

TINY

private static final double TINY
A small number to prevent division-by-zero in oscillating test.

See Also:
Constant Field Values
Constructor Detail

TelescopeError

public TelescopeError(double[] a,
                      double[] p,
                      double[] phi)
Constructs a new sine error function specifiying the coefficients of the error function. No white noise.


TelescopeError

public TelescopeError(double[] a,
                      double[] p,
                      double[] phi,
                      double random)
Constructs a new sine error function specifiying the coefficients of the error function. White noise is added.

Method Detail

setPID

public void setPID(PIDControl handle)
Sets the PIDControler that should level the error function.


setPIDFrequency

public void setPIDFrequency(double f)
Sets the PID frequency.


setQualityMeasure

public void setQualityMeasure(int newqual)
Sets the quality measurement. Defines how the quality of the PID is measured. The values allowed are: All of the quality measurements are obtained only after the intial transient response, defined by the number of steps given in #RESPONSE.


setDelay

public void setDelay(double newdeadtime)
Sets the deadtime time. This is the time it takes the system to start reacting to a new signal. The time unit is the inverse of the PID frequency.


setAxisJerk

public void setAxisJerk(double newjerk)
Sets the jerk of the motor axis in degs/s^3.


setPIOnly

public void setPIOnly(boolean onlypi)
Sets the desired optimization strategy. If true, only P and I are changed.


setSeeing

public void setSeeing(double newseeing)
Sets the seeing level.


setWindSpeed

public void setWindSpeed(double newwind)
Sets the wind speed. Necessary if seeing is included.


setGuiderExpose

public void setGuiderExpose(double newexpose)
Sets the guider exposure time. Necessary if seeing is included.


setTelescopeSize

public void setTelescopeSize(double newsize)
Sets the size of the guider telescope. Necessary if seeing is included.


getErrorFunction

public double getErrorFunction(double t)
Calculates the error function at the given time. The function is evaluated as
       f = Σiaiċsin(2πfi*t+φi
       
If additional white-nois of the error-function (not seeing!) is requested, it is added to the error function right here.


getMaximumPeriod

public double getMaximumPeriod()
Returns the period of the error function after which it repeats itself. The number of steps of the simulation is this over the pid-frequency.


runPID

public double runPID(PrintWriter out)
Runs an entire loop using the specified PID and the underlying error function. If the PrintWriter supplied is not null, the result of each step are writtn within, the procedure is as follows.


dimension

public int dimension()
Return three for the three PID parameters.

Specified by:
dimension in interface Multidimensional

evaluate

public double evaluate(VectorG pidvals)
Evaluate the PID. This runs the PID and returns the offset. This offset, in turn, should be minimized. The parameters in the vector argument are interpreted as the proportional, integral, and differential parameter of the PID, in this order.

Specified by:
evaluate in interface Multidimensional