LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Timed Loops

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

0 Kudos
Message 1 of 10
(753 Views)

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.

 

altenbach_0-1704915832458.png

 

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.

 

0 Kudos
Message 2 of 10
(731 Views)

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...

0 Kudos
Message 3 of 10
(724 Views)

The end goal is if you try the 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 the one named MAIN is the top level. I'm trying to get perfect time so it doesn't runaway over the 1000hr goal.

0 Kudos
Message 4 of 10
(715 Views)

A couple things here...

 

  1. The Timed Loop structure is not intended for general use like this. My understanding is that it is intended for LabVIEW Real Time or LabVIEW FPGA.
  2. There are much easier ways to do take measurements at regular intervals using the system clock.

Here's a simple example: 

timeeCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 10
(680 Views)

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?

0 Kudos
Message 6 of 10
(665 Views)

@RTSLVU wrote:
Here's a simple example: 

timeeCapture.PNG


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.)

0 Kudos
Message 7 of 10
(662 Views)

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.

0 Kudos
Message 8 of 10
(653 Views)

@altenbach wrote:

@RTSLVU wrote:
Here's a simple example: 

timeeCapture.PNG


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 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 10
(604 Views)

@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.

0 Kudos
Message 10 of 10
(548 Views)