UA Bundle SDK .NET  2.2.3.276
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Groups Pages
UnifiedAutomation.UaServer.AggregateCalculator Class Reference

Calculates the value of an aggregate. More...

Inherits UnifiedAutomation.UaServer.IAggregateCalculator.

Inherited by UnifiedAutomation.UaServer.AverageAggregateCalculator, UnifiedAutomation.UaServer.CountAggregateCalculator, UnifiedAutomation.UaServer.MinMaxAggregateCalculator, UnifiedAutomation.UaServer.StartEndAggregateCalculator, UnifiedAutomation.UaServer.StatusAggregateCalculator, and UnifiedAutomation.UaServer.StdDevAggregateCalculator.

Classes

class  SubRegion
 A subset of a slice bounded by two raw data points. More...
 
class  TimeSlice
 Stores information about a slice of data to be processed. More...
 

Public Member Functions

 AggregateCalculator (NodeId aggregateId, DateTime startTime, DateTime endTime, double processingInterval, bool stepped, AggregateConfiguration configuration)
 Initializes the calculation stream. More...
 
bool QueueRawValue (DataValue value)
 Queues a raw value for processing. More...
 
DataValue GetProcessedValue (bool returnPartial)
 Returns the next processed value. More...
 
bool HasEndTimePassed (DateTime currentTime)
 Returns true if the specified time is later than the end of the current interval. More...
 

Static Public Member Functions

static DataValue SteppedInterpolate (DateTime timestamp, DataValue earlyBound)
 Calculate the value at the timestamp using slopped interpolation. More...
 
static DataValue SlopedInterpolate (DateTime timestamp, DataValue earlyBound, DataValue lateBound)
 Calculate the value at the timestamp using slopped interpolation. More...
 

Protected Member Functions

 AggregateCalculator (NodeId aggregateId)
 Creates a default aggregator. More...
 
void Initialize (NodeId aggregateId, DateTime startTime, DateTime endTime, double processingInterval, bool stepped, AggregateConfiguration configuration)
 Initializes the calculation stream. More...
 
int CompareTimestamps (DataValue value1, DataValue value2)
 Compares timestamps for two DataValues according to the current UseServerTimestamp setting. More...
 
int CompareTimestamps (DataValue value1, LinkedListNode< DataValue > value2)
 Compares timestamps for two DataValues according to the current UseServerTimestamp setting. More...
 
int CompareTimestamps (LinkedListNode< DataValue > value1, LinkedListNode< DataValue > value2)
 Compares timestamps for two DataValues according to the current UseServerTimestamp setting. More...
 
int CompareTimestamps (DateTime value1, LinkedListNode< DataValue > value2)
 Compares timestamps for a timestamp to a DataValue according to the current UseServerTimestamp setting. More...
 
bool IsGood (DataValue value)
 Checks if the value is good according to the configuration rules. More...
 
TimeSlice CreateSlice (TimeSlice previousSlice)
 Creates a new time slice to process. More...
 
bool UpdateSlice (TimeSlice slice)
 Creates a new time slice to process. More...
 
virtual DataValue ComputeValue (TimeSlice slice)
 Calculates the value for the timeslice. More...
 
DataValue Interpolate (TimeSlice slice)
 Calculate the interpolate aggregate for the timeslice. More...
 
DataValue GetNoDataValue (TimeSlice slice)
 Return a value indicating there is no data in the time slice. More...
 
DateTime GetTimestamp (TimeSlice slice)
 Returns the timestamp to use for the slice value. More...
 
DataValue GetNoDataValue (DateTime timestamp)
 Return a value indicating there is no data in the time slice. More...
 
DataValue Interpolate (DateTime timestamp, TimeSlice reference)
 Interpolates a value at the timestamp. More...
 
DataValue GetSimpleBound (DateTime timestamp, TimeSlice slice)
 Returns the simple bound for the timestamp. More...
 
List< DataValueGetValuesWithSimpleBounds (TimeSlice slice)
 Returns the values in the list with simple bounds. More...
 
List< DataValueGetValues (TimeSlice slice)
 Returns the values between the start time and the end time for the slice. More...
 
List< DataValueGetValuesWithInterpolatedBounds (TimeSlice slice)
 Returns the values in the list with interpolated bounds. More...
 
List< SubRegionGetRegionsInValueSet (List< DataValue > values, bool ignoreBadData, bool useSteppedCalculations)
 Returns the values in the list with simple bounds. More...
 
StatusCode GetValueBasedStatusCode (TimeSlice slice, List< DataValue > values, StatusCode statusCode)
 Calculates the value based status code for the slice More...
 
StatusCode GetTimeBasedStatusCode (TimeSlice slice, List< DataValue > values, StatusCode defaultCode)
 Calculates the status code for the slice More...
 
StatusCode GetTimeBasedStatusCode (List< SubRegion > regions, StatusCode statusCode)
 Calculates the status code for the slice More...
 

Static Protected Member Functions

static double CastToDouble (DataValue value)
 Converts the value to a double for use in calculations (throws exceptions if conversion fails). More...
 
static Variant CastToOriginalType (double value, DataValue original)
 Converts the value back to its original type (throws exceptions if conversion fails). More...
 

Properties

NodeId AggregateId [get, set]
 The aggregate function applied by the calculator. More...
 
DateTime StartTime [get, set]
 The start time for the request. More...
 
DateTime EndTime [get, set]
 The end time for the request. More...
 
double ProcessingInterval [get, set]
 The processing interval for the request. More...
 
bool Stepped [get, set]
 True if the data series requires stepped interpolation. More...
 
AggregateConfiguration Configuration [get, set]
 The configuration to use when processing. More...
 
bool UseServerTimestamp [get, set]
 Whether to use the server timestamp for all processing. More...
 
bool TimeFlowsBackward [get, set]
 True if data is being processed in reverse order. More...
 
TimeSlice CurrentSlice [get, set]
 Whether to use the server timestamp for all processing. More...
 
bool Complete [get, set]
 True if all values required for the request have been received and processed More...
 
bool SetPartialBit [get, set]
 True if the GetProcessedValue method should set the Partial bit when appropriate. More...
 
bool UsingExtrapolation [get, set]
 True if data is extrapolated after the end of data. More...
 
- Properties inherited from UnifiedAutomation.UaServer.IAggregateCalculator
NodeId AggregateId [get]
 The aggregate function applied by the calculator. More...
 

Detailed Description

Calculates the value of an aggregate.

Constructor & Destructor Documentation

UnifiedAutomation.UaServer.AggregateCalculator.AggregateCalculator ( NodeId  aggregateId)
inlineprotected

Creates a default aggregator.

UnifiedAutomation.UaServer.AggregateCalculator.AggregateCalculator ( NodeId  aggregateId,
DateTime  startTime,
DateTime  endTime,
double  processingInterval,
bool  stepped,
AggregateConfiguration  configuration 
)
inline

Initializes the calculation stream.

Parameters
aggregateIdThe aggregate function to apply.
startTimeThe start time.
endTimeThe end time.
processingIntervalThe processing interval.
steppedWhether to use stepped interpolation.
configurationThe aggregate configuration.

Member Function Documentation

static double UnifiedAutomation.UaServer.AggregateCalculator.CastToDouble ( DataValue  value)
inlinestaticprotected

Converts the value to a double for use in calculations (throws exceptions if conversion fails).

static Variant UnifiedAutomation.UaServer.AggregateCalculator.CastToOriginalType ( double  value,
DataValue  original 
)
inlinestaticprotected

Converts the value back to its original type (throws exceptions if conversion fails).

int UnifiedAutomation.UaServer.AggregateCalculator.CompareTimestamps ( DataValue  value1,
DataValue  value2 
)
inlineprotected

Compares timestamps for two DataValues according to the current UseServerTimestamp setting.

Parameters
value1The first value to compare.
value2The second value to compare.
Returns
Less than 0 if value1 is earlier than value2; 0 if they are equal; Greater than zero otherwise.
int UnifiedAutomation.UaServer.AggregateCalculator.CompareTimestamps ( DataValue  value1,
LinkedListNode< DataValue value2 
)
inlineprotected

Compares timestamps for two DataValues according to the current UseServerTimestamp setting.

Parameters
value1The first value to compare.
value2The second value to compare.
Returns
Less than 0 if value1 is earlier than value2; 0 if they are equal; Greater than zero otherwise.
int UnifiedAutomation.UaServer.AggregateCalculator.CompareTimestamps ( LinkedListNode< DataValue value1,
LinkedListNode< DataValue value2 
)
inlineprotected

Compares timestamps for two DataValues according to the current UseServerTimestamp setting.

Parameters
value1The first value to compare.
value2The second value to compare.
Returns
Less than 0 if value1 is earlier than value2; 0 if they are equal; Greater than zero otherwise.
int UnifiedAutomation.UaServer.AggregateCalculator.CompareTimestamps ( DateTime  value1,
LinkedListNode< DataValue value2 
)
inlineprotected

Compares timestamps for a timestamp to a DataValue according to the current UseServerTimestamp setting.

Parameters
value1The timestamp to compare.
value2The data value to compare.
Returns
Less than 0 if value1 is earlier than value2; 0 if they are equal; Greater than zero otherwise.
virtual DataValue UnifiedAutomation.UaServer.AggregateCalculator.ComputeValue ( TimeSlice  slice)
inlineprotectedvirtual
TimeSlice UnifiedAutomation.UaServer.AggregateCalculator.CreateSlice ( TimeSlice  previousSlice)
inlineprotected

Creates a new time slice to process.

Parameters
previousSliceThe previous processed slice.
Returns
The new time slice.
DataValue UnifiedAutomation.UaServer.AggregateCalculator.GetNoDataValue ( TimeSlice  slice)
inlineprotected

Return a value indicating there is no data in the time slice.

DataValue UnifiedAutomation.UaServer.AggregateCalculator.GetNoDataValue ( DateTime  timestamp)
inlineprotected

Return a value indicating there is no data in the time slice.

DataValue UnifiedAutomation.UaServer.AggregateCalculator.GetProcessedValue ( bool  returnPartial)
inline

Returns the next processed value.

Parameters
returnPartialIf true a partial interval should be processed.
Returns
The processed value. Null if nothing available and returnPartial is false.

Implements UnifiedAutomation.UaServer.IAggregateCalculator.

List<SubRegion> UnifiedAutomation.UaServer.AggregateCalculator.GetRegionsInValueSet ( List< DataValue values,
bool  ignoreBadData,
bool  useSteppedCalculations 
)
inlineprotected

Returns the values in the list with simple bounds.

DataValue UnifiedAutomation.UaServer.AggregateCalculator.GetSimpleBound ( DateTime  timestamp,
TimeSlice  slice 
)
inlineprotected

Returns the simple bound for the timestamp.

StatusCode UnifiedAutomation.UaServer.AggregateCalculator.GetTimeBasedStatusCode ( TimeSlice  slice,
List< DataValue values,
StatusCode  defaultCode 
)
inlineprotected

Calculates the status code for the slice

StatusCode UnifiedAutomation.UaServer.AggregateCalculator.GetTimeBasedStatusCode ( List< SubRegion regions,
StatusCode  statusCode 
)
inlineprotected

Calculates the status code for the slice

DateTime UnifiedAutomation.UaServer.AggregateCalculator.GetTimestamp ( TimeSlice  slice)
inlineprotected

Returns the timestamp to use for the slice value.

StatusCode UnifiedAutomation.UaServer.AggregateCalculator.GetValueBasedStatusCode ( TimeSlice  slice,
List< DataValue values,
StatusCode  statusCode 
)
inlineprotected

Calculates the value based status code for the slice

List<DataValue> UnifiedAutomation.UaServer.AggregateCalculator.GetValues ( TimeSlice  slice)
inlineprotected

Returns the values between the start time and the end time for the slice.

List<DataValue> UnifiedAutomation.UaServer.AggregateCalculator.GetValuesWithInterpolatedBounds ( TimeSlice  slice)
inlineprotected

Returns the values in the list with interpolated bounds.

List<DataValue> UnifiedAutomation.UaServer.AggregateCalculator.GetValuesWithSimpleBounds ( TimeSlice  slice)
inlineprotected

Returns the values in the list with simple bounds.

bool UnifiedAutomation.UaServer.AggregateCalculator.HasEndTimePassed ( DateTime  currentTime)
inline

Returns true if the specified time is later than the end of the current interval.

Return true if time flows forward and the time is later than the end time.

Implements UnifiedAutomation.UaServer.IAggregateCalculator.

void UnifiedAutomation.UaServer.AggregateCalculator.Initialize ( NodeId  aggregateId,
DateTime  startTime,
DateTime  endTime,
double  processingInterval,
bool  stepped,
AggregateConfiguration  configuration 
)
inlineprotected

Initializes the calculation stream.

Parameters
aggregateIdThe aggregate function to apply.
startTimeThe start time.
endTimeThe end time.
processingIntervalThe processing interval.
steppedWhether to use stepped interpolation.
configurationThe aggregate configuration.
DataValue UnifiedAutomation.UaServer.AggregateCalculator.Interpolate ( TimeSlice  slice)
inlineprotected

Calculate the interpolate aggregate for the timeslice.

DataValue UnifiedAutomation.UaServer.AggregateCalculator.Interpolate ( DateTime  timestamp,
TimeSlice  reference 
)
inlineprotected

Interpolates a value at the timestamp.

Parameters
timestampThe timestamp.
referenceThe timeslice that contains the timestamp.
Returns
The interpolated value.
bool UnifiedAutomation.UaServer.AggregateCalculator.IsGood ( DataValue  value)
inlineprotected

Checks if the value is good according to the configuration rules.

Parameters
valueThe value to test.
Returns
True if the value is good.
bool UnifiedAutomation.UaServer.AggregateCalculator.QueueRawValue ( DataValue  value)
inline

Queues a raw value for processing.

Parameters
valueThe data value to process.
Returns
True if successful, false if the timestamp has been superceeded by values already in the stream.

Implements UnifiedAutomation.UaServer.IAggregateCalculator.

static DataValue UnifiedAutomation.UaServer.AggregateCalculator.SlopedInterpolate ( DateTime  timestamp,
DataValue  earlyBound,
DataValue  lateBound 
)
inlinestatic

Calculate the value at the timestamp using slopped interpolation.

static DataValue UnifiedAutomation.UaServer.AggregateCalculator.SteppedInterpolate ( DateTime  timestamp,
DataValue  earlyBound 
)
inlinestatic

Calculate the value at the timestamp using slopped interpolation.

bool UnifiedAutomation.UaServer.AggregateCalculator.UpdateSlice ( TimeSlice  slice)
inlineprotected

Creates a new time slice to process.

Parameters
sliceThe slice to update.
Returns
True if the slice is complete.

Property Documentation

NodeId UnifiedAutomation.UaServer.AggregateCalculator.AggregateId
getset

The aggregate function applied by the calculator.

bool UnifiedAutomation.UaServer.AggregateCalculator.Complete
getsetprotected

True if all values required for the request have been received and processed

AggregateConfiguration UnifiedAutomation.UaServer.AggregateCalculator.Configuration
getsetprotected

The configuration to use when processing.

TimeSlice UnifiedAutomation.UaServer.AggregateCalculator.CurrentSlice
getsetprotected

Whether to use the server timestamp for all processing.

DateTime UnifiedAutomation.UaServer.AggregateCalculator.EndTime
getsetprotected

The end time for the request.

double UnifiedAutomation.UaServer.AggregateCalculator.ProcessingInterval
getsetprotected

The processing interval for the request.

bool UnifiedAutomation.UaServer.AggregateCalculator.SetPartialBit
getsetprotected

True if the GetProcessedValue method should set the Partial bit when appropriate.

DateTime UnifiedAutomation.UaServer.AggregateCalculator.StartTime
getsetprotected

The start time for the request.

bool UnifiedAutomation.UaServer.AggregateCalculator.Stepped
getsetprotected

True if the data series requires stepped interpolation.

bool UnifiedAutomation.UaServer.AggregateCalculator.TimeFlowsBackward
getsetprotected

True if data is being processed in reverse order.

bool UnifiedAutomation.UaServer.AggregateCalculator.UseServerTimestamp
getsetprotected

Whether to use the server timestamp for all processing.

bool UnifiedAutomation.UaServer.AggregateCalculator.UsingExtrapolation
getsetprotected

True if data is extrapolated after the end of data.


The documentation for this class was generated from the following file: