public class Signal extends ScadaRecord
Data structure for storing all the properties of a beam profile signal. This includes the signal values, the location of the value within the beam pipe, and the number of samples. Noise characteristics may also be present.
This structure is equipped for direct acquisition of WireHarp
device
profile data measurements. The data structure is derived from the ScadaStruct
base class in order to use that data I/O mechanism already in place.
This type is intended to serve as attributes for a larger data structure
containing the beam profiles in multiple transverse planes. That aggregating
structure is expected to set up the necessary connections for data acquisition
use by the base class ScadaRecord
, namely by instantiating
instances with the constructor Signal(List
(protected access). It is still possible to use a Signal
object
directly by annotating it with the
annotation.
AScada.Record
Ported from XAL on Jul 15, 2014.
· Jonathan M. Freed
Modifier and Type | Class and Description |
---|---|
static class |
Signal.FIELD
Field names of the
class. |
ScadaRecord.IFieldDescriptor
Modifier and Type | Field and Description |
---|---|
int |
cnt
Number of sample points in the signal
|
double |
navg
mean value of the noise amplitude
|
double |
nvar
standard deviation (or variance) of the noise amplitude
|
double[] |
pos
Positions of the sample points in signal
|
double[] |
val
Signal value at the sample location
|
Modifier | Constructor and Description |
---|---|
|
Signal()
Creates a new, uninitialized instance of
Signal which is not connected
to any XAL channels. |
protected |
Signal(java.util.List<ScadaFieldDescriptor> lstFldDscr)
Creates a new instance of Signal and initializes the SCADA operations with the
given field descriptors.
|
Modifier and Type | Method and Description |
---|---|
void |
average(Signal sigAcq,
double dblWtFac)
Performs an averaging operation with the given
Signal object using the
given averaging factor. |
java.lang.Object |
clone()
Creates a deep copy of this object.
|
static Signal |
createBlankSignal()
Creates and returns a new
Signal object containing no data and
incapable of any data acquisition. |
static Signal |
createConnectedSignal(ASignal annSig)
Creates a new instance of the
Signal class which is connected
to a given device whose signal fields are described in the given annotation. |
java.lang.String |
dataLabel()
Returns a (unique) string identifier that identifies the
persistent data format that belongs to this
Signal
class. |
java.lang.String |
toString()
Write out the contents of this signal.
|
void |
update(DataAdaptor daptSrc)
Read in the values of the data structure fields from the data
source behind the data adaptor interface.
|
void |
write(DataAdaptor daptSink)
Save the data structure field values to the given data sink behind
the
DataAdaptor interface. |
getFieldDescriptor, getFieldDescriptorMap, getFieldDescriptors, loadHardwareValues, setFieldFromPV, setHardwareValues, setPvFromField
public double[] pos
public double[] val
public int cnt
public double navg
public double nvar
public Signal() throws BadStructException
Signal
which is not connected
to any XAL channels.BadStructException
- no SCADA fields (@AScada.Field) were found in data structureprotected Signal(java.util.List<ScadaFieldDescriptor> lstFldDscr) throws BadStructException
lstFldDscr
- array of field descriptors used for communication with hardwareBadStructException
- no SCADA fields were found in argumentpublic static Signal createBlankSignal()
Signal
object containing no data and
incapable of any data acquisition. This type of object is primarily used for
data processing.public static Signal createConnectedSignal(ASignal annSig) throws BadStructException, ScadaAnnotationException
Creates a new instance of the Signal
class which is connected
to a given device whose signal fields are described in the given annotation.
When created here, the Signal
object becomes a fully functional
and can automatically acquire data from the
connected device.
ScadaRecord
Signal
object may not have all fields connected.
Only those fields for which the given annotation has non-empty values will be
connected. This could cause complications for signals requiring such fields and
should be checked.
annSig
- annotation class containing the meta-data describing the signal connectionsScadaRecord
class capable of data acquisitionScadaAnnotationException
- field in the annotation is not accessible,
does not exist,
or enumeration Signal.FIELD
is corruptBadStructException
- a required field of the given annotation is emptypublic void average(Signal sigAcq, double dblWtFac) throws java.lang.IllegalArgumentException
Performs an averaging operation with the given Signal
object using the
given averaging factor. The quantities within this data structure are averaged in
place with that of the given signal structure. Letting λ denote the
provided averaging factor, which is in the interval [0,1], the new values of this
signal, say v' are given by the formula
v' = λu + (1 - λ)v
where v is the previous value of v' and u is the new value
of v in sigAcq
.
sigAcq
- signal u to average into this one vdblWtFac
- weighting factor λ ∈ [0,1] for argument ujava.lang.IllegalArgumentException
- the provided signal is not the same size as this signalpublic java.lang.String dataLabel()
Signal
class.gov.sns.tools.data.DataListener#dataLabel()
public void update(DataAdaptor daptSrc) throws java.util.MissingResourceException, BadStructException
ScadaRecord
update
in interface DataListener
update
in class ScadaRecord
daptSrc
- The adaptor from which to update the datajava.util.MissingResourceException
- a data field was missing from the data sourceBadStructException
- data structure fields are ill-defined/incompatibleScadaRecord.update(xal.tools.data.DataAdaptor)
public void write(DataAdaptor daptSink) throws BadStructException
ScadaRecord
DataAdaptor
interface. Each value is stored
as the value of an attribute being the field name.write
in interface DataListener
write
in class ScadaRecord
daptSink
- The adaptor to which the receiver's data is writtenBadStructException
- data structure fields are ill-defined/incompatibleScadaRecord.write(xal.tools.data.DataAdaptor)
public java.lang.String toString()
toString
in class ScadaRecord
gov.sns.xal.smf.scada.ScadaRecord#toString()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class ScadaRecord
java.lang.CloneNotSupportedException
Object.clone()