01-10-2024 01:12 PM
I need support with my program the loop timing is off from the computer clock and don't have the right solution to ensure the data is recording every second, minute, and hour to log the data to the correct time. AC Watt Meter MAIN program LV2017 Simulated WC0.vi is the main program and its subvi counterpart is AC Watt Meter program LV2017 Simulated WC0.vi
I've all attached the niconfig file for simulated the DAQ card PCIe-6346 we are using in this experiment...
If you run the program on your machine I'm trying to make it so that the timing is not going to be off. I'm doing a 40hour test and up to 1,000 Hours so it needs to be accurate somehow to use the CPU clock.
Please see what you think about the correct way to resolve the timing offset. The one panel we want to see live data maybe 1-2sec intervals and i really don't need the data saved. I do need it every minute and once an hour when its complete.
Thank you,
Wes Callahan
01-10-2024 01:45 PM - edited 01-10-2024 01:51 PM
When attaching a huge pile of VIs and no project file, at least tell us the name of the toplevel VI so we don't need to guess.
So there is at least one VI with "MAIN" somewhere in the name, and that code makes no sense at all, with a for and while loop running in parallel and a comparison that is guaranteed to be always true, rendering the timed loops completely pointless.
Can you take a step back and explain what you are trying to do and what we should be looking at?
Also note that 1000 hours (~42 days) is getting close to the rollover of the U32 ticker (~50 days), so be careful if you ever need longer times.
01-10-2024 01:54 PM - edited 01-10-2024 01:57 PM
AC Watt Meter MAIN program LV2017 Simulated WC0.vi is the main program and its subvi counterpart is AC Watt Meter program LV2017 Simulated WC0.vi I'm sorry i did put the info in the beginning summary i didn't want to build a .llb yet. Yes worst case 42 day test is my goal trying to get this ready to start in the next couple weeks. I forgot to take that comparison out, I was experimenting with something else...
01-10-2024 01:59 PM
01-10-2024 02:40 PM - edited 01-10-2024 02:41 PM
A couple things here...
Here's a simple example:
01-10-2024 02:59 PM
How does a While loop run accurately based on the computer time clock better than the wait ms feature. When i try that it runs away unless there is a way to catch it up and maybe take data every 2 seconds...
Thoughts?
01-10-2024 03:05 PM
@RTSLVU wrote:
Here's a simple example:
I doubt you would need a greedy loop for 1s timings...
All we probably need an outer while loop running at an interactive speed, switching to some action cases if certain times have elapsed. (I really don't understand the purpose of the FOR and while loops and all that convoluted logic. Complete Rube Goldberg! A timed loop that only runs one iteration with each call does NOT maintain timing over long durations.)
01-10-2024 03:16 PM - edited 01-10-2024 03:53 PM
Garmin makes a GPS receiver (GPS 18x LVC) that outputs a logic pulse on the whole second at precise intervals (aligned to GPS time within one microsecond). This could be used to trigger a DAQ board and would not be subject to PC latency or system clock drift. It is $85.
01-10-2024 04:18 PM
@altenbach wrote:
@RTSLVU wrote:
Here's a simple example:
I doubt you would need a greedy loop for 1s timings...
All we probably need an outer while loop running at an interactive speed, switching to some action cases if certain times have elapsed. (I really don't understand the purpose of the FOR and while loops and all that convoluted logic. Complete Rube Goldberg! A timed loop that only runs one iteration with each call does NOT maintain timing over long durations.)
Yeah, not my best work... Anyway the OP wanted to take measurements at 1 minute intervals. I have been doing this for decades using basically the same method (with a 1mS wait to not be greedy loop) without timer drift
01-10-2024 09:32 PM
@vvesley wrote:
i didn't want to build a .llb yet.
And you should obviously not! LLBs are outdated technology from the stone ages of LabVIEW. Nothing to do with a LabVIEW project.