Class Signal

java.lang.Object
xal.smf.scada.ScadaRecord
xal.smf.impl.profile.Signal
All Implemented Interfaces:
Cloneable, DataListener

public class Signal extends ScadaRecord

Data structure for storing all the properties of a beam profile signal. This includes the signal values, the location of the value within the beam pipe, and the number of samples. Noise characteristics may also be present.

This structure is equipped for direct acquisition of WireHarp device profile data measurements. The data structure is derived from the ScadaStruct base class in order to use that data I/O mechanism already in place.

This type is intended to serve as attributes for a larger data structure containing the beam profiles in multiple transverse planes. That aggregating structure is expected to set up the necessary connections for data acquisition use by the base class ScadaRecord, namely by instantiating instances with the constructor Signal(List) (protected access). It is still possible to use a Signal object directly by annotating it with the AScada.Record annotation.

Ported from XAL on Jul 15, 2014.
· Jonathan M. Freed

Since:
Jan 30, 2013
Author:
Christopher K. Allen
  • Constructor Details

    • Signal

      public Signal() throws BadStructException
      Creates a new, uninitialized instance of Signal which is not connected to any XAL channels.
      Throws:
      BadStructException - no SCADA fields (@AScada.Field) were found in data structure
      Since:
      Feb 7, 2013
    • Signal

      protected Signal(List<ScadaFieldDescriptor> lstFldDscr) throws BadStructException
      Creates a new instance of Signal and initializes the SCADA operations with the given field descriptors.
      Parameters:
      lstFldDscr - array of field descriptors used for communication with hardware
      Throws:
      BadStructException - no SCADA fields were found in argument
      Since:
      Feb 1, 2013
  • Method Details

    • createBlankSignal

      public static Signal createBlankSignal()
      Creates and returns a new Signal object containing no data and incapable of any data acquisition. This type of object is primarily used for data processing.
      Returns:
      an empty, unattached signal object
      Since:
      Apr 19, 2012
    • createConnectedSignal

      public static Signal createConnectedSignal(ASignal annSig) throws BadStructException, ScadaAnnotationException

      Creates a new instance of the Signal class which is connected to a given device whose signal fields are described in the given annotation. When created here, the Signal object becomes a fully functional ScadaRecord and can automatically acquire data from the connected device.

      NOTES:

      · The returned Signal object may not have all fields connected. Only those fields for which the given annotation has non-empty values will be connected. This could cause complications for signals requiring such fields and should be checked.

      Parameters:
      annSig - annotation class containing the meta-data describing the signal connections
      Returns:
      operational ScadaRecord class capable of data acquisition
      Throws:
      ScadaAnnotationException - field in the annotation is not accessible, does not exist, or enumeration Signal.FIELD is corrupt
      BadStructException - a required field of the given annotation is empty
      Since:
      Feb 7, 2013
    • getCnt

      public int getCnt()
    • setCnt

      public void setCnt(int cnt)
    • getPos

      public double[] getPos()
    • setPos

      public void setPos(double[] pos)
    • getVal

      public double[] getVal()
    • setVal

      public void setVal(double[] val)
    • average

      public void average(Signal sigAcq, double dblWtFac) throws IllegalArgumentException

      Performs an averaging operation with the given Signal object using the given averaging factor. The quantities within this data structure are averaged in place with that of the given signal structure. Letting λ denote the provided averaging factor, which is in the interval [0,1], the new values of this signal, say v' are given by the formula

          v' = λu + (1 - λ)v

      where v is the previous value of v' and u is the new value of v in sigAcq.

      NOTES:

      · Nothing is done to the position values in the signal, they are unchanged of current writing.
      · The standard deviation is weighted vectorally.

      Parameters:
      sigAcq - signal u to average into this one v
      dblWtFac - weighting factor λ ∈ [0,1] for argument u
      Throws:
      IllegalArgumentException - the provided signal is not the same size as this signal
      Since:
      May 1, 2014
    • dataLabel

      public String dataLabel()
      Returns a (unique) string identifier that identifies the persistent data format that belongs to this Signal class.
      Returns:
      a tag that identifies the receiver's type
      Since:
      Jan 30, 2013
      See Also:
    • update

      public void update(DataAdaptor daptSrc) throws MissingResourceException, BadStructException
      Description copied from class: ScadaRecord
      Read in the values of the data structure fields from the data source behind the data adaptor interface. The attributes of the data source are the field names, the values are taken from there.
      Specified by:
      update in interface DataListener
      Overrides:
      update in class ScadaRecord
      Parameters:
      daptSrc - The adaptor from which to update the data
      Throws:
      MissingResourceException - a data field was missing from the data source
      BadStructException - data structure fields are ill-defined/incompatible
      Since:
      Oct 14, 2014
      See Also:
    • toString

      public String toString()
      Write out the contents of this signal.
      Overrides:
      toString in class ScadaRecord
      Returns:
      a representation of the signal as a string of (pos,val) pairs
      Since:
      Mar 12, 2010
      See Also:
    • clone

      public Object clone() throws CloneNotSupportedException
      Creates a deep copy of this object. All arrays and field descriptors are duplicated.
      Overrides:
      clone in class ScadaRecord
      Throws:
      CloneNotSupportedException
      Since:
      Apr 19, 2012
      See Also: