Pulling up tag history

I have a customer who has a tag that has been logged into history. The value is from a flow meter. It is measuring discharge water that mostly occurs when it rains (in case you wanted to know what was measured). They have in the past just looked at the historical graph of this tag to get some information related to maximum and minimum. What they want to do now is to get some data out of this recorded data. What they want is a daily report that pulls the maximum, minimum and average value for the day, and they also want a totalized value.

I’m assuming I can use “system.tag.queryTagHistory” to get the minimum, maximum and average, but how do I pull a totalization? Am I going to have to create an internal tag to build a totalizer? Or is there a way to pull this data from my existing history?

To complicate things, they not only want this value for the day, but in the report they want hourly values as well. So the report will have 25 lines (one for each hour and one for the entire day, min, max, average, total).

I’m assuming your reading flow rate from the meter. To get flow total you can do the following, listed in order of accuracy, 1) use a flow meter that calculates total and read the value directly from the meter, 2) use a PLC and read pulses from the meter and convert the pulses to total, 3) use a PLC and read rate and convert the rate to total, 4) use a Transaction Group in Ignition and record the rate at a certain time span and convert that to total.

Your best bet is to calculate the total outside of Ignition and then use a Transaction Group to record the rate and total values.

[quote=“Pat”]I’m assuming your reading flow rate from the meter. To get flow total you can do the following, listed in order of accuracy, 1) use a flow meter that calculates total and read the value directly from the meter, 2) use a PLC and read pulses from the meter and convert the pulses to total, 3) use a PLC and read rate and convert the rate to total, 4) use a Transaction Group in Ignition and record the rate at a certain time span and convert that to total.

Your best bet is to calculate the total outside of Ignition and then use a Transaction Group to record the rate and total values.[/quote]

The meter is old and does not have the capability of totalizing, and I was hoping not to have to write code since they also want to gather some of this data from the existing data in the database. I guess I was hoping that there was some sql query that would work. I’ll probably just write a totalizer in the PLC and log it separately from the flow rate.

Thanks.

Is there some reason why you can’t calculate the total from the average?

total = average x deltaT ( x some unit conversion usually)

You’d want the time-weighted “Average”, not the “SimpleAverage”, from system.tag.queryTagHistory.