UA Server SDK C++ Bundle
1.4.0.258
|
Calculates the value of an aggregate. More...
#include <aggregatecalculator.h>
Inherits AggregateCalculatorInterface.
Inherited by AggregateCalculatorAverage [private]
, AggregateCalculatorCount [private]
, AggregateCalculatorMinMax [private]
, AggregateCalculatorStartEnd [private]
, AggregateCalculatorStatus [private]
, and AggregateCalculatorStdDev [private]
.
Classes | |
struct | SubRegion |
A subset of a slice bounded by two raw data points. More... | |
struct | TimeSlice |
Stores information about a slice of data to be processed. More... | |
Public Member Functions | |
AggregateCalculator (UaNodeId aggregateId, UaDateTime startTime, UaDateTime endTime, double processingInterval, bool stepped, OpcUa_AggregateConfiguration &configuration) | |
Creates an aggregator with the passed AggregateId and configuration settings. More... | |
UaNodeId | GetAggregateId () |
The aggregate function applied by the calculator. More... | |
bool | QueueRawValue (UaDataValue value) |
Queues a raw value for processing. More... | |
UaDataValue | GetProcessedValue (bool returnPartial) |
Returns the next processed value. More... | |
bool | HasEndTimePassed (UaDateTime currentTime) |
Returns true if the specified time is later than the end of the current interval. More... | |
bool | UsesInterpolatedBounds () |
Indicates the this aggregate uses Interpolated Bounding Values. More... | |
Static Public Member Functions | |
static AggregateCalculatorInterface * | CreateCalculator (UaNodeId aggregateId, UaDateTime startTime, UaDateTime endTime, double processingInterval, bool stepped, OpcUa_AggregateConfiguration &configuration) |
Used by the Aggregators factory to create a new instance of the aggregate calculator. More... | |
Protected Types | |
enum | AggregateBits { Raw = 0x00, Calculated = 0x01, Interpolated = 0x02, DataSourceMask = 0x03, Partial = 0x04, ExtraData = 0x08, MultipleValues = 0x10 } |
AggregateBits enumeration. More... | |
Protected Member Functions | |
AggregateCalculator (UaNodeId aggregateId) | |
Creates an aggregator with the passed AggregateId and default configuration settings. More... | |
void | Initialize (UaNodeId aggregateId, UaDateTime startTime, UaDateTime endTime, double processingInterval, bool stepped, OpcUa_AggregateConfiguration &configuration) |
Initializes the calculation stream. More... | |
UaDateTime | GetStartTime () |
The start time for the request. More... | |
UaDateTime | GetEndTime () |
The end time for the request. More... | |
double | GetProcessingInterval () |
The processing interval for the request. More... | |
bool | GetStepped () |
True if the data series requires stepped interpolation. More... | |
void | GetConfiguration (OpcUa_AggregateConfiguration &returnValue) |
The configuration to use when processing. More... | |
bool | GetUseServerTimestamp () |
Whether to use the server timestamp for all processing. More... | |
bool | GetTimeFlowsBackward () |
True if data is being processed in reverse order. More... | |
void | GetCurrentSlice (TimeSlice &returnValue) |
More... | |
bool | GetComplete () |
True if all values required for the request have been received and processed More... | |
bool | GetUsingExtrapolation () |
True if data is extrapolated after the end of data. More... | |
bool | GetSetPartialBit () |
True if the GetProcessedValue method should set the Partial bit when appropriate. More... | |
void | SetSetPartialBit (bool value) |
int | CompareTimestamps (const UaDataValue value1, const UaDataValue value2) |
Compares timestamps for two DataValues according to the current UseServerTimestamp setting. More... | |
int | CompareTimestamps (UaDateTime value1, UaDataValue value2) |
Compares timestamps for a timestamp to a DataValue according to the current UseServerTimestamp setting. More... | |
bool | IsGood (UaDataValue value) |
Checks if the value is good according to the configuration rules. More... | |
OpcUa_StatusCode | SetCodeBits (OpcUa_StatusCode statusCode, unsigned int bits) |
Returns a status code with the bits pertaining to the code set. More... | |
OpcUa_StatusCode | GetCodeBits (OpcUa_StatusCode statusCode) |
Returns the code bits of the specified status code. More... | |
OpcUa_StatusCode | SetAggregateBits (OpcUa_StatusCode statusCode, unsigned int bits) |
Returns a status code with the bits pertaining to aggregates set. More... | |
OpcUa_StatusCode | GetAggregateBits (OpcUa_StatusCode statusCode) |
Returns the aggregate bits of the specified status code. More... | |
void | CreateSlice (TimeSlice &newSlice, UaDateTime previousStart, UaDateTime previousEnd) |
Creates a new time slice to process. More... | |
bool | UpdateSlice (TimeSlice &slice) |
Creates a new time slice to process. More... | |
virtual UaDataValue | ComputeValue (TimeSlice &slice) |
Calculates the value for the timeslice. More... | |
UaDataValue | Interpolate (TimeSlice &slice) |
Calculate the interpolate aggregate for the timeslice. More... | |
UaDataValue | GetNoDataValue (TimeSlice slice) |
Return a value indicating there is no data in the time slice. More... | |
UaDateTime | GetTimestamp (TimeSlice slice) |
Returns the timestamp to use for the slice value. More... | |
UaDataValue | GetNoDataValue (UaDateTime timestamp) |
Return a value indicating there is no data in the time slice. More... | |
UaDataValue | Interpolate (UaDateTime timestamp) |
Interpolates a value at the timestamp. More... | |
UaDataValue | SteppedInterpolate (UaDateTime timestamp, UaDataValue earlyBound) |
Calculate the value at the timestamp using slopped interpolation. More... | |
UaDataValue | SlopedInterpolate (UaDateTime timestamp, UaDataValue earlyBound, UaDataValue lateBound) |
Calculate the value at the timestamp using slopped interpolation. More... | |
double | CastToDouble (UaDataValue value) |
Converts the value to a double for use in calculations (throws exceptions if conversion fails). More... | |
UaDataValue | GetSimpleBound (UaDateTime timestamp, TimeSlice &slice) |
Returns the simple bound for the timestamp. More... | |
void | GetValuesWithSimpleBounds (TimeSlice &slice, std::list< UaDataValue > &returnList) |
Returns the values in the list with simple bounds. More... | |
bool | GetValues (TimeSlice &slice, std::list< UaDataValue > &returnList) |
Returns the values between the start time and the end time for the slice. More... | |
void | GetValuesWithInterpolatedBounds (TimeSlice &slice, std::list< UaDataValue > &returnList) |
Returns the values in the list with interpolated bounds. More... | |
void | GetRegionsInValueSet (std::list< UaDataValue > &values, bool ignoreBadData, bool useSteppedCalculations, std::list< SubRegion > &returnList) |
Returns the values in the list with simple bounds. More... | |
UaStatusCode | GetValueBasedStatusCode (TimeSlice &slice, std::list< UaDataValue > &values, UaStatusCode statusCode) |
Calculates the value based status code for the slice More... | |
UaStatusCode | GetTimeBasedStatusCode (TimeSlice &slice, std::list< UaDataValue > &values, UaStatusCode defaultCode) |
Calculates the status code for the slice More... | |
UaStatusCode | GetTimeBasedStatusCode (std::list< SubRegion > ®ions, UaStatusCode statusCode) |
Calculates the status code for the slice More... | |
Protected Attributes | |
std::list< UaDataValue > | mValues |
Calculates the value of an aggregate.
|
protected |
AggregateBits enumeration.
AggregateCalculator::AggregateCalculator | ( | UaNodeId | aggregateId, |
UaDateTime | startTime, | ||
UaDateTime | endTime, | ||
double | processingInterval, | ||
bool | stepped, | ||
OpcUa_AggregateConfiguration & | configuration | ||
) |
Creates an aggregator with the passed AggregateId and configuration settings.
[in] | aggregateId | The aggregate function to apply. |
[in] | startTime | The start time. |
[in] | endTime | The end time. |
[in] | processingInterval | The processing interval. |
[in] | stepped | Whether to use stepped interpolation. |
[in] | configuration | The aggregate configuration. |
|
protected |
Creates an aggregator with the passed AggregateId and default configuration settings.
[in] | aggregateId | The aggregate function to apply. |
|
protected |
Converts the value to a double for use in calculations (throws exceptions if conversion fails).
|
protected |
Compares timestamps for two DataValues according to the current UseServerTimestamp setting.
value1 | The first value to compare. |
value2 | The second value to compare. |
|
protected |
Compares timestamps for a timestamp to a DataValue according to the current UseServerTimestamp setting.
value1 | The timestamp to compare. |
value2 | The data value to compare. |
|
protectedvirtual |
Calculates the value for the timeslice.
slice | The slice to process. |
Reimplemented in AggregateCalculatorAverage, AggregateCalculatorCount, AggregateCalculatorMinMax, AggregateCalculatorStartEnd, AggregateCalculatorStatus, and AggregateCalculatorStdDev.
|
static |
Used by the Aggregators factory to create a new instance of the aggregate calculator.
[in] | aggregateId | The aggregate function to apply. |
[in] | startTime | The start time. |
[in] | endTime | The end time. |
[in] | processingInterval | The processing interval. |
[in] | stepped | Whether to use stepped interpolation. |
[in] | configuration | The aggregate configuration. |
|
protected |
Creates a new time slice to process.
newSlice | The slice. |
previousStart | The previous start time. |
previousEnd | The previous end time. |
|
inlineprotected |
Returns the aggregate bits of the specified status code.
statusCode | The original code. |
|
inlinevirtual |
The aggregate function applied by the calculator.
Implements AggregateCalculatorInterface.
|
inlineprotected |
Returns the code bits of the specified status code.
statusCode | The original code. |
|
inlineprotected |
True if all values required for the request have been received and processed
|
inlineprotected |
The configuration to use when processing.
|
protected |
|
inlineprotected |
The end time for the request.
|
protected |
Return a value indicating there is no data in the time slice.
|
protected |
Return a value indicating there is no data in the time slice.
|
virtual |
Returns the next processed value.
returnPartial | If true a partial interval should be processed. |
Implements AggregateCalculatorInterface.
|
inlineprotected |
The processing interval for the request.
|
protected |
Returns the values in the list with simple bounds.
|
inlineprotected |
True if the GetProcessedValue method should set the Partial bit when appropriate.
|
protected |
Returns the simple bound for the timestamp.
|
inlineprotected |
The start time for the request.
|
inlineprotected |
True if the data series requires stepped interpolation.
|
protected |
Calculates the status code for the slice
|
protected |
Calculates the status code for the slice
|
inlineprotected |
True if data is being processed in reverse order.
|
protected |
Returns the timestamp to use for the slice value.
|
inlineprotected |
Whether to use the server timestamp for all processing.
|
inlineprotected |
True if data is extrapolated after the end of data.
|
protected |
Calculates the value based status code for the slice
|
protected |
Returns the values between the start time and the end time for the slice.
|
protected |
Returns the values in the list with interpolated bounds.
|
protected |
Returns the values in the list with simple bounds.
|
virtual |
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 AggregateCalculatorInterface.
|
protected |
Initializes the calculation stream.
[in] | aggregateId | The aggregate function to apply. |
[in] | startTime | The start time. |
[in] | endTime | The end time. |
[in] | processingInterval | The processing interval. |
[in] | stepped | Whether to use stepped interpolation. |
[in] | configuration | The aggregate configuration. |
|
protected |
Calculate the interpolate aggregate for the timeslice.
|
protected |
Interpolates a value at the timestamp.
timestamp | The timestamp. |
|
protected |
Checks if the value is good according to the configuration rules.
value | The value to test. |
|
virtual |
Queues a raw value for processing.
[in] | value | The data value to process. |
Implements AggregateCalculatorInterface.
|
inlineprotected |
Returns a status code with the bits pertaining to aggregates set.
statusCode | The original code to modify. |
bits | The bits to change. |
|
inlineprotected |
Returns a status code with the bits pertaining to the code set.
statusCode | The original code to modify. |
bits | The bits to change. |
|
protected |
Calculate the value at the timestamp using slopped interpolation.
|
protected |
Calculate the value at the timestamp using slopped interpolation.
|
protected |
Creates a new time slice to process.
slice | The slice to update. |
|
virtual |
Indicates the this aggregate uses Interpolated Bounding Values.
Implements AggregateCalculatorInterface.
Reimplemented in AggregateCalculatorAverage, AggregateCalculatorCount, AggregateCalculatorMinMax, AggregateCalculatorStartEnd, and AggregateCalculatorStatus.