Package xal.smf.impl

Class WireScanner

All Implemented Interfaces:
Comparable, ElementType, DataListener

public class WireScanner extends ProfileDevice

Wire Scanner Hardware

Represents a wire scanner diagnostic device, in particular those devices installed at the SNS facility. This class implements the new profile device API at SNS. The previous device API interfaced with the SMF class ProfileMonitor.

NOTES:

· After a command is issued to a wire scanner device the command buffer must be cleared back to zero. This is due to a "quirk" in the current EPICS installation where command signal echos occur in the network. To prevent the command from being issued multiple times it is necessary to clear the command buffer after issuing a command.
· The time between the issuing of a command and the clearing of the command buffer is call the command latency.
· Currently the command buffer is not reset - the new controller software appears to correct the EPICS quirk.
· This is a refactoring of the original WireScanner class that generalizes to the WireHarp

Ported from XAL on Jul 21, 2014. (Over-wrote old WireScanner implementation.)
· Jonathan M. Freed

Since:
Mar 26, 2009 Version 1.0
Version:
Mar, 2010 Version 2.1, Oct, 2011 Version 2.2, Feb, 2013 Version 3.0, Mar, 2014 Version 3.1
Author:
Tom Pelaia, Christopher K. Allen
See Also:
  • Field Details

  • Constructor Details

    • WireScanner

      public WireScanner(String nodeID, ChannelFactory channelFactory)
      Primary Constructor.
      Parameters:
      nodeID - unique identifier for this node
      channelFactory - factory for generating channels for this node
    • WireScanner

      public WireScanner(String nodeID)
      Create a new WireScanner object.
      Parameters:
      nodeID -
      Since:
      Jun 18, 2009
  • Method Details

    • getType

      public String getType()
      Get the device type
      Specified by:
      getType in class AcceleratorNode
      Returns:
      The type identifier of this class
    • getSoftType

      public String getSoftType()
      Derived class may furnish a unique software type
      Overrides:
      getSoftType in class AcceleratorNode
      Returns:
      the "software type" or the driver version for the hardware.
    • runCommand

      Issue a wire scanner command with no arguments.
      Parameters:
      cmd - wire scanner command
      Throws:
      ConnectionException - unable to find channel
      PutException - unable to set channel value
      InterruptedException - command buffer reset thread interrupted
    • runCommand

      Issue a wire scanner command with or without arguments arguments. The command and argument list is packed in the argument of type WireScanner2.CmdPck Here we are packing the command-argument vector as an array of type double.
      Parameters:
      cmdPck - packaged wire scanner command with optional arguments
      Throws:
      IllegalArgumentException - argument/command inconsistency
      ConnectionException - unable to find channel
      PutException - unable to set channel value
      InterruptedException - command buffer reset thread interrupted
    • getCommandResult

      public int[] getCommandResult() throws GetException
      Returns the command result code(s). These are integer valued codes for the result of a previous issued device command. See the wire scanner documentation to interpret the particular resultant code.
      Returns:
      command result array of integer codes for a command result.
      Throws:
      ConnectionException - Unable to connect to result readback channel
      GetException - Unable to read result from readback channel
    • testConnection

      public boolean testConnection(Collection<ScadaFieldDescriptor> setFds, double dblTmOut) throws BadChannelException
      Test the connections in all the channels of the given parameter set for this accelerator device. The test will wait up to the given length of time before declaring failure.
      Overrides:
      testConnection in class ProfileDevice
      Parameters:
      setFds - set of field descriptors containing channel handles
      dblTmOut - time out before test fails (in seconds)
      Returns:
      true if all connections were successful, false if not all connection were made within given time
      Throws:
      BadChannelException - An unbound channel handle within a field descriptor
      Since:
      Feb 4, 2011
    • createMonitor

      public Monitor createMonitor(XalPvDescriptor.IPvDescriptor pvdFld, IEventSinkValue snkEvents, int... mskEvtType) throws ConnectionException, MonitorException, NoSuchChannelException

      Setup a value monitor on the given process variable (i.e., using its handle). The monitor events are sent to the IEventSink object provided.

      One can specify the event type which fires the monitor using the argument intEvtType. Any combination of the following event types can be specified with a logical OR operation:

        Monitor.VALUE - fire upon PV value change
        Monitor.LOG -
        Monitor.ALARM - fire upon PV alarm value
      The default value (i.e., no argument) is Monitor.VALUE.

      Overrides:
      createMonitor in class ProfileDevice
      Parameters:
      pvdFld - handle enumeration for process variable
      snkEvents - interface to data sink
      mskEvtType - code specifying when the monitor is fired (or'ed combination of {Monitor.VALUE, Monitor.LOG, Monitor.ALARM})
      Returns:
      A new monitor on the given process variable
      Throws:
      NoSuchChannelException - if the handle does not identify any process variable of this accelerator node
      ConnectionException - channel is not connected
      MonitorException - general monitor failure
    • configureHardware

      public void configureHardware(ParameterSet datPvFlds) throws PutException, ConnectionException
      Set all the hardware parameter values associated with the given data set.
      Overrides:
      configureHardware in class ProfileDevice
      Parameters:
      datPvFlds - set of new hardware values
      Throws:
      ConnectionException - unable to connect PV channel
      PutException - general exception setting values
      Since:
      Dec 17, 2009
    • analysisParametersSelect

      public void analysisParametersSelect(ProfileDevice.MACROPULSE enmBmSct, double dblBmFrac) throws ConnectionException, NoSuchChannelException, GetException, PutException, RejectedExecutionException
      Changes the data processing parameters (see WireScanner.PrcgConfig) so that the on-board controller selects the beam micro-bunch section for computing measurement results.
      Parameters:
      enmBmSct - the part of the beam on which to focus the analysis
      dblBmFrac - proportion of the current beam to be used in analysis (a value 1 is the entire macro-pulse)
      Throws:
      RejectedExecutionException - (runtime exception) the machine is not in 50 μsec mode, parameter will not be changed
      NoSuchChannelException - error in XAL channel handle/EPICS PV binding
      ConnectionException - could not connect to data processing PVs
      GetException - could not retrieve some data processing parameters
      PutException - unable to set the new analysis configuration parameters
      Since:
      Nov 3, 2011