C++ UA Server SDK
1.5.0.318
|
Calculates the value of an interpolative 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) |
Indicates whether the specified time is later than the end time of the current interval. More... | |
bool | UsesInterpolatedBounds () |
Indicates whether 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... | |
bool | GetComplete () |
True if all values required for the request have been received and processed. | |
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... | |
int | CompareTimestamps (const UaDataValue value1, const UaDataValue value2) |
Compares timestamps stored as UaDataValues according to the current UseServerTimestamp setting. More... | |
int | CompareTimestamps (UaDateTime value1, UaDataValue value2) |
Compares a timestamps stored as UaDateTime to a timestamp stored as 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 timeslice to process. More... | |
bool | UpdateSlice (TimeSlice &slice) |
Updates the timeslice to process. More... | |
virtual UaDataValue | ComputeValue (TimeSlice &slice) |
Calculates the value for the timeslice. More... | |
UaDataValue | GetNoDataValue (TimeSlice slice) |
Returns a value indicating that there is no data in the timeslice. More... | |
UaDateTime | GetTimestamp (TimeSlice slice) |
Returns the timestamp to use for the slice value. More... | |
UaDataValue | GetNoDataValue (UaDateTime timestamp) |
Returns a value indicating that there is no data in the timeslice. More... | |
UaDataValue | Interpolate (UaDateTime timestamp) |
Interpolates a value at the timestamp. More... | |
UaDataValue | SteppedInterpolate (UaDateTime timestamp, UaDataValue earlyBound) |
Calculates the value at the timestamp using stepped interpolation. More... | |
UaDataValue | SlopedInterpolate (UaDateTime timestamp, UaDataValue earlyBound, UaDataValue lateBound) |
Calculates the value at the timestamp using sloped 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. | |
UaStatusCode | GetTimeBasedStatusCode (TimeSlice &slice, std::list< UaDataValue > &values, UaStatusCode defaultCode) |
Calculates the status code for the slice. | |
UaStatusCode | GetTimeBasedStatusCode (std::list< SubRegion > ®ions, UaStatusCode statusCode) |
Calculates the status code for the slice. | |
Calculates the value of an interpolative 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 stored as UaDataValues according to the current UseServerTimestamp setting.
value1 | The first value to compare. |
value2 | The second value to compare. |
|
protected |
Compares a timestamps stored as UaDateTime to a timestamp stored as 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 AggregateCalculatorMinMax, AggregateCalculatorAverage, AggregateCalculatorCount, 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 timeslice 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 |
The configuration to use when processing.
|
inlineprotected |
The end time for the request.
|
protected |
Returns a value indicating that there is no data in the timeslice.
|
protected |
Returns a value indicating that there is no data in the timeslice.
|
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.
|
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 |
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 |
Indicates whether the specified time is later than the end time of the current interval.
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 |
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 |
Calculates the value at the timestamp using sloped interpolation.
|
protected |
Calculates the value at the timestamp using stepped interpolation.
|
protected |
Updates the timeslice to process.
slice | The slice to update. |
|
virtual |
Indicates whether this aggregate uses Interpolated Bounding Values.
Implements AggregateCalculatorInterface.
Reimplemented in AggregateCalculatorMinMax, AggregateCalculatorAverage, AggregateCalculatorCount, AggregateCalculatorStartEnd, and AggregateCalculatorStatus.