Package xal.smf
Class AcceleratorNode
java.lang.Object
xal.smf.AcceleratorNode
- All Implemented Interfaces:
Comparable
,ElementType
,DataListener
- Direct Known Subclasses:
AcceleratorSeq
,BLM
,BPM
,BunchShapeMonitor
,Chopper
,CurrentMonitor
,Doppler
,Electrostatic
,EMU
,ESSIonSourceCoil
,ESSIonSourceMagnetron
,ESSIonSourceMFC
,GenericNode
,Iris
,Magnet
,Marker
,ProfileDevice
,ProfileMonitor
,RepellerElectrode
,RfGap
,RfqDummy
,SpaceChargeCompensation
,Vacuum
public abstract class AcceleratorNode
extends Object
implements ElementType, DataListener, Comparable
The base class in the hierarchy of different accelerator node types.
- Author:
- Nikolay Malitsky, Christopher K. Allen, Nick D. Pattengale
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Indicator if this node is a "softNode" copyprotected boolean
Indicator as to whether the Accelerator Node is functionalprotected boolean
Indicator as to whether accelerator node is validprotected AlignmentBucket
alignment attribute bucket for nodeprotected ApertureBucket
aperture parameters for nodeprotected TwissBucket
twiss parameter bucket for nodeprotected ChannelSuite
channel suite associated with this nodeprotected double
length of nodeprotected double
position of nodeprotected double
"s" position for global displayprotected Map<String,
AttributeBucket> all attribute buckets for nodeprotected Accelerator
the associated Accelerator objectprotected AcceleratorSeq
parent sequence objectprotected String
engineering identifierprotected String
node identifierprotected String
physics identifier -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AcceleratorNode
(String strId) Convenience constructor using the default channel factoryprotected
AcceleratorNode
(String strId, ChannelFactory channelFactory) Designated constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBucket
(AttributeBucket buc) General attribute buckets supportDo a batch connection of all handles for this nodeboolean
batchConnectAllHandlesAndWait
(double timeout) Do a batch connection of all handles for this node and wait for completionchannel suite accessorvoid
clear()
remove this node from the accelerator hieracrhcyint
implement DataListener interfacefindChannel
(String handle) Attempt to find a channel for the given handle.return the top level accelerator that this node belongs toGet a list of properties that can be accessed through EPICS.protected List<AccessibleProperty>
getAccessibleProperties
(List<AccessibleProperty> properties, Class<?> cls) getAlign()
returns the bucket containing the alignment parameters - see attr.AlignBucketReturns a collection of all channelsgetAndConnectChannel
(String handle) Get the channel corresponding to the specified handle and connect it.getAndConnectChannelSetAndReadback
(String setHandle) Get the channels corresponding to the specified handle and connect to them.getAper()
returns the bucket containing the Aperture parameters - see attr.ApertureBucketgetChannel
(String chanHandle) this method returns the Channel object of this node, associated with a prescribed PV name.double
getDesignPropertyValue
(String propertyName) Get the design value for the specified propertygetEId()
return the engineering ID of this nodeaccessor to channel suite handlesgetId()
return the ID of this nodedouble
return the physical length of this node (m)Channel[]
getLivePropertyChannels
(String propertyName) Get the array of channels for the specified propertydouble
getLivePropertyValue
(String propertyName, double[] channelValues) Get the live property value for the corresponding array of channel values in the order given by getLivePropertyChannels()return the parent sequence that this node belongs togetPId()
return the physics ID of this nodedouble
returns device pitch angle in degreesdouble
return the position of this node, along the reference orbit within its sequence (m)get the primary ancestor sequence that is a direct child of the acceleratorGet a list with the names of properties that can be accessed through EPICS and that are used by the model.String[]
getReadbackHandles
(String setHandle) Get the readback handle corresponding to a set channel.double
returns device roll angle in degreesdouble
return global "s" display coordinategetSetHandle
(String readbackHandle) Get the set handle corresponding to a readback channel.Derived class may furnish a unique software typeboolean
Runtime indication of accelerator component operationgetTwiss()
returns the bucket containing the Twiss parameters - see attr.TwissBucketabstract String
getType()
Derived class must furnish a unique type idboolean
getValid()
Runtime indication of the validity of component operationdouble
returns device x offsetdouble
returns device yaw angle in degreesdouble
returns device y offsetdouble
returns device z offsetboolean
hasBucket
(AttributeBucket bucket) boolean
Indicates if the node has a parent setboolean
isChannelSettable
(String handle) boolean
Determine if a node is of the specified type.boolean
isMagnet()
Determine if the node is a magnet.lazilyGetAndConnect
(String chanHandle, Channel channel) A method to make an EPICS ca connection for a given PV name The channel connection is initiated, and no extra work is done, if the channel connection already existsprotected void
remove this node from its immediate parent sequenceprotected void
setAccelerator
(Accelerator accel) set the top level accelerator for this nodevoid
setAlign
(AlignmentBucket buc) sets the bucket containing the twiss parameters - see attr.TwissBucketvoid
setAper
(ApertureBucket buc) sets the bucket containing the Aperture parameters - see attr.ApertureBucketvoid
setDesignPropertyValue
(String propertyName, double value) Get the design value for the specified propertyvoid
setLength
(double length) set the length of this accelerator nodevoid
setLivePropertyValue
(String propertyName, double channelValue) Set the live property value for the corresponding array of channel values in the order given by getLivePropertyChannels()protected void
setParent
(AcceleratorSeq parent) define the parent sequence for this nodevoid
setPitchAngle
(double angle) set device pitch anglevoid
setPosition
(double position) set the position of this accelerator node within its parent sequencevoid
setRollAngle
(double angle) set device roll anglevoid
setSDisplay
(double dblS) set "s" coordinatevoid
setStatus
(boolean bolStatus) Runtime indication of accelerator operationvoid
setTwiss
(TwissBucket buc) sets the bucket containing the alignment parameters - see attr.AlignBucketvoid
setValid
(boolean bolValid) Runtime indication of the validity of component operationboolean
setValueAndVerify
(String setHandle, Number value, Number tolerance, double timeout) Set a value to the set channel corresponding to the set handle, and then check on the readback channel that the value is within an interval around the set value.void
setXOffset
(double offset) set device x offsetvoid
setYawAngle
(double angle) set device yaw anglevoid
setYOffset
(double offset) set device y offsetvoid
setZOffset
(double offset) set device z offsettoString()
Returns the identifier string of the node.void
update
(DataAdaptor adaptor) implement DataListener interfacevoid
write
(DataAdaptor adaptor) implement DataListener interfaceprotected void
writeAttributes
(DataAdaptor adaptor) write the attributes of the Node.void
writeStatus
(DataAdaptor adaptor) method to write status of the node into a separate file
-
Field Details
-
strId
node identifier -
strPId
physics identifier -
strEId
engineering identifier -
dblPos
protected double dblPosposition of node -
dblLen
protected double dblLenlength of node -
seqParent
parent sequence object -
objAccel
the associated Accelerator object -
mapAttrs
all attribute buckets for node -
bucAlign
alignment attribute bucket for node -
bucTwiss
twiss parameter bucket for node -
bucAper
aperture parameters for node -
bolStatus
protected boolean bolStatusIndicator as to whether the Accelerator Node is functional -
bolValid
protected boolean bolValidIndicator as to whether accelerator node is valid -
dblS
protected double dblS"s" position for global display -
bolIsSoft
protected boolean bolIsSoftIndicator if this node is a "softNode" copy -
channelSuite
channel suite associated with this node
-
-
Constructor Details
-
AcceleratorNode
Designated constructor- Parameters:
strId
- the string ID for this nodechannelFactory
- channel factory (null for default) for generating this node's channels
-
AcceleratorNode
Convenience constructor using the default channel factory- Parameters:
strId
- the string ID for this node
-
-
Method Details
-
getType
Derived class must furnish a unique type id -
getSoftType
Derived class may furnish a unique software type -
dataLabel
implement DataListener interface- Specified by:
dataLabel
in interfaceDataListener
- Returns:
- a tag that identifies the receiver's type
-
update
implement DataListener interface- Specified by:
update
in interfaceDataListener
- Parameters:
adaptor
- The adaptor from which to update the data- Throws:
NumberFormatException
-
write
implement DataListener interface- Specified by:
write
in interfaceDataListener
- Parameters:
adaptor
- The adaptor to which the receiver's data is written
-
writeStatus
method to write status of the node into a separate file -
writeAttributes
write the attributes of the Node. Subclasses can be override this method to write a different set of attributes- Parameters:
adaptor
-
-
findChannel
Attempt to find a channel for the given handle.- Parameters:
handle
- the handle for which to find an associated channel- Returns:
- channel for the given handle or null if none could be found
-
getAllChannels
Returns a collection of all channels- Returns:
- channels (corresponding to all handles)
-
batchConnectAllHandles
Do a batch connection of all handles for this node- Returns:
- the BatchConnectionRequest object
-
batchConnectAllHandlesAndWait
public boolean batchConnectAllHandlesAndWait(double timeout) Do a batch connection of all handles for this node and wait for completion- Parameters:
timeout
- the maximum time in seconds to wait for completion- Returns:
- true if all channels successfully connected
-
getChannel
this method returns the Channel object of this node, associated with a prescribed PV name. Note - xal interacts with EPICS via Channel objects.- Parameters:
chanHandle
- The handle to the epics channel in stored in the channel suite- Throws:
NoSuchChannelException
-
isChannelSettable
-
getAndConnectChannel
Get the channel corresponding to the specified handle and connect it.- Parameters:
handle
- The handle for the channel to get.- Returns:
- The channel associated with this node and the specified handle or null if there is no match.
- Throws:
NoSuchChannelException
- if no such channel as specified by the handle is associated with this node.
-
lazilyGetAndConnect
public Channel lazilyGetAndConnect(String chanHandle, Channel channel) throws NoSuchChannelException A method to make an EPICS ca connection for a given PV name The channel connection is initiated, and no extra work is done, if the channel connection already exists- Throws:
NoSuchChannelException
-
getAccessibleProperties
Get a list of properties that can be accessed through EPICS.- Returns:
- properties that can be accessed via EPICS.
-
getAccessibleProperties
protected List<AccessibleProperty> getAccessibleProperties(List<AccessibleProperty> properties, Class<?> cls) -
getDefaultHandles
- Returns:
- a list with expected channel handles by default.
-
getAndConnectChannelSetAndReadback
Get the channels corresponding to the specified handle and connect to them. This method is useful when setting a value and checking that the value was set.- Parameters:
setHandle
- The set handle for the channel to set.- Returns:
- A list containing the set (first) and readback channels (subsequent) associated with this node and the specified set handle or null if there is no match.
- Throws:
NoSuchChannelException
- if no such channel as specified by the handle is associated with this node.
-
getReadbackHandles
Get the readback handle corresponding to a set channel.- Parameters:
setHandle
- The set handle.- Returns:
- The corresponding readback handle.
-
getSetHandle
Get the set handle corresponding to a readback channel.- Parameters:
readbackHandle
- The readback handle.- Returns:
- The corresponding set handle.
-
setValueAndVerify
public boolean setValueAndVerify(String setHandle, Number value, Number tolerance, double timeout) throws PutException, MonitorException Set a value to the set channel corresponding to the set handle, and then check on the readback channel that the value is within an interval around the set value.- Parameters:
setHandle
- Handle corresponding to the set channel.value
- Value to be set.tolerance
- Defines an interval around the value (absolute value).timeout
- Timeout in seconds for the readback to reach the set value before failing. Failure is indicated by returning false.- Returns:
- true if the value is set correctly, otherwise false.
- Throws:
PutException
MonitorException
-
getProperties
Get a list with the names of properties that can be accessed through EPICS and that are used by the model.- Returns:
- properties that can be accessed via EPICS.
-
getDesignPropertyValue
Get the design value for the specified property -
setDesignPropertyValue
Get the design value for the specified property -
getLivePropertyValue
Get the live property value for the corresponding array of channel values in the order given by getLivePropertyChannels() -
setLivePropertyValue
Set the live property value for the corresponding array of channel values in the order given by getLivePropertyChannels()- Throws:
PutException
-
getLivePropertyChannels
Get the array of channels for the specified property -
getId
return the ID of this node -
getEId
return the engineering ID of this node -
getPId
return the physics ID of this node -
getLength
public double getLength()return the physical length of this node (m) -
getPosition
public double getPosition()return the position of this node, along the reference orbit within its sequence (m) -
getSDisplay
public double getSDisplay()return global "s" display coordinate- Returns:
- s coordinate
-
getAccelerator
return the top level accelerator that this node belongs to -
getParent
return the parent sequence that this node belongs to -
getPrimaryAncestor
get the primary ancestor sequence that is a direct child of the accelerator -
hasParent
public boolean hasParent()Indicates if the node has a parent set -
getStatus
public boolean getStatus()Runtime indication of accelerator component operation- Returns:
- true(up and running) false(down)
-
getValid
public boolean getValid()Runtime indication of the validity of component operation- Returns:
- true(valid operation) false(questionable operation)
-
setPosition
public void setPosition(double position) set the position of this accelerator node within its parent sequence -
setLength
public void setLength(double length) set the length of this accelerator node -
setSDisplay
public void setSDisplay(double dblS) set "s" coordinate- Parameters:
dblS
- s coordinate
-
setStatus
public void setStatus(boolean bolStatus) Runtime indication of accelerator operation- Parameters:
bolStatus
- true(up and running) false(down)
-
setValid
public void setValid(boolean bolValid) Runtime indication of the validity of component operation- Parameters:
bolValid
- true(valid operation) false(questionable operation)
-
addBucket
General attribute buckets support -
getBuckets
-
getBucket
-
hasBucket
-
getTwiss
returns the bucket containing the Twiss parameters - see attr.TwissBucket -
getAlign
returns the bucket containing the alignment parameters - see attr.AlignBucket -
getPitchAngle
public double getPitchAngle()returns device pitch angle in degrees- Returns:
- pitch angle
-
getYawAngle
public double getYawAngle()returns device yaw angle in degrees- Returns:
- yaw angle
-
getRollAngle
public double getRollAngle()returns device roll angle in degrees- Returns:
- roll angle
-
getXOffset
public double getXOffset()returns device x offset- Returns:
- x offset
-
getYOffset
public double getYOffset()returns device y offset- Returns:
- y offset
-
getZOffset
public double getZOffset()returns device z offset- Returns:
- z offset
-
getAper
returns the bucket containing the Aperture parameters - see attr.ApertureBucket -
setAlign
sets the bucket containing the twiss parameters - see attr.TwissBucket -
setTwiss
sets the bucket containing the alignment parameters - see attr.AlignBucket -
setAper
sets the bucket containing the Aperture parameters - see attr.ApertureBucket -
setPitchAngle
public void setPitchAngle(double angle) set device pitch angle- Parameters:
angle
- pitch angle in degree
-
setYawAngle
public void setYawAngle(double angle) set device yaw angle- Parameters:
angle
- yaw angle in degree
-
setRollAngle
public void setRollAngle(double angle) set device roll angle- Parameters:
angle
- roll angle in degree
-
setXOffset
public void setXOffset(double offset) set device x offset- Parameters:
offset
- x offset
-
setYOffset
public void setYOffset(double offset) set device y offset- Parameters:
offset
- y offset
-
setZOffset
public void setZOffset(double offset) set device z offset- Parameters:
offset
- z offset
-
clear
public void clear()remove this node from the accelerator hieracrhcy -
removeFromParent
protected void removeFromParent()remove this node from its immediate parent sequence -
setParent
define the parent sequence for this node -
setAccelerator
set the top level accelerator for this node -
channelSuite
channel suite accessor -
getHandles
accessor to channel suite handles -
isKindOf
Determine if a node is of the specified type. The comparison is based upon the node's class and the element type manager handles checking for inherited classes to types get inherited. Subclasses can override this method if the types comparison is more complicated (e.g. if more than one type can be associated with the same node class).- Specified by:
isKindOf
in interfaceElementType
- Parameters:
compType
- The type against which to compare.- Returns:
- true if the node is of the specified type; false otherwise.
-
isMagnet
public boolean isMagnet()Determine if the node is a magnet.- Specified by:
isMagnet
in interfaceElementType
- Returns:
- true if the node is a magnet; false other.
-
toString
Returns the identifier string of the node. -
compareTo
- Specified by:
compareTo
in interfaceComparable
-