public class ChannelAccessControlSystemSupport extends Object implements ControlSystemSupport<ChannelAccessSample>
Control-system support for Channel Access (CA) based control systems. Channel Access is the protocol used by EPICS 3.
This control-system support has a number of configuration options. When specified on the server-level (in the server's configuration file), these options are used as defaults when an option is not specified explicitly for a channel. All options in the configuration file use the "channelAccess" prefix (e.g. "controlSystem.channelAccess.monitorMask"). When specified for a channel, the option name has to be used without a prefix.
Option Name | Default Value | Description |
---|---|---|
clockSource |
prefer_origin |
Clock source used when archiving samples. Allowed values are
local , origin , and prefer_origin . When
using local , the time stamp sent with the value by the Channel
Access server is always discarded and the local clock (of the archiving
server) is used instead. When using origin , the time stamp
provided by the Channel Access server is used and the whole sample is
discarded when the maxClockSkew is exceeded. When
prefer_origin , the time stamp from the Channel Access server is
normally used, but it is replaced with a time stamp from the local clock when
the maxClockSkew is exceeded. |
enablingChannel |
not set | Channel that decides whether archiving is enabled or disabled. If the
enabling channel is not connected, archiving is disabled. If the enabling
channel is connected, archiving is enabled depending on the enabling
channel's value. When the enabling channel's value is of an integer type, the
target channel is enabled if the enabling channel's value is non-zero. If the
enabling channel's value is of a floating-point type, the target channel is
enabled when the enabling channel's value is neither zero nor not-a-number.
When the enabling channel's value is of a string type, the target channel is
enabled when the enabling channel's value is neither the empty string, nor
"0", "false", "no", or "off". Leading and trailing white-space is ignored for
this comparison and the comparison is not case sensitive. If this option is empty, archiving is always enabled. If a channel has been disabled in the archiving configuration, this option does not have any effect and archiving always stays disabled, even if an enabling channel is specified and indicates that archiving should be enabled. |
maxClockSkew |
30.0 | Maximum clock skew (in seconds). The specified value must be a finite,
non-negative floating point number. If zero, the clock skew check is
disabled, which mean that the time stamp provided by the Channel Access
server is always used (unless the clockSource is set to
local ). If not zero, the clock skew specifies the maximum
absolute difference that is allowed between the local clock and the time
stamp provided with a value by the Channel Access Server. When this limit is
exceeded, the exact behavior depends on the clockSource option.
When the clockSource option is set to origin , the
sample is discarded. When it is set to prefer_origin , the time
stamp is replaced with the time from the local clock. When it is
local , the maxClockSkew option does not have any
effect. |
maxUpdatePeriod |
0.0 | Maximum period between writing two samples (in seconds). The specified
value must be a finite, non-negative floating point number. If zero, the
maximum time between two samples is unbounded, meaning that a sample is only
written when a it arrives from the server. Due to processing delays, the
actual period between writing the two samples might be slightly greater than
the specified period. For obvious reasons, this time stamp is always
generated using the local system clock, regardless of the
clockSource setting. Please see the notes below before setting a
non-zero value for this option. |
metaDataMonitorMask |
property |
Monitor event mask used when monitoring channels for meta-data changes.
This mask can be overridden for individual channels. The following tokens
(separated by commas, pipes, or spaces) are supported: value ,
archive , alarm , property . Please refer
to the Channel Access Reference Manual for details about the meaning of this
mask bits. The event mask used when monitoring a channel for value changes is
specified separately through the monitorMask option. |
minUpdatePeriod |
0.0 | Minimum period between writing two samples (in seconds). The specified value must be a finite, non-negative floating point number. If samples arrive more quickly than the specified by the minimum update period, samples are dropped in order to get the effective update period above the specified threshold. If zero, the minimum time between two samples is unbounded, meaning that each sample that arrives from the server is written, even when samples arrive rapidly. However, for very high update rates, samples might still be lost if the system cannot process them as quickly as they arrive. |
monitorMask |
archive|alarm |
Monitor event mask used when monitoring channels for value changes. This
mask can be overridden for individual channels. The following tokens
(separated by commas, pipes, or spaces) are supported: value ,
archive , alarm , property . Please refer
to the Channel Access Reference Manual for details about the meaning of this
mask bits. The event mask used when monitoring a channel for meta-data
changes is specified separately through the metaDataMonitorMask
option. |
writeSampleWhenDisabled |
false |
Flag indicating whether a special marker sample should be written when a
channel is disabled. Possible values are true or
false . Please see the notes below before enabling this option. |
writeSampleWhenDisconnected |
false |
Flag indicating whether a special marker sample should be written when a
channel is disconnected. Possible values are true or
false . Please see the notes below before enabling this option. |
If the writeSampleWhenDisabled
option is set to
true
, a special sample acting as a marker for the disabled state
is written to the archive when a channel is disabled (because it is disabled
in the archive configuration or because a condition for enabling archiving is
not met). This way, one can tell from the archived data whether a value
simply did not change for an extended period of time or no samples where
written because archiving was disabled.
Similarly, if the writeSampleWhenDisconnected
option is set to
true
, a special sample acting as a marker for the disconnected
state is written to the archive when a channel disconnects (or cannot be
connected when the channel is initialized). This way, one can tell from the
archived data whether a value simply did not change for an extended period of
time or no updates could be received because the channel was not connected at
all.
Specifying a non-zero value for the maxUpdatePeriod
option has
the effect that a sample is repeated with an updated time-stamp when no other
sample is received within the specified period of time. This can help in
identifying whether a channel's value simply did not change or the server was
not running. However, decimated samples do not reflect this information,
meaning that decimated samples will look the same regardless of whether there
are no new samples for a prolonged period of time or whether the samples have
the same value. This means that this information will only be visible in the
raw samples.
For obvious reasons, there is no time from the origin when writing such a sample. Therefore, the local system-time on the archiving server is used for the sample's time-stamp. This has two possible effects: If the clock on the origin server is skewed into the future, the disconnect marker sample might be discarded because it will get a time stamp that is less than the time stamp of the most recent sample that has already been written. If the clock on the origin server is skewed into the past, the sample received when the channel reconnects might have a time stamp that is less than the time stamp of the disconnect marker sample and might thus be discarded, giving the impression that the channel was disabled or disconnected longer than it actually was and losing samples.
A similar problem might arise if the clocks are well-synchronized but the channel's time-stamp is only updated rarely (e.g. only when the channel's value changes in the backing hardware) and thus the sample sent when the channel reconnects has still the old time-stamp. In this case, no sample are lost, but from the archived data of the channel will look like the channel has been disabled or disconnected for a longer time (until a sample with a new time-stamp is sent).
For these reasons, this configuration option should only be enabled if the channel either uses the archive server's local system-clock as a time-stamp source or if the clocks are well synchronized and the channel's time-stamp is updated frequently.
Modifier and Type | Field and Description |
---|---|
static String |
CONFIGURATION_OPTION_PREFIX
Prefix used for configuration options in the server configuration.
|
static String |
IDENTIFIER
Identifier uniquely identifying this control-system support.
|
static String |
NAME
Human-readable name of this control-system support.
|
SAMPLES_LIMIT_UNBOUNDED
Constructor and Description |
---|
ChannelAccessControlSystemSupport(Map<String,String> configurationOptions,
Session session)
Creates an instance of the Channel Access control-system support.
|
public static final String CONFIGURATION_OPTION_PREFIX
public static final String IDENTIFIER
getId()
.public static final String NAME
public ChannelAccessControlSystemSupport(Map<String,String> configurationOptions, Session session)
ChannelAccessClient
. Most of the
Channel Access client's configuration is initialized from environment
variables (EPICS_CA_*
). Please refer to the EPICS Jackie
manual or the Channel Access Reference Manual for details.configurationOptions
- configuration options for this control-system support. Please
refer to this class's documentation for available
configuration options.session
- Cassandra session used for database operations.public ListenableFuture<ChannelAccessArchivingChannel> createChannel(String channelName, Map<String,String> options, SampleBucketId currentBucketId, SampleListener<ChannelAccessSample> sampleListener)
createChannel
in interface ControlSystemSupport<ChannelAccessSample>
public SampleDecimator<ChannelAccessSample> createSampleDecimator(String channelName, Map<String,String> options, long intervalStartTime, long intervalLength)
createSampleDecimator
in interface ControlSystemSupport<ChannelAccessSample>
public ListenableFuture<Void> deleteSamples(SampleBucketId bucketId)
deleteSamples
in interface ControlSystemSupport<ChannelAccessSample>
public void destroy()
destroy
in interface ControlSystemSupport<ChannelAccessSample>
public ListenableFuture<SampleWithSizeEstimate<ChannelAccessSample>> generateChannelDisabledSample(String channelName, Map<String,String> options, SampleBucketId currentBucketId)
generateChannelDisabledSample
in interface ControlSystemSupport<ChannelAccessSample>
public String getId()
getId
in interface ControlSystemSupport<ChannelAccessSample>
public String getName()
getName
in interface ControlSystemSupport<ChannelAccessSample>
public ListenableFuture<SampleBucketState> getSampleBucketState(SampleBucketId bucketId)
getSampleBucketState
in interface ControlSystemSupport<ChannelAccessSample>
public ListenableFuture<com.aquenos.cassandra.pvarchiver.common.ObjectResultSet<ChannelAccessSample>> getSamples(SampleBucketId bucketId, long timeStampGreaterThanOrEqualTo, long timeStampLessThanOrEqualTo, int limit)
getSamples
in interface ControlSystemSupport<ChannelAccessSample>
public ListenableFuture<com.aquenos.cassandra.pvarchiver.common.ObjectResultSet<ChannelAccessSample>> getSamplesInReverseOrder(SampleBucketId bucketId, long timeStampGreaterThanOrEqualTo, long timeStampLessThanOrEqualTo, int limit)
getSamplesInReverseOrder
in interface ControlSystemSupport<ChannelAccessSample>
public void serializeSampleToJsonV1(ChannelAccessSample sample, JsonGenerator jsonGenerator) throws IOException
serializeSampleToJsonV1
in interface ControlSystemSupport<ChannelAccessSample>
IOException
public ListenableFuture<Void> writeSample(ChannelAccessSample sample, SampleBucketId bucketId, int newBucketSize)
writeSample
in interface ControlSystemSupport<ChannelAccessSample>
Copyright © 2011–2016 aquenos GmbH. All rights reserved.