I have modified an RTA so that the incident detection node now uses a TrackFieldWindow("speedInMph", -3, 0) expression to look at the last three (Current, -1, and -2) transactions for vehicle speeding.
The Incident starts based on this logic, and defaults to Ends when the Logic returns false.
// $feature.speedInMph > 25
// Get last 3 speed observations
var speeds = TrackFieldWindow("speedInMph", -3, 0);
// Check that all 3 speeds are > 25 MPH
return
Count(speeds) == 3 &&
speeds[0] > 25 &&
speeds[1] > 25 &&
speeds[2] > 25;
Now I am trying to decide if I can fix the IncidentDuration added to the Schema, as the reports are 30 seconds apart, so speeds[2] is actually 60 seconds old at this point. Could I add a fieldCalculation after the Detection Node to adjust the tIncidentDuration time? If so, would I need to do it for all Started, Ended, and Ongoing states, or can I somehow impact the value in the stored state?