FourMS
Class FourMSConversions

java.lang.Object
  extended by FourMS.FourMSConversions

public class FourMSConversions
extends java.lang.Object

This class will be used to hold the standard conversion methods which will be used to convert parameters coming to and from the 4MS microprocessor. This class may be subclassed by instrument specific conversion classes to give a full complement of conversion routines specific to a given instrument. This class provides the base conversions for all 4MS systems.

Probably one of the more prominent conversion routines contained within is a method which can convert filter names for a given mechanism to and from engineering units when provided with the logical name of the filter. In order to do this, it interacts with the filter management database which is hosted upon the whtics computer. See http://whtics.roque.ing.iac.es for more information on the filter database.

Version:
$Id: FourMSConversions.java,v 1.17 2006/04/16 16:02:48 cb Exp $
Author:
Craige Bevil

Field Summary
protected  java.sql.Connection DBConnection
          This is the connection to the database which will be used for reading back filter data.
 int DemandFilterPositionToActualPositionOffset
          This is the offset to be applied to filter positions as the come to and from the micro.
 int DemandSelectablePositionToActualPositionOffset
          This is the offset to be applied to selectable mechanism positions as the come to and from the micro.
 java.util.Hashtable<java.lang.String,java.lang.Integer> EngineeringToFilterNominalPositionOffsets
          This is a hash table which contains the offsets engineering values for filter positions to the nominal starting position of 1 in the filter management system.
protected  java.lang.String InstrumentName
          This is the name of the instrument which the conversions are associated with
protected  org.omg.CORBA.ORB Orb
          This is a reference to the CORBA ORB which we we will use
protected  iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
          This is reference to the remote proxy CORBA object which will be used to access the parameter noticeboard.
protected  MessageHandler SyslogMessageHandler
          This is a syslog object which will be used to report errors etc
 
Constructor Summary
FourMSConversions()
          This is the constructor for this class
 
Method Summary
 java.lang.String convertBeamPosition(java.lang.Integer ConversionType, java.lang.String MechanismName, java.lang.Integer MessageCode, java.lang.String InputParameter)
          This will convert a binary value which indicates that something is either in the beam or out of the beam.
 java.lang.String convertDoorPosition(java.lang.Integer ConversionType, java.lang.String MechanismName, java.lang.Integer MessageCode, java.lang.String InputParameter)
          This will convert a binary value which indicates that a mechanism is either open or closed according to the logic in the following table.
 java.lang.String doubleConversion(java.lang.Integer ConversionType, java.lang.String MechanismName, java.lang.Integer MessageCode, java.lang.String InputParameter)
          This method converts between string and double format.
 java.lang.String filterConversion(java.lang.Integer ConversionType, java.lang.String MechanismName, java.lang.Integer MessageCode, java.lang.String InputParameter)
          This operation can be used to convert a filter position to an actual filter name It is intended that this operation will only be called from a class which is subclassing it as it needs additional information in order to perform the conversion such as the filter name, mechanism and instrument.
 java.lang.String hexConversion(java.lang.Integer ConversionType, java.lang.String MechanismName, java.lang.Integer MessageCode, java.lang.String InputParameter)
          This conversion method is expected to convert an integer to a hex number to send out to the 4MS and vice-versa depending on the direction of the conversion to be applied.
 java.lang.String integerConversion(java.lang.Integer ConversionType, java.lang.String MechanismName, java.lang.Integer MessageCode, java.lang.String InputParameter)
          The purpose of this method is to convert a string type into an integer
 java.lang.String nullConversion(java.lang.Integer ConversionType, java.lang.String MechanismName, java.lang.Integer MessageCode, java.lang.String InputParameter)
          This conversion method is null conversion, the input is passed as the output.
 java.lang.String selectableMechanismConversion(java.lang.Integer ConversionType, java.lang.String MechanismName, java.lang.Integer MessageCode, java.lang.String InputParameter)
          This operation can be used to convert a position in a selectable mechanism such as a dekker tray for example to and from it's engineering value to it's logical value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EngineeringToFilterNominalPositionOffsets

public java.util.Hashtable<java.lang.String,java.lang.Integer> EngineeringToFilterNominalPositionOffsets
This is a hash table which contains the offsets engineering values for filter positions to the nominal starting position of 1 in the filter management system. Sometimes in a system, not all of the filters have their engineering values starting at the same value so therefore we need to be able to more flexible. This was introduced due to complications arising with the implementation of the WYFFOS controller.


DemandFilterPositionToActualPositionOffset

public int DemandFilterPositionToActualPositionOffset
This is the offset to be applied to filter positions as the come to and from the micro. By default we set this to zero which assumes that a demand position for position one equates to a demand position for position one in on the micro filter wheel. This is indeed the case with the PFIP system. However, in the case of the CAGB system, the demand positions coming from the high level are from one onwards but the filter positions in the micro start from position 0. In order to be consistent at the high level, each instrument control system can set this variable which will result in the actual position being sent to and from the micro being incremented and decremented by this value.

This value will be overrode if the EngineeringToFilterNominalPositionOffsets hash is specified.


DemandSelectablePositionToActualPositionOffset

public int DemandSelectablePositionToActualPositionOffset
This is the offset to be applied to selectable mechanism positions as the come to and from the micro. By default we set this to zero which assumes that a demand position for position one equates to a demand position for position one in on the micro filter wheel. In the case of the PFIP filter mechanisms, this is indeed the case. However, in the case of the CAGB system, the demand positions coming from the high level are from one onwards but the filter positions in the micro start from position 0. In order to be consistent at the high level, each instrument control system can set this variable which will result in the actual position being sent to and from the micro being incremented and decremented by this value.


Orb

protected org.omg.CORBA.ORB Orb
This is a reference to the CORBA ORB which we we will use


ParameterNoticeBoard

protected iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
This is reference to the remote proxy CORBA object which will be used to access the parameter noticeboard. This will used when converting filter values from engineering values into logical values and will be used to put the values of the filter system and the passband into the noticeboard.


InstrumentName

protected java.lang.String InstrumentName
This is the name of the instrument which the conversions are associated with


SyslogMessageHandler

protected MessageHandler SyslogMessageHandler
This is a syslog object which will be used to report errors etc


DBConnection

protected java.sql.Connection DBConnection
This is the connection to the database which will be used for reading back filter data.

Constructor Detail

FourMSConversions

public FourMSConversions()
This is the constructor for this class

Method Detail

doubleConversion

public java.lang.String doubleConversion(java.lang.Integer ConversionType,
                                         java.lang.String MechanismName,
                                         java.lang.Integer MessageCode,
                                         java.lang.String InputParameter)
                                  throws ConversionFailedException
This method converts between string and double format. It ensure that the parameter going to the 4MS and coming back from it is in double format.

Parameters:
ConversionType - - This is the direction of the conversion to be performed, this should be either FourMSConstants.LOGICALTOENGINEERING or FourMSConstants.ENGINEERINGTOLOGICAL
MechanismName - This is the name of the mechanism which the conversion is associated with
MessageCode - This is the message type of the message e.g. 800
InputParameter - This is the parameter to be converted
Returns:
String
Throws:
ConversionFailedException

nullConversion

public java.lang.String nullConversion(java.lang.Integer ConversionType,
                                       java.lang.String MechanismName,
                                       java.lang.Integer MessageCode,
                                       java.lang.String InputParameter)
                                throws ConversionFailedException
This conversion method is null conversion, the input is passed as the output. The purpose is to ensure that we can test the system

Parameters:
ConversionType - - This is the direction of the conversion to be performed, this should be either FourMSConstants.LOGICALTOENGINEERING or FourMSConstants.ENGINEERINGTOLOGICAL
InputParameter -
Returns:
String
Throws:
ConversionFailedException

hexConversion

public java.lang.String hexConversion(java.lang.Integer ConversionType,
                                      java.lang.String MechanismName,
                                      java.lang.Integer MessageCode,
                                      java.lang.String InputParameter)
                               throws ConversionFailedException
This conversion method is expected to convert an integer to a hex number to send out to the 4MS and vice-versa depending on the direction of the conversion to be applied.

Parameters:
ConversionType - - This is the direction of the conversion to be performed, this should be either FourMSConstants.LOGICALTOENGINEERING or FourMSConstants.ENGINEERINGTOLOGICAL
InputParameter -
Returns:
String
Throws:
ConversionFailedException

integerConversion

public java.lang.String integerConversion(java.lang.Integer ConversionType,
                                          java.lang.String MechanismName,
                                          java.lang.Integer MessageCode,
                                          java.lang.String InputParameter)
                                   throws ConversionFailedException
The purpose of this method is to convert a string type into an integer

Parameters:
ConversionType - - This is the direction of the conversion to be performed, this should be either FourMSConstants.LOGICALTOENGINEERING or FourMSConstants.ENGINEERINGTOLOGICAL
MechanismName - This is the name of the mechanism which the conversion is associated with
MessageCode - This is the message type of the message e.g. 800
InputParameter - - This is the parameter to be converted from a string to an integer. This could be the position number in the filter ring or the name of a filter for which we have to establish the filter number.
Returns:
String
Throws:
ConversionFailedException

convertBeamPosition

public java.lang.String convertBeamPosition(java.lang.Integer ConversionType,
                                            java.lang.String MechanismName,
                                            java.lang.Integer MessageCode,
                                            java.lang.String InputParameter)
                                     throws ConversionFailedException
This will convert a binary value which indicates that something is either in the beam or out of the beam.

Engineering Value Logical Value Semantics
0 OUT Out of the light beam
1 IN In the light beam

Parameters:
ConversionType - - This is the direction of the conversion to be performed, this should be either FourMSConstants.LOGICALTOENGINEERING or FourMSConstants.ENGINEERINGTOLOGICAL
MechanismName - This is the name of the mechanism which the conversion is associated with. This might be for instance MFW
MessageCode - This is the message type of the message e.g. 800
InputParameter - This is the value which is to be converted.
Returns:
String
Throws:
ConversionFailedException

convertDoorPosition

public java.lang.String convertDoorPosition(java.lang.Integer ConversionType,
                                            java.lang.String MechanismName,
                                            java.lang.Integer MessageCode,
                                            java.lang.String InputParameter)
                                     throws ConversionFailedException
This will convert a binary value which indicates that a mechanism is either open or closed according to the logic in the following table.

Engineering Value Logical Value Semantics
0 OPEN The mechanism is open
1 CLOSE The mechanism is closed

Parameters:
ConversionType - - This is the direction of the conversion to be performed, this should be either FourMSConstants.LOGICALTOENGINEERING or FourMSConstants.ENGINEERINGTOLOGICAL
MechanismName - This is the name of the mechanism which the conversion is associated with. This might be for instance MFW
MessageCode - This is the message type of the message e.g. 800
InputParameter - This is the value which is to be converted.
Returns:
String
Throws:
ConversionFailedException

filterConversion

public java.lang.String filterConversion(java.lang.Integer ConversionType,
                                         java.lang.String MechanismName,
                                         java.lang.Integer MessageCode,
                                         java.lang.String InputParameter)
                                  throws ConversionFailedException
This operation can be used to convert a filter position to an actual filter name It is intended that this operation will only be called from a class which is subclassing it as it needs additional information in order to perform the conversion such as the filter name, mechanism and instrument.

Parameters:
ConversionType - - This is the direction of the conversion to be performed, this should be either FourMSConstants.LOGICALTOENGINEERING or FourMSConstants.ENGINEERINGTOLOGICAL
MechanismName - This is the name of the mechanism which the conversion is associated with. This might be for instance MFW
MessageCode - This is the message type of the message e.g. 800
InputParameter - This is either the filter position or the filter name to be converted
Returns:
String
Throws:
ConversionFailedException
ConversionFailedException

selectableMechanismConversion

public java.lang.String selectableMechanismConversion(java.lang.Integer ConversionType,
                                                      java.lang.String MechanismName,
                                                      java.lang.Integer MessageCode,
                                                      java.lang.String InputParameter)
                                               throws ConversionFailedException
This operation can be used to convert a position in a selectable mechanism such as a dekker tray for example to and from it's engineering value to it's logical value.

In order for the method to work, it is reliant on the selectablemechanism table in the ICS database in order to establish both the engineering and the logical values. This table is indexed using the MechanismName in order to establish names and the positions of all of the selectable options associated with that mechanism name.

Parameters:
ConversionType - - This is the direction of the conversion to be performed, this should be either FourMSConstants.LOGICALTOENGINEERING or FourMSConstants.ENGINEERINGTOLOGICAL
MechanismName - This is the name of the mechanism which the conversion is associated with. This might be for instance MFW
MessageCode - This is the message type of the message e.g. 800
InputParameter - This is either the filter position or the filter name to be converted
Returns:
String
Throws:
ConversionFailedException
ConversionFailedException