08-04-2023 07:03 AM
Hello All,
i have one issue with logging of some data in txt file.
First of all, i'm using QMH to pass data cluster from lin comunication loop to logging subVI. This is all ok.
Logging works just fine at first look, but from time to time i have missing line in log file.
logging subvi
It doesn't matter if i set sampling time 1s, 2s, 3s, or what ever... there is always some line missing.
In all these examples there is missing one second i will say.
At first, i thought that logging is to slow, but it isn't, actually it is quite fast.
Also QMH should be fast enough for this timings.
Only thing that cross my mind, is when new data is received by qmh, then case structure go out from 'logging' case for the new data in another case 'received data'.
If anyone can help, i will appreciate.
Thanks
08-04-2023 07:25 AM
Please tell us what Version of LabVIEW are you using? 32-bit or 64-bit? What year? What "edition" (Base, Full, Pro)?
We need to see (and be able to manipulate, even test-run) your LabVIEW code, pictures of parts of code just won't cut it. Since all of the long-time LabVIEW Developers will be able to handle LabVIEW 2019 (and maybe up to 2021) code, but might not have the "latest version" installed, best is if you are running in LabVIEW 2022 or 2023, you "Save for Previous Version" and specify, say, LabVIEW 2019 (unless you know you are using a newer "feature").
We need the VIs that are involved with the problem. Best is to attach the entire Project, easily done by right-clicking the Project Folder, "Send To:", "Compressed (zipped) folder", and attaching the .zip file.
Be sure to tell us what VI(s) to look at.
Bob Schor
08-04-2023 07:26 AM
It's probably a combination of 2 things:
1. Your sampling intervals aren't *exactly* 1 second (or 2, or whatever). They are probably just a little longer than that. Are you maybe putting your 1 second wait in series with the other work your capture loop is doing, making the loop rate take just a little longer than the nominal wait time?
2. The resolution of the time you log is quantized to the nearest second. Quite likely you're seeing the occasional effects of rounding. One sample time is at 2.47 seconds and rounds down to 2 in your file, then the next sample time is 3.51 seconds and rounds up to 4 in your file. It looks like a 2 second gap and a missed sample, but only because of the rounding. If you were to store with 2 places after the decimal, you might find that the intervals are pretty regular, maybe something like 1.03 seconds.
If the # lines between these "time gaps" is fairly close to regular, that'd be a pretty good clue that I'm pointing you in a useful direction.
-Kevin P
08-04-2023 07:27 AM - edited 08-04-2023 07:30 AM
Hi milan,
The issue may originate from the way you are timing the sending of user event "received data (clustered)", so you must look upstream in your process. If the loop that produces the events actually has a period of e.g. 1.2 s instead of 1s, the logging will miss a second every 5 iterations.
How is the producer loop timed ? You shouldn't use "Wait (ms)", but rather "Wait until Next ms Multiple".
Regards,
Raphaël.
08-07-2023 01:51 AM
Hey guys,
i'm not allowed to sharte code.
But regarding upstream data process, i will try to explained what's going on.
In main program i have 4 loops (UI, Lin communciation, decode, log).
LIN communication receive frames and send to decode loop.
After decoding, data cluster is sent to log loop (as user event).
Log loop has VI which i showed at first place. (producer to receive data cluster, and consumer to save to file)
Communication between this loops are done by QMH.
Because Log Vi has event sturcture, i send him user event data cluster.
So i thought if i send once a data to log VI, this data will logged continuesly .
So timing in upstream timing should be no problem. Or am i wrong?