Getting tag data from tag History

Hello,

I have a tag " Pump_On_IND" that is == 1 whenever the pump is running.
I am trying to implement this formula into my report designer:

Total Gallons Flowed = "Pump_On_IND" * 287.5

In these reports, each row is a unique batch. I would like for this to calculate the gallons flowed for each batch, and put it in a column in my report designer.

I achieved using the DurationOn aggregate, but when I used it in a column, it reported the entire start date to end date total (same number in every row for that column). It did not separate it by batch.

Could anyone point me in the right direction here?

Unfortunately, this is not something the tag historian does well. You will probably want to query for the "as stored" raw on-off events, then construct your dataset in a script.

2 Likes

Can you tell me where I can read about "query for 'as stored' raw on-off events"? I'm not sure where to find that

It's triggered when you specify returnSize=-1 in your scripted tag history query. Then you'll get a row for every change in the pump status. Your script will then have to loop through those noting the start and stop timestamps for a new dataset.

1 Like