I want to verify that the Tag History on an Edge Gateway is being successfully written to a Remote Gateway Tag Historian database (via Enterprise Tag History Sync). If the last verified update from the Remote Gateway is older than some set point, trigger an alarm on the Edge Client to notify the operator that Historical Data will be lost.
Is there something on the Edge Gateway that indicates successful tag history writes?
Crickets – I’ll take that as a no
To get a verification of tag history writes, one solution would be to read an Edge Gateway historical tag on the Remote Gateway and write back to a ‘Heartbeat’ tag on the Edge Gateway.
On the Edge Gateway:
-Tags-
-
GW_UTC – Expression tag, Long data type, Tag History enabled
Expression = toMillis(
{[System]Gateway/CurrentDateTime}
) -
RemGW_HB – Memory tag, Long data type
-
HBDly_Sec – Expression tag, Integer data type
Expression = secondsBetween(
fromMillis(
{[.]RemGW_HB}),
fromMillis(
{[.]GW_UTC}
)
)
On the Remote Gateway:
Gateway timer script to read historical tag value and write to Edge Gateway tag – RemGW_HB
sP = ‘[Ignition-edge] GW_UTC’ #tag path to Edge Gateway historical tag
iRS = 1
sAM = ‘Maximum’
bI = True
dsTH = system.tag.queryTagHistory(paths=[sP],returnSize=iRS,
aggregationMode=sAM,noInterpolation = bI)
lgLD = dsTH.getValueAt(0,1)
sP = ‘[Ignition-edge]RemGW _HB’ #tag path to Edge Gateway heartbeat tag
system.tag.write(sP,lgLD)