TimeStamps for Monthly Avg ACE calc

Discussion created by ccheno on Oct 31, 2011
Latest reply on Oct 31, 2011 by Ahmad Fattahi

Sorry if this has been covered, but I could not find thread (that stood out, to me anyway, as discussing this).


I'm new to ACE and new to programming. So, as you can expect, I need lots of help. What I'm needing to do is create ACE calc's that only run of the first of the month, average past months values, do some data conversions, then eventuall output those results.


What I'm having trouble with:

  • Identifying when day of the month is 1 to trigger the calculation. Syntax that works for Performance Equations and Totalizer doesn't work in .NET.
  • WHen calc does run, need my Average calls StartTime, EndTime to be the first of previous month / first of current month (ie; 1-sep-2011 00:00:00, 1-Oct-2011 00:00:00)

What I've come up with so, kind of works, but doesn't appear to be be exactly mid-night on the first of each month. When I run test and compare result with hard coded timestamps, the values are not the same. Not understanding the time calls, I'm really sure what timestamps I actually passing with this.


 Dim pt As New PITimeServer.PITimeFormat()
        pt.UTCSeconds = Me.ExeTime


        If pt.LocalDate.Day = 31 Then
            CoryTestFloat32.Value = SINUSOID.Total(pt.LocalDate.AddMonths(-1), pt.LocalDate)
            CoryTestTag.Value = SINUSOID.Total("1-sep-2011", "1-oct-2011")
        End If


Appreciate any help and input you can provide.


Thanks, Cory