-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch Collection measurement times drift over several hours #106
Comments
Further customer input suggests our current drift is on the order of 1 second / hour, which honestly isn't that bad. |
The amount of time it takes to schedule the next measurement after the dispatch of the previous one is roughly equal to the amount of time One possible solution is to have a a single start time and a variable that indicates how many measurements should have been made so far. At a frequency greater than the sample rate, perform the following check (pseudocode)
This way, the amount of time it takes for the code itself to execute is not excluded from our measurements. |
Instead of performing timing calculations, I'm approaching this by adjusting our use of QTimer
When these problems are resolved, the issue is ready to be closed. |
Absurd batch configurations, when the duration of a single batch is longer than the interval between batches, should be dealt with in one of the following ways.
Even if we validate the UI (or allow for differing underlying 'true' values) uncertainty in code execution time can create problems even for non-overlapping intervals. Take for instance a measurement that takes a really long time in the following diagram. In practice, this error happens when I set a measurement period of 10ms and a count that exactly fills the batch period. We adjust the formula accordingly, true meas. count = min( meas. count , (Batch Period - max_meas_duration) / Meas. Period ) |
The current BatchCollection code computes the "start of the next measurement" as an offset from the "start of the previous measurement:"
https://github.com/WasatchPhotonics/ENLIGHTEN/blob/main/enlighten/BatchCollection.py#L556
https://github.com/WasatchPhotonics/ENLIGHTEN/blob/main/enlighten/BatchCollection.py#L591
It's good that it tries to achieve a full "start-to-start" period. However, this approach has been found to drift over a period of hours.
It might be more accurate to instead base the "next start" time on current_batch_start_time + current_measurement_count x double(measurement_period_ms).
The text was updated successfully, but these errors were encountered: