Simulating Demand Polling

To simulate demand polling, create the following tags.
Tag Description
Polled Tag A polled tag with a collection interval of the longest period you want between raw samples. Do not enable collector or archive compression. This tag should point to the same source address as the unsolicited tag.
Unsolicited Tag An unsolicited tag with a 0 or 1 second collection interval. This tag ensures you will be notified whenever changes occur. This tag should point to the same source address as the polled tag.
Combined Tag An unsolicited calculation tag that is triggered by either the polled tag or the unsolicited tag, and combines the raw samples of both into a single tag. Use a 0 or 1 second collection interval and use the following formula:
dim timetag1 
dim timetag2 
dim tag1
dim tag2
Dim x
tag1 = "T20.di-1.F_CV"
tag2 = "t20.T20.DI-1.F_CV"
x = DateAdd("s", 1,CurrentTime) ' add 1 second to calc time
' Get the timestamp of the newest raw sample for tag1:
timetag1 = previousTime(tag1, x)
' Get the timestamp of the newest raw sample for tag2:
timetag2 = previousTime(tag2, x)
if timetag1 > timetag2 then
' If tag1 triggered me, then:
result = PreviousValue(tag1,CurrentTime)
else
' If tag2 triggered me, then:
result = PreviousValue(Tag1, CurrentTime)
end if