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.
true
- DataBushInfo does not connect to InfoServerBean. depending on readEnergyFromBendings flag, there are two possibilities. If readEnergyFromBendings flag istrue
- 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
Modifier and TypeFieldDescriptionstatic final String
ConstantENERGY="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
ConstructorDescriptionDataBushInfo
(String name) 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 TypeMethodDescriptionclone()
Returns the clone of this element.int
connect()
Binds to remote object.Returns the descriptor object for this element.int
Destroys connection.int
elType()
Returns the code of element's type.getAlpha()
Returns closed orbit solution for alpha-function.getBeta()
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.getQ()
This method return beam normalised phaseboolean
IfDataBushInfo
is virtual, then, for simulation manners only, energy is read from bendings.void
SetsDataInvalidated
flag totrue
.boolean
Returnstrue
if element is binded,false
otherwise.boolean
Returnstrue
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
notifyDataUpdate
(Double data) Called by data connection when new value update arrivesvoid
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
Sets parameters values of this element to those in parameter array.toString()
Returns the string representation of this element.int
update()
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_ENERGYIndex 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_BENDIndex 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_CLOSEDIndex 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_XIndex 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_ZIndex 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_XIndex 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_ZIndex 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_XIndex 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_ZIndex 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_DISPERSIONIndex 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_dDISPERSIONIndex of element's dispersion prime in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.- See Also:
-
ENERGY
ConstantENERGY="Energy"
- See Also:
-
-
Constructor Details
-
DataBushInfo
Constructs DataBush element with specified name and default parameter's values.- Parameters:
name
- aString
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
- aString
name of elementvirtual
- a boolean virtual flagenergy
- a double initial energyfromBend
- a boolean readFromBendings flagorbitClosed
- a boolean tells if thisDataBush
form a closed orbitbetaX
- a double machine function beta in x directionbetaZ
- a double machine function beta in z directionalphaX
- a double machine function alpha in x directionalphaZ
- a double machine function alpha in z directionqX
- a double beam normalised phase in x directionqZ
- a double beam normalised phase in z directiondisp
- a double machine function dispersionddisp
- a double machine function dispersion
-
-
Method Details
-
notifyDataUpdate
Called by data connection when new value update arrives- Specified by:
notifyDataUpdate
in interfaceIBindedElement<Double>
- Parameters:
data
- new data, if value is OK,null
if last arrive value signals problems and can not be thrusted
-
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 interfaceISimpleElement
- Overrides:
clone
in classAbstractDataBushElement
- Returns:
- a
Object
the clone of this element.
-
connect
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 interfaceIBindedElement<Double>
- Returns:
- the code indication success of bind.
- Throws:
DataBushPackedException
- if bind exception occurs.IllegalStateException
- See Also:
-
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 classAbstractDataBushElement
- Returns:
- the descriptor object for this element.
- See Also:
-
disconnect
Destroys connection. Returns the code indication success of destroy. Disconnects element from InfoServerBean device. Returns the success code of operation.- Specified by:
disconnect
in interfaceIBindedElement<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 classAbstractDataBushElement
- Returns:
- the code of element's type.
- See Also:
-
getAlpha
Returns closed orbit solution for alpha-function.- Returns:
- a
PositionedData
closed orbit solution for alpha-function
-
getBeta
Returns closed orbit solution for beta-function.- Returns:
- a
PositionedData
closed orbit solution for beta-function
-
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
This method returns energy server, which is object that gets necessary data and calculate energy.- Returns:
- a
IDataConnector
object
-
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
This method return beam normalised phase- Returns:
- a
PositionedData
object
-
getReadEnergyFromBendings
public boolean getReadEnergyFromBendings()IfDataBushInfo
is virtual, then, for simulation manners only, energy is read from bendings.- Returns:
- boolean
True
if this should be done, otherwisefalse
.
-
invalidateData
public void invalidateData()SetsDataInvalidated
flag totrue
. 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 interfaceAbstractUpdateableElement
- See Also:
-
isConnected
public boolean isConnected()Returnstrue
if element is binded,false
otherwise. Test if element is connected.- Specified by:
isConnected
in interfaceIBindedElement<Double>
- Returns:
true
if element is binded,false
otherwise.
-
isDataInvalidated
public boolean isDataInvalidated()Returnstrue
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 interfaceAbstractUpdateableElement
- 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
This method sets beam alpha function.- Parameters:
alphaX
- a doublealphaZ
- a double- Throws:
IllegalStateException
- if any.
-
setBeta
This method sets beam beta function.- Parameters:
betaX
- a doublebetaZ
- a double- Throws:
IllegalStateException
- if any.
-
setDispersion
This method sets beam dispersion function.- Parameters:
d
- a doubledp
- a double- Throws:
IllegalStateException
- if any.
-
setEnergy
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
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
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
This method sets beam normalized phaze.- Parameters:
qX
- a doubleqZ
- 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
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 notnull
object in array.setWith.
- Overrides:
setWith
in classAbstractDataBushElement
- Parameters:
par
- an array ofObject
objects- Throws:
IllegalStateException
- if element is initialized and inside DataBush.- See Also:
-
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 interfaceISimpleElement
- Overrides:
toString
in classAbstractDataBushElement
-
update
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 checksisDataInvalidated()
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 tofalse
. 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 interfaceAbstractUpdateableElement
- Returns:
- a int the return code indicating success
- Throws:
IllegalStateException
- thrown if status of DataBush equalsDB_EMPTY
DataBushPackedException
- contains all exception thrown or caught during updating element
-
-
updateLinearOptics
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.
-
-