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
FieldsModifier and TypeFieldDescriptionstatic final StringConstantENERGY="Energy"static final intIndex of element's aplha in x direction in array of constructor's parameters.static final intIndex of element's aplha in z direction in array of constructor's parameters.static final intIndex of element's beta in x direction in array of constructor's parameters.static final intIndex of element's beta in z direction in array of constructor's parameters.static final intIndex of element's dispersion prime in array of constructor's parameters.static final intIndex of element's dispersion in array of constructor's parameters.static final intIndex of element's energy value in array of constructor's parameters.static final intIndex of element's closed orbit flag in array of constructor's parameters.static final intIndex of element's phase shift in x direction in array of constructor's parameters.static final intIndex of element's phase shift in z direction in array of constructor's parameters.static final intIndex 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
ConstructorsConstructorDescriptionDataBushInfo(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.intconnect()Binds to remote object.Returns the descriptor object for this element.intDestroys connection.intelType()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.doubleReturns the energy value for this element.This method return transfer matrix of the system.longDelay between two updating cannot be below one limits, which can be specified.getQ()This method return beam normalised phasebooleanIfDataBushInfois virtual, then, for simulation manners only, energy is read from bendings.voidSetsDataInvalidatedflag totrue.booleanReturnstrueif element is binded,falseotherwise.booleanReturnstrueif element's data is not synchronized with associated element or Abean.booleanGets flag that orbit closes on itself after one revolution.booleanisReadEnergyFromBendings.voidnotifyDataUpdate(Double data) Called by data connection when new value update arrivesvoidsetAlpha(double alphaX, double alphaZ) This method sets beam alpha function.voidsetBeta(double betaX, double betaZ) This method sets beam beta function.voidsetDispersion(double d, double dp) This method sets beam dispersion function.voidsetEnergy(double value) Sets energy to DataBushInfo element and distribute energy to magnets.voidReads energy from bendings and sets the energy to DataBushInfo and distributes to DataBush magnets.voidsetMinUpdateInterval(long newValue) This method sets minimal update interval.voidsetOrbitClosed(boolean newOrbitClosed) Sets flag that orbit closes on itself after one revolution.voidsetQ(double qX, double qZ) This method sets beam normalized phaze.voidsetReadEnergyFromBendings(boolean newValue) This method specify if energy is read from bendings.voidSets parameters values of this element to those in parameter array.toString()Returns the string representation of this element.intupdate()Reads value from associated element or Abean and calculates it's new values.intReads 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, throwISEMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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- aStringname 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- aStringname of elementvirtual- a boolean virtual flagenergy- a double initial energyfromBend- a boolean readFromBendings flagorbitClosed- a boolean tells if thisDataBushform 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:
notifyDataUpdatein interfaceIBindedElement<Double>- Parameters:
data- new data, if value is OK,nullif 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:
clonein interfaceISimpleElement- Overrides:
clonein classAbstractDataBushElement- Returns:
- a
Objectthe 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:
connectin 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.DBElementDescriptorhelps manipulating DataBush elements dynamically. Returns the descriptor object for this element.DBElementDescriptorhelps manipulating DataBush elements dynamically.- Specified by:
descriptorin 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:
disconnectin 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:
elTypein classAbstractDataBushElement- Returns:
- the code of element's type.
- See Also:
-
getAlpha
Returns closed orbit solution for alpha-function.- Returns:
- a
PositionedDataclosed orbit solution for alpha-function
-
getBeta
Returns closed orbit solution for beta-function.- Returns:
- a
PositionedDataclosed orbit solution for beta-function
-
getDispersion
Returns closed orbit solution for horizontal momentum dispersion function.- Returns:
- a
DispersionDataclosed 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
IDataConnectorobject
-
getMatrix
This method return transfer matrix of the system.- Returns:
- a
TransferMatrixobject - 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
PositionedDataobject
-
getReadEnergyFromBendings
public boolean getReadEnergyFromBendings()IfDataBushInfois virtual, then, for simulation manners only, energy is read from bendings.- Returns:
- boolean
Trueif this should be done, otherwisefalse.
-
invalidateData
public void invalidateData()SetsDataInvalidatedflag 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:
invalidateDatain interfaceAbstractUpdateableElement- See Also:
-
isConnected
public boolean isConnected()Returnstrueif element is binded,falseotherwise. Test if element is connected.- Specified by:
isConnectedin interfaceIBindedElement<Double>- Returns:
trueif element is binded,falseotherwise.
-
isDataInvalidated
public boolean isDataInvalidated()Returnstrueif 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:
isDataInvalidatedin interfaceAbstractUpdateableElement- Returns:
trueif 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
Trueif 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 notnullobject in array.setWith.
- Overrides:
setWithin classAbstractDataBushElement- Parameters:
par- an array ofObjectobjects- 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:
toStringin interfaceISimpleElement- Overrides:
toStringin 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:-
IllegalStateExceptionif - 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:
updatein interfaceAbstractUpdateableElement- Returns:
- a int the return code indicating success
- Throws:
IllegalStateException- thrown if status of DataBush equalsDB_EMPTYDataBushPackedException- 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:-
IllegalStateExceptionif element is not initialized in DataBush - DataBush is not in UPDATE_MANUAL update mode
- DataBush is in ACCESS_ALL_DATA access mode
-
PackedDBException ifelement is not virtual and is not connected remote exception is caught
- Returns:
- a int
- Throws:
IllegalStateException- if any.DataBushPackedException- if any.
-
-