Class MonitoredValue
- All Implemented Interfaces:
Runnable
The history of samples needed to apply the filter is part
of the filter itself because its management depends on the filter.
For example a filter that returns only the last received value needs to save
a history with only that sample, but a filter that averages the values acquired
in the last minute needs a longer history even if its refresh rate is
much shorter then the averaging period.
The MonitoredValue main tasks are:
- receive the values (samples, in ((
submitSample(Sample)
)) of the monitor point generated by the monitored control system and apply the filter to generate the value, aValueToSend
, to send to the IAS - if the value has not been sent to the IAS when the refresh time interval elapses, send the value again to the core
The MonitoredValue
sends the value to the listener
, that
will send it to the core of the IAS:
- immediately if the generated value changed
- periodically by a timer task.
run()
resend to the core the last value sent.
Note that he periodic sending time interval is a global parameter of the plugin (of the IAS, actually) and must not be confused with the
refreshRate
of the monitor point that is the time interval
that the monitor point is refreshed by the device.
The validity depends on the time when the value has been produced by the remote
system against the refresh rate and the actual time: the IAS periodic sending
of the value does not play a role in the assessment of the validity.- Author:
- acaproni
-
Field Summary
Modifier and TypeFieldDescriptionfinal int
The periodic time interval to automatically send the last computed value to the BSDBfinal String
The ID of the monitored valuestatic final long
TherefreshRate
of the monitored can be dynamically changed but can never be less than the allowed minimum.long
The actual refresh rate (msec) of this monitored value: the value depends on the time when the device provides a new value and it is used to evaluate the validitystatic final long
The delta time error in msec, to take into account chacking if a value is valid.static final String
The name of the property to set the delta time error -
Constructor Summary
ConstructorDescriptionMonitoredValue
(String id, long refreshRate, ScheduledExecutorService executorSvc, ChangeValueListener listener, int iasPeriodicSendingTime) Build aMonitoredValue
with the default filter,NoneFilter
MonitoredValue
(String id, long refreshRate, Filter filter, ScheduledExecutorService executorSvc, ChangeValueListener listener, int iasPeriodicSendingTime) Build aMonitoredValue
with the passed filter -
Method Summary
Modifier and TypeMethodDescriptionvoid
enablePeriodicNotification
(boolean enable) Enable or disable the periodic sending of notifications.Get and return the value to send i.e.void
run()
The timer task scheduled when the refresh time interval elapses.setOperationalMode
(OperationalMode opMode) Set the operational mode of this monitor point value.long
setRefreshRate
(long newRefreshRate) Set the new refresh rate for the monitored value with the given identifier.void
shutdown()
Stops the periodic thread and release all the resourcesvoid
start()
Start the MonitorValue basically activating the timer threadvoid
Adds a new sample to this monitor point.
-
Field Details
-
id
The ID of the monitored value -
minAllowedSendRate
public static final long minAllowedSendRateTherefreshRate
of the monitored can be dynamically changed but can never be less than the allowed minimum.- See Also:
-
validityDeltaPropName
The name of the property to set the delta time error- See Also:
-
validityDelta
public static final long validityDeltaThe delta time error in msec, to take into account chacking if a value is valid. -
refreshRate
public long refreshRateThe actual refresh rate (msec) of this monitored value: the value depends on the time when the device provides a new value and it is used to evaluate the validity -
iasPeriodicSendingTime
public final int iasPeriodicSendingTimeThe periodic time interval to automatically send the last computed value to the BSDB
-
-
Constructor Details
-
MonitoredValue
public MonitoredValue(String id, long refreshRate, Filter filter, ScheduledExecutorService executorSvc, ChangeValueListener listener, int iasPeriodicSendingTime) Build aMonitoredValue
with the passed filter- Parameters:
id
- The identifier of the valuerefreshRate
- The refresh time interval of the device (in msec)filter
- The filter to apply to the samplesexecutorSvc
- The executor to schedule the threadlistener
- The listener of updatesiasPeriodicSendingTime
- The time interval (secs) to periodically send the last computed value to the BSDB
-
MonitoredValue
public MonitoredValue(String id, long refreshRate, ScheduledExecutorService executorSvc, ChangeValueListener listener, int iasPeriodicSendingTime) Build aMonitoredValue
with the default filter,NoneFilter
- Parameters:
id
- The identifier of the valuerefreshRate
- The refresh time intervalexecutorSvc
- The executor to schedule the threadlistener
- The listeneriasPeriodicSendingTime
- The time interval (secs) to periodically send the last computed value to the BSDB
-
-
Method Details
-
getValueTosend
Get and return the value to send i.e. the value generated applying thefilter
to the #history of samples.- Returns:
- The value to send
-
submitSample
Adds a new sample to this monitor point.- Parameters:
s
- The not-null sample to add to the monitored value- Throws:
FilterException
- If the submitted sample caused an exception in the filter
-
run
public void run()The timer task scheduled when the refresh time interval elapses. -
setRefreshRate
public long setRefreshRate(long newRefreshRate) Set the new refresh rate for the monitored value with the given identifier.This method sets the refresh rate at which the monitored value is retrieved from the remote monitored system and not the time the value is periodically sent to the BSDB if its value did not change.
Setting this value affects the evaluation of the validity.
- Parameters:
newRefreshRate
- The new refresh rate (msecs), must be greater thenminAllowedSendRate
- Returns:
- The new refresh rate (msec)
-
enablePeriodicNotification
public void enablePeriodicNotification(boolean enable) Enable or disable the periodic sending of notifications.- Parameters:
enable
- iftrue
enables the periodic sending;
-
setOperationalMode
Set the operational mode of this monitor point value.Note that this value is effectively sent to the core of the IAS only if not overridden by the plugin operational mode
- Parameters:
opMode
- The notnull
operational mode to set- Returns:
- The old operational mode of the monitor point
-
start
public void start()Start the MonitorValue basically activating the timer thread -
shutdown
public void shutdown()Stops the periodic thread and release all the resources
-