LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving 1 data point in countinuous mode

Solved!
Go to solution

Hey guys, I'm looking to save a LVDT voltage on a timed schedule. I would like for this value to be saved ONCE each time it hits my elasped time case. I'm getting 3-4 values for each instance, even tho the loop is iterating 1 time. I know I'm sampling well above 1...but I can't seem to figure out how to put this value in the data file only 1 time. I don't have all my cases setup yet, I was testing with "2" seconds.

Download All
0 Kudos
Message 1 of 23
(3,907 Views)

Do not wire the double type "Elapsed Time (s)" into the case selector. It is going to the "2" case any time that number rounds off to 2. When do you restart the timer?

0 Kudos
Message 2 of 23
(3,898 Views)

I was looking to run a timer to go to 1440 minutes, taking readings @ 1,2,4,8,15,30,60,120,240,480, 1440 minutes. I was restarting my VI everytime, to rs the timer...just for testing purposes. You're saying I shouldn't use elapsed time in this case?

0 Kudos
Message 3 of 23
(3,881 Views)

You can definitely use the elapsed time VI. Stopping and starting a VI while you're developing is fine, but you should not have to do this once you've made your functioning program. You have kind of a quirky timing requirement (irregular steps), so I suggest sending in the array of times. I have defined it as the amount of time until your next log. So 0 to 1 min is 1 min, 1 to 2 min is 1 min, 2 to 4 min is 2 min, and so on. Then when your time has elapsed, you can do your action and pull off the next target time from the array. I send in a short array in this example so you can see it go fast (6 seconds, 6 seconds, 12 seconds, stop). But the array corresponding to what you desire is sitting off to the left.

 

Timing with Express VI.png

0 Kudos
Message 4 of 23
(3,850 Views)

Is there anyway to do this with my current program stucture? It seems like this would start as soon as I ran my VI.

0 Kudos
Message 5 of 23
(3,839 Views)

Double click your express VI to configure it. Set the time to 2 seconds (or whatever you want). Also set the Automatically reset after target time. Wire the Time Has Elapsed boolean to the case structure. As long as two or more seconds have elapsed since the VI was last called, it should record your data.

0 Kudos
Message 6 of 23
(3,815 Views)

I'm sure there is, but separate processes require separate loops. So if you want to start the logging independently from the start of your program, then you should put it in a separate loop. This is one of the most powerful features of LabVIEW. Put two loops side-by-side and they run in parallel, just like that!

 

For very simple applications, like taking the most recent value and sending it to a file, you can even just use a local variable for data transport.

 

Another construct to get used to is a Functional Global Variable or Action Engine. These are VIs that store data in their shift registers for future uses, and I often find them useful for timing application.

0 Kudos
Message 7 of 23
(3,807 Views)

@NLutz wrote:

Double click your express VI to configure it. Set the time to 2 seconds (or whatever you want). Also set the Automatically reset after target time. Wire the Time Has Elapsed boolean to the case structure. As long as two or more seconds have elapsed since the VI was last called, it should record your data.


It will not be quite that simple, because his time between samples changes after each sample.

0 Kudos
Message 8 of 23
(3,803 Views)

@Gregory wrote:

@NLutz wrote:

Double click your express VI to configure it. Set the time to 2 seconds (or whatever you want). Also set the Automatically reset after target time. Wire the Time Has Elapsed boolean to the case structure. As long as two or more seconds have elapsed since the VI was last called, it should record your data.


It will not be quite that simple, because his time between samples changes after each sample.


I realized that after I read your last post. My mistake Smiley Happy

0 Kudos
Message 9 of 23
(3,797 Views)

nice. So a for loop would work in this instance?

0 Kudos
Message 10 of 23
(3,795 Views)