onewayautomation / ogamma-logger

Integration tool to collect, store, visualize, analyze OPC UA data.
50 stars 16 forks source link

Change of Publishing/Sampling Interval #14

Closed MMW-AlexanderWick closed 1 year ago

MMW-AlexanderWick commented 4 years ago

Hello everyone,

I stumbled upon the following problem: I tried to change the sampling interval from 1000 to 100ms (publishing interval 800, queue size 15), but it seems the changes doesn't take effect.

I had a look in the Application Log: the time difference between two entries of Buffer with 1 data values has been written to InfluxDb is about a second. (Which should be 800ms with the settings mentioned above?) app_log.txt

In the TSDB is only one datapoint per second. influx_timestamps

I´m running the version 0.8.6 with InfluxDB 2.0 on a "Docker-Setup".

Best regards and stay healthy! Alex

RavilN commented 4 years ago

Hi Alex, Just changing sampling interval does not guarantee that you will get data values with that rate. First, sampling interval which is configured in ogamma Visual Logger is what is client's wish. UA Server can return revised value different than the client asked. You can see what are the revised values in sdk-log.txt file. Second, values in the server can be changing with slower rate. If between samplings value is not changed, it will not be reported. So it is possible that even if you sample with 100 ms rate, can be reported by the server with slower rate. In the log file you attached I see that messages "Received notification with sequence number = 2229, 1 data changes" every 1 second, so actually server is reporting every second 1 value, not every 800 ms 8 values. Looks like publishing interval is revised to 1 second too. Third, when data is received by ogamma Visual Logger, they are not written to the TSDB immediately. Instead, they are put into into the queue. And then they are written to the TSDB in batches. Writing to TSDB occurs either when the batch is full (i.e. have number of values defined by option "Write Batch Size"), or it has at least one value and time interval elapsed since last write is equal or greater than value of the option "Max Write Interval". Also note that even if data is written more frequently than 1 second, in the TSDB you might have less number of data depending on another option, precision (applicable for InfluxDB only). By default precision of timestamps written into InfluxDB is 1 ms. In your screenshot I see timestamps include milliseconds, so in your case precision is not reason for seeing data with only 1 second interval. But in general if precision is 1 second, then you would have data values in InfluxDB with 1 second interval only. Option precision is set in Json structure, in section "Database specific settings".

Concluding, in your case the reason why data is written with 1 second is caused by the OPC UA Server: it either returns revised value for sampling interval 1 second, or just data is not changing faster than 1 second. Would be great is you could check SDK log files and let us know what are revised values for publish interval and sampling interval, and how often data is changing in the server actually.
Thank you for reporting this, Ravil

RavilN commented 1 year ago

The issue cannot be reproduced. Alex, please feel free to re-open the issue if you still have problems. We will need SDK log files to investigate further.