Asle Frantzen

Correct PITime handling while recalculating

Discussion created by Asle Frantzen Champion on Apr 27, 2010
Latest reply on May 5, 2010 by Asle Frantzen

I have a little question I guess I see the correct answer to, but it'd be great if someone else could look at it as well.


I'm using two different PITime variables in my calculation, like this:

Public Overrides Sub ACECalculations()

    'Set the time of the triggered event
    eventTime = LastEventTime()
    startTime = ParseTime("*")


End Sub

Private Function LastEventTime() As PITime
        'Defaults the return value
        LastEventTime = Inputtag_06.PrevEvent()
        Dim triggertag As String = "NOT_YET_ASSIGNED"

        If (Inputtag_01.IsTrigger = True) Then
            LastEventTime = Inputtag_01.PrevEvent()
            triggertag = Inputtag_01.Tag
        End If
        If (Inputtag_02.IsTrigger = True) Then
            LastEventTime = Inputtag_02.PrevEvent()
            triggertag = Inputtag_02.Tag
        End If
        If (Inputtag_03.IsTrigger = True) Then
            LastEventTime = Inputtag_03.PrevEvent()
            triggertag = Inputtag_03.Tag
        End If
        If (Inputtag_04.IsTrigger = True) Then
            LastEventTime = Inputtag_04.PrevEvent()
            triggertag = Inputtag_04.Tag
        End If
        If (Inputtag_05.IsTrigger = True) Then
            LastEventTime = Inputtag_05.PrevEvent()
            triggertag = Inputtag_05.Tag
        End If
        If (Inputtag_06.IsTrigger = True) Then
            LastEventTime = Inputtag_06.PrevEvent()
            triggertag = Inputtag_06.Tag
        End If

        If Logging Then
            log.WriteEntry("B4: Trigger tag for " + Mdb_Module.Name + " is " + triggertag)
        End If
End Function


This works well in normal operation, but I think there could be some problems with recalculation - if you look at the startTime variable. In normal operation the startTime would be the time of the calculation, but what happens when we recalculate? I guess that'd be the time of the recalculation then, and that wouldn't be very useful if I recalculate for a period last year.


I guess what I wanted to accomplish, was to have the exact time of the calculation itself - since that could vary a small bit from the time of the triggering event. But this probably isn't possible while recalculating?