Class DataBushInfo

java.lang.Object
org.scictrl.mp.orbitcorrect.model.optics.AbstractDataBushElement
org.scictrl.mp.orbitcorrect.model.optics.DataBushInfo
All Implemented Interfaces:
Cloneable, ISimpleElement, AbstractUpdateableElement, IBindedElement<Double>

public class DataBushInfo extends AbstractDataBushElement implements IBindedElement<Double>, AbstractUpdateableElement
This class presents basic optic configuration parameters and wraps si.ijs.anka.abeans.devices.InfoServerBean. Class implements following interfaces:
  • IBindedElement - used for manipulating connection to InfoServerBean.
  • AbstractUpdateableElement - used for retrieving and processing data from InfoServerBean.
Depending on virtual flag, DataBushInof behaves differently. If virtual flag is
  • true - DataBushInfo does not connect to InfoServerBean. depending on readEnergyFromBendings flag, there are two possibilities. If readEnergyFromBendings flag is true - behaves similar as if was not virtual. On update calls (manual or automatic) energy is read from all bending and average number is set to this element.
  • false - DataBushInfo's energy is read/write property. It always returns the set value.
  • false - connect to InfoServerBean is enabled. Returned energy is value from last update.
Author:
igor@scictrl.com
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Constant ENERGY="Energy"
    static final int
    Index of element's aplha in x direction in array of constructor's parameters.
    static final int
    Index of element's aplha in z direction in array of constructor's parameters.
    static final int
    Index of element's beta in x direction in array of constructor's parameters.
    static final int
    Index of element's beta in z direction in array of constructor's parameters.
    static final int
    Index of element's dispersion prime in array of constructor's parameters.
    static final int
    Index of element's dispersion in array of constructor's parameters.
    static final int
    Index of element's energy value in array of constructor's parameters.
    static final int
    Index of element's closed orbit flag in array of constructor's parameters.
    static final int
    Index of element's phase shift in x direction in array of constructor's parameters.
    static final int
    Index of element's phase shift in z direction in array of constructor's parameters.
    static final int
    Index of element's read from bendings flag in array of constructor's parameters.

    Fields inherited from class org.scictrl.mp.orbitcorrect.model.optics.AbstractDataBushElement

    lastActionResult, owner, PR_ELEMENT_NAME, PR_VIRTUAL
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs DataBush element with specified name and default parameter's values.
    DataBushInfo(String name, boolean virtual, double energy, boolean fromBend, boolean orbitClosed, double betaX, double betaZ, double alphaX, double alphaZ, double qX, double qZ, double disp, double ddisp)
    Constructs DataBush element with specified parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the clone of this element.
    int
    Binds to remote object.
    Returns the descriptor object for this element.
    int
    Destroys connection.
    int
    Returns the code of element's type.
    Returns closed orbit solution for alpha-function.
    Returns closed orbit solution for beta-function.
    This method returns energy server, which is object that gets necessary data and calculate energy.
    Returns closed orbit solution for horizontal momentum dispersion function.
    double
    Returns the energy value for this element.
    This method return transfer matrix of the system.
    long
    Delay between two updating cannot be below one limits, which can be specified.
    This method return beam normalised phase
    boolean
    If DataBushInfo is virtual, then, for simulation manners only, energy is read from bendings.
    void
    Sets DataInvalidated flag to true.
    boolean
    Returns true if element is binded, false otherwise.
    boolean
    Returns true if element's data is not synchronized with associated element or Abean.
    boolean
    Gets flag that orbit closes on itself after one revolution.
    boolean
    isReadEnergyFromBendings.
    void
    Called by data connection when new value update arrives
    void
    setAlpha(double alphaX, double alphaZ)
    This method sets beam alpha function.
    void
    setBeta(double betaX, double betaZ)
    This method sets beam beta function.
    void
    setDispersion(double d, double dp)
    This method sets beam dispersion function.
    void
    setEnergy(double value)
    Sets energy to DataBushInfo element and distribute energy to magnets.
    void
    Reads energy from bendings and sets the energy to DataBushInfo and distributes to DataBush magnets.
    void
    setMinUpdateInterval(long newValue)
    This method sets minimal update interval.
    void
    setOrbitClosed(boolean newOrbitClosed)
    Sets flag that orbit closes on itself after one revolution.
    void
    setQ(double qX, double qZ)
    This method sets beam normalized phaze.
    void
    setReadEnergyFromBendings(boolean newValue)
    This method specify if energy is read from bendings.
    void
    setWith(Object[] par)
    Sets parameters values of this element to those in parameter array.
    Returns the string representation of this element.
    int
    Reads value from associated element or Abean and calculates it's new values.
    int
    Reads energy from InfoServerBean and updates machine functions with new energy.

    Methods inherited from class org.scictrl.mp.orbitcorrect.model.optics.AbstractDataBushElement

    equals, getLastActionResult, getName, getOwner, getVirtual, hashCode, isInitialized, isVirtual, setVirtual, throwISE

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.scictrl.mp.orbitcorrect.ISimpleElement

    getName
  • Field Details

    • PR_ENERGY

      public static final int PR_ENERGY
      Index of element's energy value in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_READ_E_FROM_BEND

      public static final int PR_READ_E_FROM_BEND
      Index of element's read from bendings flag in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_ORBIT_IS_CLOSED

      public static final int PR_ORBIT_IS_CLOSED
      Index of element's closed orbit flag in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_BETA_X

      public static final int PR_BETA_X
      Index of element's beta in x direction in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_BETA_Z

      public static final int PR_BETA_Z
      Index of element's beta in z direction in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_ALPHA_X

      public static final int PR_ALPHA_X
      Index of element's aplha in x direction in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_ALPHA_Z

      public static final int PR_ALPHA_Z
      Index of element's aplha in z direction in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_Q_X

      public static final int PR_Q_X
      Index of element's phase shift in x direction in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_Q_Z

      public static final int PR_Q_Z
      Index of element's phase shift in z direction in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_DISPERSION

      public static final int PR_DISPERSION
      Index of element's dispersion in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • PR_dDISPERSION

      public static final int PR_dDISPERSION
      Index of element's dispersion prime in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • ENERGY

      public static final String ENERGY
      Constant ENERGY="Energy"
      See Also:
  • Constructor Details

    • DataBushInfo

      public DataBushInfo(String name)
      Constructs DataBush element with specified name and default parameter's values.
      Parameters:
      name - a String name of element
    • DataBushInfo

      public DataBushInfo(String name, boolean virtual, double energy, boolean fromBend, boolean orbitClosed, double betaX, double betaZ, double alphaX, double alphaZ, double qX, double qZ, double disp, double ddisp)
      Constructs DataBush element with specified parameters.
      Parameters:
      name - a String name of element
      virtual - a boolean virtual flag
      energy - a double initial energy
      fromBend - a boolean readFromBendings flag
      orbitClosed - a boolean tells if this DataBush form a closed orbit
      betaX - a double machine function beta in x direction
      betaZ - a double machine function beta in z direction
      alphaX - a double machine function alpha in x direction
      alphaZ - a double machine function alpha in z direction
      qX - a double beam normalised phase in x direction
      qZ - a double beam normalised phase in z direction
      disp - a double machine function dispersion
      ddisp - a double machine function dispersion
  • 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.
      Specified by:
      clone in interface ISimpleElement
      Overrides:
      clone in class AbstractDataBushElement
      Returns:
      a Object the clone of this element.
    • 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. Returns the descriptor object for this element. DBElementDescriptor helps manipulating DataBush elements dynamically.
      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:
    • getAlpha

      public PositionedData getAlpha()
      Returns closed orbit solution for alpha-function.
      Returns:
      a PositionedData closed orbit solution for alpha-function
    • getBeta

      public PositionedData getBeta()
      Returns closed orbit solution for beta-function.
      Returns:
      a PositionedData closed orbit solution for beta-function
    • getDispersion

      public DispersionData getDispersion()
      Returns closed orbit solution for horizontal momentum dispersion function.
      Returns:
      a DispersionData closed orbit solution for horizontal momentum dispersion function
    • getEnergy

      public double getEnergy()
      Returns the energy value for this element.
      Returns:
      a double the energy value for this element.
    • getConnector

      public IDataConnector<Double> getConnector()
      This method returns energy server, which is object that gets necessary data and calculate energy.
      Returns:
      a IDataConnector object
    • getMatrix

      public TransferMatrix getMatrix()
      This method return transfer matrix of the system.
      Returns:
      a TransferMatrix object
      See Also:
    • getMinUpdateInterval

      public long getMinUpdateInterval()
      Delay between two updating cannot be below one limits, which can be specified.
      Returns:
      long
      See Also:
    • getQ

      public PositionedData getQ()
      This method return beam normalised phase
      Returns:
      a PositionedData object
    • getReadEnergyFromBendings

      public boolean getReadEnergyFromBendings()
      If DataBushInfo is virtual, then, for simulation manners only, energy is read from bendings.
      Returns:
      boolean True if this should be done, otherwise false.
    • 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. Test if element is connected.
      Specified by:
      isConnected in interface IBindedElement<Double>
      Returns:
      true if element is binded, false otherwise.
    • 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:
    • isReadEnergyFromBendings

      public boolean isReadEnergyFromBendings()

      isReadEnergyFromBendings.

      Returns:
      a boolean
    • isOrbitClosed

      public boolean isOrbitClosed()
      Gets flag that orbit closes on itself after one revolution.
      Returns:
      boolean True if closes.
    • setAlpha

      public void setAlpha(double alphaX, double alphaZ) throws IllegalStateException
      This method sets beam alpha function.
      Parameters:
      alphaX - a double
      alphaZ - a double
      Throws:
      IllegalStateException - if any.
    • setBeta

      public void setBeta(double betaX, double betaZ) throws IllegalStateException
      This method sets beam beta function.
      Parameters:
      betaX - a double
      betaZ - a double
      Throws:
      IllegalStateException - if any.
    • setDispersion

      public void setDispersion(double d, double dp) throws IllegalStateException
      This method sets beam dispersion function.
      Parameters:
      d - a double
      dp - a double
      Throws:
      IllegalStateException - if any.
    • setEnergy

      public void setEnergy(double value) throws IllegalStateException
      Sets energy to DataBushInfo element and distribute energy to magnets. This operation is valid only if DataBushInfo is virtual. Otherwize IllegalStateException is thrown.
      Parameters:
      value - a double
      Throws:
      IllegalStateException - if any.
    • setEnergyFromBendings

      public void setEnergyFromBendings() throws IllegalStateException
      Reads energy from bendings and sets the energy to DataBushInfo and distributes to DataBush magnets. This operation is valid only if the DataBushInfo is virtual. otherwize IllegalStateException is thrown.
      Throws:
      IllegalStateException - if any.
    • setMinUpdateInterval

      public void setMinUpdateInterval(long newValue)
      This method sets minimal update interval.
      Parameters:
      newValue - a long
      See Also:
    • setOrbitClosed

      public void setOrbitClosed(boolean newOrbitClosed) throws IllegalStateException
      Sets flag that orbit closes on itself after one revolution. This preprty can not be set when element is initialized and DataBush is operational.
      Parameters:
      newOrbitClosed - boolean does orbit closes on itself after one revolution
      Throws:
      IllegalStateException - if any.
    • setQ

      public void setQ(double qX, double qZ) throws IllegalStateException
      This method sets beam normalized phaze.
      Parameters:
      qX - a double
      qZ - a double
      Throws:
      IllegalStateException - if any.
    • setReadEnergyFromBendings

      public void setReadEnergyFromBendings(boolean newValue)
      This method specify if energy is read from bendings.
      Parameters:
      newValue - a boolean
      See Also:
    • setWith

      public void setWith(Object[] par) throws IllegalStateException
      Sets parameters values of this element to those in parameter array. As parameter must be used such array as for dynamical construction of new instance of this class. Current values are overriden for each not null object in array.

      setWith.

      Overrides:
      setWith in class AbstractDataBushElement
      Parameters:
      par - an array of Object objects
      Throws:
      IllegalStateException - if element is initialized and inside DataBush.
      See Also:
    • 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.
      Specified by:
      toString in interface ISimpleElement
      Overrides:
      toString in class AbstractDataBushElement
    • 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. Reads energy from InfoServerBean and updates machine functions with new energy. Return code is returned. Exceptions are thrown in following situations:
      • IllegalStateException if
      • element is not initialized in DataBush
      • DataBush is not in UPDATE_MANUAL update mode
      • DataBush is in ACCESS_ALL_DATA access mode
      • PackedDBException if
      • element is not virtual and is not connected
      • remote exception is caught
      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
    • updateLinearOptics

      public int updateLinearOptics() throws IllegalStateException, DataBushPackedException
      Reads energy from InfoServerBean and updates machine functions with new energy. Return code is returned. Exceptions are thrown in following situations:
      • IllegalStateException if element is not initialized in DataBush
      • DataBush is not in UPDATE_MANUAL update mode
      • DataBush is in ACCESS_ALL_DATA access mode
      • PackedDBException if element is not virtual and is not connected remote exception is caught
      Returns:
      a int
      Throws:
      IllegalStateException - if any.
      DataBushPackedException - if any.