Hi there,
I want to log some energy data in an 1s interval. I am using the following parameters for my tag:
I set the "Max Time Between Samples" and the "Sample Rate" to 1s which should log a value every second but when I query the COUNT(*) of my entries for the day inside of my table I only get values for around 23,6 hours and not 24. Any suggestions here?
Example: I logged my data and made a query to count the entries between 2023-01-26 01:50:08 and 2023-01-26 04:11:52. I have 5981 entries but am estimating 8504 entries, so only ~70,3% of the entries were made. I need every second because I have to add up the amount of energy that was consumed. Here is a example of the values (extract of the database):

Some gaps here are 5-7 seconds without values.
Thanks in advance
Anything that bogs down your PLC comms or bogs down the Gateway itself will throw off short timing like this.
If you need precise accounting of anything like this, do the sums in the PLC and transfer and record those sums.
1 Like
Unfortunately there is no PLC just a gateway from a sensor that communicates with a gateway. I thought the timings could be thrown of by milliseconds but not like 7 seconds.
So there is no possibility to log a value every second in a reliable way?
Not to the millisecond, no. You can't even rely on the value being read every precise second when using request-response protocols. You should plan on computing with the values multiplied by the interval between each sample and its predecessor.
It sounds like you are measuring power, not an energy accumulator.
You should know that integrating a rate into a sum is one of the most noise-sensitive things you can ask of a sensor system. Which is why it is always done in the sensor itself for anything where $$ are involved.
Electrical power is also very jittery with certain loads, so even one-second samples is insufficient in many applications. Real utilities use energy meters that measure and accumulate for every cycle of a 50Hz or 60Hz system. The accumulated energy is what is communicated to data collection systems, at a minimum. And that value is generally treated as an odometer (never reset), so that any time interval's energy use can be obtained by subtraction of the start value from the end value.
Consider changing your architecture. If you cannot, the weighted intervals are your best bet.
2 Likes
Change deadband mode to off and let me know if that works.
1 Like
Another option would be ignoring the configured history settings and setting a timed script to push a historical record every second.
https://docs.inductiveautomation.com/display/DOC81/system.tag.storeTagHistory
There must be some consideration for batching up the history and storing it this way if you need to scale
1 Like
Yesterday I was out of the house. I implemented the change right now and will come back to you in tomorrow if it was the solution.
I'll check it, if the deadband change doesn't work. Thanks!