Class BPMonitor

All Implemented Interfaces:
Cloneable, ISimpleElement, AbstractUpdateableElement, IBindedElement<Double[]>

public class BPMonitor extends AbstractOpticalElement implements IBindedElement<Double[]>, AbstractUpdateableElement
This class represent beam position monitor. It hold position of electron beam. It connects to BeamPositionMonitor and reads beam displacment
Author:
igor@scictrl.com
  • Field Details

    • HOR_POSITION

      public static final String HOR_POSITION
      Constant HOR_POSITION="horPosition"
      See Also:
    • VER_POSITION

      public static final String VER_POSITION
      Constant VER_POSITION="verPosition"
      See Also:
    • dataInvalidated

      protected boolean dataInvalidated
      Data is invalidated.
  • Constructor Details

    • BPMonitor

      public BPMonitor(String name)
      Constructs a BPMonitor with specified name and default parameters vaues
      Parameters:
      name - a String object
    • BPMonitor

      public BPMonitor(String name, boolean virtual, double position, double relpos, String relFrom)
      Constructs the BPMonitor with specified parameters.
      Parameters:
      name - a String object
      virtual - a boolean
      position - a double
      relpos - a double
      relFrom - a String object
  • Method Details

    • notifyDataUpdate

      public void notifyDataUpdate(Double[] data)
      Called by data connection when new value update arrives
      Specified by:
      notifyDataUpdate in interface IBindedElement<Double[]>
      Parameters:
      data - new data, if value is OK, null if last arrive value signals problems and can not be thrusted
    • clone

      public Object clone()
      Returns the clone of this element. Returns not initialized clone of this element. All data is copied to the clone. Returns not initialized clone of this element. All data is copied to the clone.

      clone.

      Specified by:
      clone in interface ISimpleElement
      Overrides:
      clone in class AbstractOpticalElement
      Returns:
      a Object the clone of this element.
      See Also:
    • connect

      public int connect() throws IllegalStateException, DataBushPackedException
      Binds to remote object. Returns the code indication success of bind. Connects element to InfoServerBean device. Returns the success code of operation.
      Specified by:
      connect in interface IBindedElement<Double[]>
      Returns:
      the code indication success of bind.
      Throws:
      DataBushPackedException - if bind exception occurs.
      IllegalStateException
      See Also:
    • descriptor

      public DBElementDescriptor descriptor()
      Returns the descriptor object for this element. DBElementDescriptor helps manipulating DataBush elements dynamically.

      descriptor.

      Specified by:
      descriptor in class AbstractDataBushElement
      Returns:
      the descriptor object for this element.
      See Also:
    • disconnect

      public int disconnect() throws IllegalStateException
      Destroys connection. Returns the code indication success of destroy. Disconnects element from InfoServerBean device. Returns the success code of operation.
      Specified by:
      disconnect in interface IBindedElement<Double[]>
      Returns:
      the code indication success of destroy.
      Throws:
      IllegalStateException
      See Also:
    • elType

      public int elType()
      Returns the code of element's type. Returns the code of element's type.
      Specified by:
      elType in class AbstractDataBushElement
      Returns:
      the code of element's type.
      See Also:
    • getBeamPos

      public PositionedData getBeamPos()
      This method return the position of the electron beam, that was measured before last update() call.
      Returns:
      PositionedData
    • invalidateData

      public void invalidateData()
      Sets DataInvalidated flag to true. This method invalidate data which means that at least one data in this object is not consistent with other object's data. It is necessary to update this object or apply (if possible).
      Specified by:
      invalidateData in interface AbstractUpdateableElement
      See Also:
    • isConnected

      public boolean isConnected()
      Returns true if element is binded, false otherwise. This method tests if BPMonitor is connected.
      Specified by:
      isConnected in interface IBindedElement<Double[]>
      Returns:
      true if element is binded, false otherwise.
      See Also:
    • isDataInvalidated

      public boolean isDataInvalidated()
      Returns true if element's data is not synchronized with associated element or Abean. This fag goes to false after update or apply. This method tests if data is invalidated.
      Specified by:
      isDataInvalidated in interface AbstractUpdateableElement
      Returns:
      true if element's data is not synchronized with associated element or Abean.
      See Also:
    • setBeamPosTo

      public void setBeamPosTo(double x, double z) throws IllegalStateException
      This method sets value, that holds beam position to specified value.
      Parameters:
      x - double position in x direction
      z - double position in z direction
      Throws:
      IllegalStateException - if any.
    • toString

      public String toString()
      Returns the string representation of this element. Returns string describing this element. String is formated in input-file code. Returns a String that represents the value of this object. Returns a String that represents the value of this object.
      Specified by:
      toString in interface ISimpleElement
      Overrides:
      toString in class AbstractOpticalElement
    • update

      public int update() throws IllegalStateException, DataBushPackedException
      Reads value from associated element or Abean and calculates it's new values. Metod reads data from other databush elements or from remote devices represented with Abean. Metod also checks isDataInvalidated() on depending databush elements, if value has changed. Return value is identification code of error. Note! Update is performed only if virtual flag is set to false. Note! All update methods are synchronized, so only one update is called at time. For update od group of elements call update on appropriate element-list or DataBush. This method reads electron beam position from BeamPositionMonitorBean and save it to private field of this class
      Specified by:
      update in interface AbstractUpdateableElement
      Returns:
      a int the return code indicating success
      Throws:
      IllegalStateException - thrown if status of DataBush equals DB_EMPTY
      DataBushPackedException - contains all exception thrown or caught during updating element
    • test

      public boolean test()
      This method tests if BPM is usable.
      Returns:
      true if it is.
    • isUseable

      public boolean isUseable()

      isUseable.

      Returns:
      a boolean