org.opengts.db
Class EventDataAnalog

java.lang.Object
  extended by org.opengts.db.EventDataAnalog

public class EventDataAnalog
extends java.lang.Object

EventDataAnalog class


Field Summary
static CurveFit PROFILE_CYLINDER_CURVEFIT
           
static java.lang.String[] PROFILE_CYLINDER_NAME
           
static XYPair[] PROFILE_CYLINDER_XY
           
static CurveFit PROFILE_LINEAR_CURVEFIT
           
static java.lang.String[] PROFILE_LINEAR_NAME
           
static XYPair[] PROFILE_LINEAR_XY
           
static boolean USE_CURVEFIT
           
 
Constructor Summary
EventDataAnalog(int ndx, CurveFit cf)
          CurveFit Constructor
EventDataAnalog(int ndx, CurveFit cf, java.lang.String... fieldN)
          CurveFit Constructor
EventDataAnalog(int ndx, double gain, double offset)
          Gain/Offset Constructor
EventDataAnalog(int ndx, double gain, double offset, java.lang.String... fieldN)
          Gain/Offset Constructor
EventDataAnalog(int ndx, java.lang.String gof)
          String Constructor
EventDataAnalog(int ndx, java.lang.String gof, double dftGain, double dftOffset)
          String Constructor
EventDataAnalog(int ndx, XYPair[] api)
          XYPair Constructor
EventDataAnalog(int ndx, XYPair[] api, java.lang.String... fieldN)
          XYPair Constructor
 
Method Summary
 void addFieldNames(java.lang.String... fieldN)
          Sets the EventData field name
static double calculateAnalogValue(java.lang.String profStr, double inpVal)
          Gets the analog value based on the specified profile string
 double convert(double value)
          Converts the specified analog value to the proper sensor value
 double convert(long value)
          Converts the specified analog value to the proper sensor value
static boolean convertSaveEventDataAnalogFieldValue(EventData evdb, DCServerConfig dcsc, int aNdx1, java.util.Map<java.lang.String,EventDataAnalog> edaMap, double value)
          Get the EventDataAnalog instance for the specified DCServerConfig and Device.
 CurveFit getCurveFit()
          Gets the contained CurveFit instance (may be null)
 java.lang.String getDCSPropertyID()
          Gets the DCS Property ID (for informational/debug use only)
static EventDataAnalog getEventDataAnalog(Device device, DCServerConfig dcsc, int aNdx1, java.util.Map<java.lang.String,EventDataAnalog> edaMap)
          Get the EventDataAnalog instance for the specified DCServerConfig and Device
 java.lang.String[] getFieldNames()
          Gets an array of field names (returns an empty array if no fields are defined)
 double getGain()
          Gets the Gain
 int getIndex()
          Returns the Analog index (1-based)
 double getOffset()
          Gets the Offset
 double getScale()
          Gets the Scale
 java.lang.Object getValueObject(java.lang.String fieldN, double value)
          Converts/Gets the Object value for the specified field name.
 XYPair[] getXYPairProfile()
          Gets the contained XYPair profile array (may be null)
 boolean hasCurveFit()
          Returns true if this instance has a defined CurveFit
 boolean hasDCSPropertyID()
          Returns true if this instance has a defined DCS Property ID
 boolean hasFieldName(java.lang.String fieldN)
          Returns true this instance has the specified field name defined
 boolean hasScale()
          Returns true if Scale is defined
static java.util.Map<java.lang.String,EventDataAnalog> initEventDataAnalogMap(DCServerConfig dcsc, java.lang.String keyPfx, java.lang.Class<? extends EventDataAnalog> edaClass)
          Initializes the DCS EventDataAnalog map.
 boolean isValid()
          Returns true if this EventDataAnalog is valid
static boolean isValid(EventDataAnalog eda)
          Returns true if the specified EventDataAnalog is valid
static void main(java.lang.String[] argv)
           
static EventDataAnalog newEventDataAnalog(java.lang.Class<? extends EventDataAnalog> edaClass, int aNdx1, java.lang.String alogStr)
          Creates an instance of the EventDataAnalog subclass
static void printEventDataAnalog(java.util.Map<java.lang.String,EventDataAnalog> edaMap, int width)
          Prints the defined Analog headers
 boolean saveEventDataFieldValue(EventData evdb, double value)
          Sets the EventData field to the specified value for the specified EventData instance
 double scaleValue(double val)
          Scales the specified value
 void setDCSPropertyID(java.lang.String dcsPropID)
          Sets the DCS Property ID (for informational/debug use only)
 void setFieldNames(java.lang.String... fieldN)
          Sets the EventData field name
 void setGain(double gain)
          Sets the Gain
 void setOffset(double offset)
          Sets the Offset
 void setScale(double scale)
          Sets the Scale
 java.lang.String toString()
          Returns a String representation of this instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

USE_CURVEFIT

public static final boolean USE_CURVEFIT
See Also:
Constant Field Values

PROFILE_CYLINDER_NAME

public static final java.lang.String[] PROFILE_CYLINDER_NAME

PROFILE_CYLINDER_XY

public static final XYPair[] PROFILE_CYLINDER_XY

PROFILE_CYLINDER_CURVEFIT

public static final CurveFit PROFILE_CYLINDER_CURVEFIT

PROFILE_LINEAR_NAME

public static final java.lang.String[] PROFILE_LINEAR_NAME

PROFILE_LINEAR_XY

public static final XYPair[] PROFILE_LINEAR_XY

PROFILE_LINEAR_CURVEFIT

public static final CurveFit PROFILE_LINEAR_CURVEFIT
Constructor Detail

EventDataAnalog

public EventDataAnalog(int ndx,
                       double gain,
                       double offset)
Gain/Offset Constructor


EventDataAnalog

public EventDataAnalog(int ndx,
                       double gain,
                       double offset,
                       java.lang.String... fieldN)
Gain/Offset Constructor


EventDataAnalog

public EventDataAnalog(int ndx,
                       XYPair[] api)
XYPair Constructor


EventDataAnalog

public EventDataAnalog(int ndx,
                       XYPair[] api,
                       java.lang.String... fieldN)
XYPair Constructor


EventDataAnalog

public EventDataAnalog(int ndx,
                       CurveFit cf)
CurveFit Constructor


EventDataAnalog

public EventDataAnalog(int ndx,
                       CurveFit cf,
                       java.lang.String... fieldN)
CurveFit Constructor


EventDataAnalog

public EventDataAnalog(int ndx,
                       java.lang.String gof)
String Constructor


EventDataAnalog

public EventDataAnalog(int ndx,
                       java.lang.String gof,
                       double dftGain,
                       double dftOffset)
String Constructor

Method Detail

newEventDataAnalog

public static EventDataAnalog newEventDataAnalog(java.lang.Class<? extends EventDataAnalog> edaClass,
                                                 int aNdx1,
                                                 java.lang.String alogStr)
Creates an instance of the EventDataAnalog subclass

Parameters:
edaClass - The subclass of EventDataAnalog to instantiate (null for EventDataAnalog)
aNdx1 - The 1-based index of this specific Analog sensor
alogStr - The analog configuration profile

initEventDataAnalogMap

public static java.util.Map<java.lang.String,EventDataAnalog> initEventDataAnalogMap(DCServerConfig dcsc,
                                                                                     java.lang.String keyPfx,
                                                                                     java.lang.Class<? extends EventDataAnalog> edaClass)
Initializes the DCS EventDataAnalog map. Returns null if DCServerConfig not properly specified.


getEventDataAnalog

public static EventDataAnalog getEventDataAnalog(Device device,
                                                 DCServerConfig dcsc,
                                                 int aNdx1,
                                                 java.util.Map<java.lang.String,EventDataAnalog> edaMap)
Get the EventDataAnalog instance for the specified DCServerConfig and Device

Parameters:
device - The Device instance
dcsc - The DCServerConfig instance
aNdx1 - The 1-based analog index
edaMap - The map of EventDataAnalog instances

convertSaveEventDataAnalogFieldValue

public static boolean convertSaveEventDataAnalogFieldValue(EventData evdb,
                                                           DCServerConfig dcsc,
                                                           int aNdx1,
                                                           java.util.Map<java.lang.String,EventDataAnalog> edaMap,
                                                           double value)
Get the EventDataAnalog instance for the specified DCServerConfig and Device.

Parameters:
evdb - The EventData instance (ignored if this value is null)
dcsc - The DCServerConfig instance
aNdx1 - The 1-based analog index (ignored if this value is invalid)
edaMap - The map of EventDataAnalog instances (ignored if this value is null)
value - The value to set (ignored if this value is NaN)
Returns:
True if the EventData field value was set, false otherwise.

printEventDataAnalog

public static void printEventDataAnalog(java.util.Map<java.lang.String,EventDataAnalog> edaMap,
                                        int width)
Prints the defined Analog headers


calculateAnalogValue

public static double calculateAnalogValue(java.lang.String profStr,
                                          double inpVal)
Gets the analog value based on the specified profile string


setDCSPropertyID

public void setDCSPropertyID(java.lang.String dcsPropID)
Sets the DCS Property ID (for informational/debug use only)


getDCSPropertyID

public java.lang.String getDCSPropertyID()
Gets the DCS Property ID (for informational/debug use only)


hasDCSPropertyID

public boolean hasDCSPropertyID()
Returns true if this instance has a defined DCS Property ID


getIndex

public int getIndex()
Returns the Analog index (1-based)


isValid

public boolean isValid()
Returns true if this EventDataAnalog is valid


isValid

public static boolean isValid(EventDataAnalog eda)
Returns true if the specified EventDataAnalog is valid


getXYPairProfile

public XYPair[] getXYPairProfile()
Gets the contained XYPair profile array (may be null)


hasCurveFit

public boolean hasCurveFit()
Returns true if this instance has a defined CurveFit


getCurveFit

public CurveFit getCurveFit()
Gets the contained CurveFit instance (may be null)


setScale

public void setScale(double scale)
Sets the Scale


getScale

public double getScale()
Gets the Scale


hasScale

public boolean hasScale()
Returns true if Scale is defined


scaleValue

public double scaleValue(double val)
Scales the specified value


setGain

public void setGain(double gain)
Sets the Gain


getGain

public double getGain()
Gets the Gain


setOffset

public void setOffset(double offset)
Sets the Offset


getOffset

public double getOffset()
Gets the Offset


convert

public double convert(long value)
Converts the specified analog value to the proper sensor value


convert

public double convert(double value)
Converts the specified analog value to the proper sensor value


setFieldNames

public void setFieldNames(java.lang.String... fieldN)
Sets the EventData field name


addFieldNames

public void addFieldNames(java.lang.String... fieldN)
Sets the EventData field name


getFieldNames

public java.lang.String[] getFieldNames()
Gets an array of field names (returns an empty array if no fields are defined)


hasFieldName

public boolean hasFieldName(java.lang.String fieldN)
Returns true this instance has the specified field name defined


getValueObject

public java.lang.Object getValueObject(java.lang.String fieldN,
                                       double value)
Converts/Gets the Object value for the specified field name. Returns null if the specified field name is not defined for the EvewntDataAnalog instance.


saveEventDataFieldValue

public boolean saveEventDataFieldValue(EventData evdb,
                                       double value)
Sets the EventData field to the specified value for the specified EventData instance


toString

public java.lang.String toString()
Returns a String representation of this instance

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] argv)