I'm working on an ACE calculation that does a time-weighted average of total discharge over a period of 24 hours. The calculation period is from 12:00 PM today to 11.59 AM tomm . The calculation should reset the PI tag value to zero at noon every day. How do I accomplish this? My current logic doesn't seem to work for all time stamps:
Dim startTime As PITime = Noon(Me.ExeTime)
Dim startTimeUTC As AFTime = New AFTime(startTime.UTCSeconds)
If (lastCalculationTime.UtcSeconds >= startTimeUTC ) Then 'Check if lastCalculationTime in UTC is less than UTC second at noon
lastCalculationTime = startTimeUTC
lastCalculatedValue = 0.0
Any assistance is truly appreciated.