Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DTD-812 Use base implementation of InterpolatedValuesByCount #322

Merged
merged 6 commits into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions src/DBMDataRef/DBMDataRef.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1016,51 +1016,6 @@ Namespace Vitens.DynamicBandwidthMonitor
End Function


Public Overrides Function InterpolatedValuesByCount(
timeRange As AFTimeRange, numberOfValues As Integer,
filterExpression As String, includeFilteredValues As Boolean,
inputAttributes As AFAttributeList, inputValues As AFValues()) As AFValues

' https://docs.osisoft.com/bundle/af-sdk/page/html/M_OSIsoft_AF_Asset_AFDa
' taReference_InterpolatedValuesByCount.htm
' Retrieves interpolated values over the specified time range evenly
' spaced using the numberOfValues.

Dim interval As AFTimeSpan

DBM.Logger.LogDebug(
"timeRange.StartTime " &
timeRange.StartTime.LocalTime.ToString("s") & "; " &
"timeRange.EndTime " &
timeRange.EndTime.LocalTime.ToString("s") & "; " &
"numberOfValues " & numberOfValues.ToString, Attribute.GetPath)

InterpolatedValuesByCount = New AFValues
If timeRange.StartTime = timeRange.EndTime Or numberOfValues = 1 Then
' Return a single value.
InterpolatedValuesByCount.Add(
GetValue(Nothing, timeRange.StartTime, Nothing, Nothing))
Else
' Return multiple values.
interval = New AFTimeSpan(0, 0, 0, 0, 0,
(timeRange.EndTime.UtcSeconds-timeRange.StartTime.UtcSeconds)/
(numberOfValues-1), 0)
InterpolatedValuesByCount = Summaries(
New AFTimeRange(timeRange.StartTime, timeRange.EndTime+interval),
interval,
AFSummaryTypes.Average,
AFCalculationBasis.TimeWeighted,
AFTimestampCalculation.EarliestTime)(AFSummaryTypes.Average)
End If

DBM.Logger.LogTrace(
"Return " & InterpolatedValuesByCount.Count.ToString & " values",
Attribute.GetPath)
Return InterpolatedValuesByCount

End Function


End Class


Expand Down
Loading