PFIPController
Class ADCTCSTrack

java.lang.Object
  extended by java.util.TimerTask
      extended by PFIPController.ADCTCSTrack
All Implemented Interfaces:
java.lang.Runnable

public class ADCTCSTrack
extends java.util.TimerTask
implements java.lang.Runnable

The purpose of this class is to provide a thread in the PFIP controller which will monitor the position of the telescope and set the ADC according to the zenith angle upon which the telescope is currently set at. It acceses the OCSCorbaDramaBridge CORBA server in order to access the telescope positional data and then uses the CORBA subactions which can be used to move the ADC elements.

This process is run as part of a thread which is run every 10 seconds.

It takes care not to move the ADC unless the amount to be moved exceeds the granularity of the encoders associated with the ADCs.

Note that the calculation takes into effect the telescope slewing to a new position on the sky (that is to say that it does not simply take the mid-slew position and base the calculation of the ADC based on that position).

Version:
$Id: ADCTCSTrack.java,v 1.7 2004/11/12 10:38:06 cb Exp $
Author:
Craige Bevil

Field Summary
private  boolean ADCTCSTrackModeEnabled
          Whether or not ADC update mode is enabled, by default, ADC positional updates are performed.
private  org.omg.CORBA.Any ADCUpdateNoticeBoardItem
          This will be used when updating the parameter noticeboard and will contain the current status of ADC updates.
private static java.util.Timer ADCUpdateTimer
          This is a Timer object which will be used to schedule updates of the ADC.
private  SubAction ADIMoveSubaction
          A remote CORBA reference to the subaction which can be used to move the ADI mechanism.
private  SubAction ADOMoveSubaction
          A remote CORBA reference to the subaction which can be used to move the ADO mechanism.
private  double LastDemandedADCPosition
          This is the last demanded position of the ADC, we only request that the 4MS changes the position of the ADC elements when the telescope zenith position changes significantly.
private  org.omg.CORBA.ORB Orb
          ORB used by the class to do all sorts of CORBA type things.
private  boolean OutOfRange
          A flag used to moderate the reporting of errors when the calculation of the ADC position goes out of range
private  iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
          This is a reference to the remote proxy CORBA object which will be used to access the parameter notice board so that we may store associated status information such as the current update status of the ADC.
private  org.omg.PortableServer.POA Poa
          The POA used by the class
private  org.omg.CosNaming.NamingContextExt RootNamingServiceContext
          A reference to the CORBA name service so that it may find the remote subaction objects which an be used to move the ADC elements.
private  MessageHandler SyslogMessageHandler
          This is a syslog object which will be used to report errors etc.
private  boolean TCSAccessAlarmReported
          Whether an alarm has been reported in the case that we cannot talk to the TCS , we only report the alarm once when we cannot connect to the TCS
private  OCSCorbaDrama.TCSInterface TCSInformationSupplier
          Remote CORBA object reference which will be used to provide us with TCS positional information on demand.
 
Constructor Summary
ADCTCSTrack(org.omg.PortableServer.POA Poa, org.omg.CORBA.ORB Orb, org.omg.CosNaming.NamingContextExt RootNamingServiceContext, MessageHandler SyslogMessageHandler)
          This is the constructor.
 
Method Summary
private  double calculateADCAngle(double ZenithDistance)
          Calculate the ADC element angle, given the telescope zenith distance.
 boolean getADCUpdateMode()
          Returns the current status of ADC updates, whether they are enabled or not.
 void run()
          This implements this classes contractual obligation to the TimerTask interface by implementing the run method.
 void setADCUpdateMode(boolean EnableADCUpdate)
          Allows the ADC positional updates to be enabled or disabled.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TCSAccessAlarmReported

private boolean TCSAccessAlarmReported
Whether an alarm has been reported in the case that we cannot talk to the TCS , we only report the alarm once when we cannot connect to the TCS


OutOfRange

private boolean OutOfRange
A flag used to moderate the reporting of errors when the calculation of the ADC position goes out of range


ParameterNoticeBoard

private iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
This is a reference to the remote proxy CORBA object which will be used to access the parameter notice board so that we may store associated status information such as the current update status of the ADC.


LastDemandedADCPosition

private double LastDemandedADCPosition
This is the last demanded position of the ADC, we only request that the 4MS changes the position of the ADC elements when the telescope zenith position changes significantly.


ADCUpdateNoticeBoardItem

private org.omg.CORBA.Any ADCUpdateNoticeBoardItem
This will be used when updating the parameter noticeboard and will contain the current status of ADC updates.


ADCUpdateTimer

private static final java.util.Timer ADCUpdateTimer
This is a Timer object which will be used to schedule updates of the ADC. This object is a TimerTask and schedules itself to perform updates of the ADC position every 10 seconds.


TCSInformationSupplier

private OCSCorbaDrama.TCSInterface TCSInformationSupplier
Remote CORBA object reference which will be used to provide us with TCS positional information on demand.


ADOMoveSubaction

private SubAction ADOMoveSubaction
A remote CORBA reference to the subaction which can be used to move the ADO mechanism.


ADIMoveSubaction

private SubAction ADIMoveSubaction
A remote CORBA reference to the subaction which can be used to move the ADI mechanism.


ADCTCSTrackModeEnabled

private boolean ADCTCSTrackModeEnabled
Whether or not ADC update mode is enabled, by default, ADC positional updates are performed.


Orb

private org.omg.CORBA.ORB Orb
ORB used by the class to do all sorts of CORBA type things.


Poa

private org.omg.PortableServer.POA Poa
The POA used by the class


RootNamingServiceContext

private org.omg.CosNaming.NamingContextExt RootNamingServiceContext
A reference to the CORBA name service so that it may find the remote subaction objects which an be used to move the ADC elements.


SyslogMessageHandler

private MessageHandler SyslogMessageHandler
This is a syslog object which will be used to report errors etc. to the syslog.

Constructor Detail

ADCTCSTrack

public ADCTCSTrack(org.omg.PortableServer.POA Poa,
                   org.omg.CORBA.ORB Orb,
                   org.omg.CosNaming.NamingContextExt RootNamingServiceContext,
                   MessageHandler SyslogMessageHandler)
This is the constructor. As part of the intialisation, we need to establish the CORBA IORs of the subactions which will allow us to move the ADC elements when ADC update mode is enabled.

It attempts to use the reference to the the name service provided as part of the call to the constructor.

Parameters:
Poa - A reference to a portable object adapter which is to be used by this class
Orb - A reference to an ORB which can be used by this class.
RootNamingServiceContext - This is a reference to the naming service which will be used to resolve the subactions which can be used to control the positions of the ADCs in the PFIP controller.
SyslogMessageHandler - This object will be used to send messages to the syslog
Method Detail

setADCUpdateMode

public void setADCUpdateMode(boolean EnableADCUpdate)
Allows the ADC positional updates to be enabled or disabled. When enabled, periodic updates of the ADC position will be performed depending upon the zenith angle of the telescope.

The current status of ADC updates will be written into the parameter noticeboard in the parameter named PFIP.CONTROLLER.ADCUPDATESTATUS.

Parameters:
EnableADCUpdate - This should be set to true to indicate that the ADC position should be updated periodically

getADCUpdateMode

public boolean getADCUpdateMode()
Returns the current status of ADC updates, whether they are enabled or not.

Returns:
boolean True indicates that ADC updates are being performed.

run

public void run()
This implements this classes contractual obligation to the TimerTask interface by implementing the run method. This will be called every 5 seconds and, if ADC updates are enabled, will result in the data associated with the TCS information being accessed and the ADC element positional settings being updated.

If the telescope is slewing rather than tracking, the ADC position will be set to the position that the telescope will be once the telescope has completed slewing, that is to say, it's new target position.

The method will further ensure that only significant changes in the position of the telescope will result in the an attempt to move the ADC mechanisms

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

calculateADCAngle

private double calculateADCAngle(double ZenithDistance)
Calculate the ADC element angle, given the telescope zenith distance. For derivation of the formula used here, and in particular the value for the constant K, see Appendix A of the PFIP Software Requirements Document, document WHT-PFIP-3.

The value returned is rounded to the nearest 0.1 degs to ensure that ADC movement is only requested when the required element angle change is measurable.

When the calculated element angle is illegal (this occurs at a ZD of about 73 degs or more ) then announce (once) that there is a problem and return an element angle of 90 deg.

Note that this method was completely cribbed from the original PFIP D-task code and converted to Java. There is a file which contains a list of zenith angles and expected ADC compensation values (taken from headers from the FITS files created using the VAX control system) in the project file PFIPController/docs/miscellaneous in the PFIPController CVS module so that it is possible to cross reference the values which are calculated by this method to be verified against.

Parameters:
ZenithDistance - This is the distance that the telescope is from the zenith expressed as radians
Returns:
double The angle that the ADC should be set to compensate for the angle of the telescope in degrees