-
Notifications
You must be signed in to change notification settings - Fork 9
Save precise start times per TP #2408
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
base: main
Are you sure you want to change the base?
Conversation
bc2d6e9
to
460bced
Compare
@t-b I have adapted the ITC fifopos threaded push and readout now including acq start time - fingers crossed |
0fd45cb
to
a9d8a54
Compare
The CI failure could be due to me doing something on the machine. |
996000c
to
ec33069
Compare
ec33069
to
67038dc
Compare
I've played around with it and the issue that the timestamp plot has bunches is resolved. Review: 532e9f9 (DAC: Save time of acquisition start per device, 2025-04-25)
b8111bb (ITC: Save AcquisitionStartTime on acquisition restart in ITC Fifoloop, 2025-04-28)
e056da4 (Time: Add utility functions to convert time in secs UTC <-> Local, 2025-04-25) Nice! 4a31f90 (SCOPE: Add code comment to TP loop in SCOPE_UpdateOscilloscopeData, 2025-04-25) Good. 72d9e28 (SCOPE: Use precise timestamp per TP for tpInput data, 2025-04-25) Very nicely solved. 72e02da (TP: Remove TPStorage field %TimeInSeconds, 2025-04-29)
f3369e6 (Debug: A variable was missed in a rename refactor in a debug code section, 2025-04-29) Nice find. Please cite the commit introducing the compile error. Good thinking to add that define to the 2b0dfa1 (Fix: LeftOverSweepTime - treat fifopos of NaN as finished sweep, 2025-04-30) With a test, nice one! 5933a76 (TS: Use finite timeout only when threadqueue has run empty, 2025-04-30) Nicely found and solved. |
67038dc
to
5cdc407
Compare
db67cf7
to
25c1e2e
Compare
@MichaelHuth I've fixed the test failure. The issue was that the saved stimsets were not in good shape. I don't know how you save them, but it looks like there is a special workflow only I know. I did:
Code LGTM. |
I think I did:
|
- no functional change
The time is saved as global string as ISO8601 timestamp.
The ITC Fifoloop thread in TFH_FifoLoop also restarts the acquisition on demand. This resets the fifoPosition and the acquisition start time needs to be updated. The acquisition start time is transferred through the thread queue as variable, such that TS_GetNewestFromThreadQueueMult can be used for readout in the new function HW_ITC_ReadFifoPos. IT IS CRITICAL HERE THAT the updated fifopos and start time value is pushed to the thread queue in the same dfr entity and not by TS_ThreadGroupPutVariable that creates a thread queue entity per variable. There the update of the acquisition start time global is handled transparently for the callers.
In our TP data we used until now only simply DateTime of the moment the data was sent into analysis for the timestamp. This resulted in multiple TPs (all from the same new FIFO data) having nearly the same timestamp. Now the timestamp of each TP based on the acquisition start and TP position in the acquisition is determined. Note regarding the calculation: (tpCounter + i) * tpInput.samplingIntervalDAC * tpInput.tpLengthPointsDAC * MILLI_TO_ONE tpCounter originates from NI devices in TP acquisition mode. There the acquisition with a single TP repeats itself in hardware. The TPs are counted based on the FIFO data and each TP is sent to SCOPE_UpdateOscilloscopeData separately. Thus, i is always zero and tpCounter the number of the TP since acquisition start. For all other hardware devices and acquisition modes tpCounter is zero and i counts the absolute TP number based on the position of the data in the FIFO.
The field was redundant to %TimeStamp and even less precise. Since the TimeStamp field was updated in a recent commit to include the precise acquisition start time of the TP, the field %TimeInSeconds is obsolete and is removed. The TPStorage version was increased. The WaveUpgrade removes the %TimeInSeconds. The x-axis of the TP resistance fit uses now %TimeStamp, which makes the fit results much more reliable with fewer data points. The element was also removed from ZMQ publishing of the TP data.
…tion Fix: Renamed the variable in TP_TSAnalysis debug section lengthTPInPoints -> lengthTPInPointsADC Add TP_ANALYSIS_DEBUGGING define to list in CompilationTester
This test case checks that we ignore other set analysis functions if a generic one is set. This test fails after calling ChangeAnalysisFunctions_IGNORE via RewriteAnalysisFunctions_IGNORE(). The reason is that ST_SetStimsetParameter uses WB_SetAnalysisFunctionGeneric to set the generic analysis function. And that helper clears other functions set for the per event cases (which were used for V1/V2 analysis functions). So we now have to set the generic one before all others. Bug introduced in 7c207c5 (Tests: Pefer ST_SetStimsetParameter over direct WPT access, 2022-08-09).
Previously a fifopos of NaN triggered an ASSERTion. However if the sweep already finished when LeftOverSweepTime was called, then the fifopos was NaN. Fix: Correctly return 0 for this case.
Before the timeout constant was used always, such that ThreadGroupGetDFR waited at least once with the timeout for the case the thread queue was read empty. This wait is not necessary as the thread queue can be checked for emptiness also with a zero timeout. TS_GetNewestFromThreadQueue and TS_GetNewestFromThreadQueueMult use now a timeout of zero for reading the thread queue empty and for the then first check of emptyness, where ThreadGroupGetDFR returns a null DFR. Only further read attempts, if timeout_retries are set, use the TS_GET_REPEAT_TIMEOUT_IN_MS.
For TS_GetNewestFromThreadQueue the thread could only return finite values for the requested variable. Instead of using the finite/non-finite state of the read value itself for the decision of returning the value a flag variable was introduced that is set when any value was read. This allows also to send a NaN value from a thread. (Note: It is best to use a custom timeout_default of e.g. -1 then) TS_GetNewestFromThreadQueueMult already uses the logic with a flag variable and does not need a fix.
25c1e2e
to
693d185
Compare
@MichaelHuth Thanks. That approach is the good one and that should also have worked. But it was broken. See 5587a21 (Tests/ChangeAnalysisFunctions_IGNORE: Fix it for test case AFT6b, 2025-05-07). The "funny" part is that the commit message introducing the bug says "Tests: Pefer ST_SetStimsetParameter over direct WPT access It is shorter and safer.". |
close #336