LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I change my program to sample every other hour without being dependent on the actual time

Hello!

 

I am having trouble with a couple things with my program.

 

1- My original program samples data like an even/odd function so at 12 on the dot it wont sample and as soon as it turns 1pm it will sample. I am trying to fix my program so it isnt dependent on the time, so whenever I run the program it will run for an hour then not run for an hour and do that continuously.

 

2. My second question is that currently my data is being sent to a text file then I copy and paste onto excel. Since I am running a multiple week test it will be tedious to continually do that. How do I simply export the running data onto a formatted excel sheet bypassing the text file?

 

Thanks in Advace!

0 Kudos
Message 1 of 7
(3,408 Views)

Please do not upload a PNG file, upload your actual VI.

0 Kudos
Message 2 of 7
(3,405 Views)

You are new to the Forums, so might not know/realize that posting a static picture of part of your VI is not very helpful to us.  It (a) doesn't tell us what version of LabVIEW you are running, (b) doesn't let us closely inspect Express VIs to see "what is under the hood", (c) doesn't let us look at the "unseen Case" statements, (d) might not show all of the VI (or if it does, might be too tiny to read, and (e) is not executable (so we can't test it).

 

Thank you for posting your VI -- it overlapped my writing this note.

 

I'm assuming that you want to sample as long as the elapsed time (in hours) is 0, 2, 4, etc., and not sample if it is 1, 3, ...  Suppose you know t0, the time you started your experiment.  Compute t1, the current time.  t1-t0 is the elapsed time.  Express this in time-in-seconds as time-in-hours.  Round down to the nearest integer.  You now have 0, 1, 2, 3, ... hours.  Use the Integer Divide function to decide if it is odd or even, and wire this to your Case statement to Sample or not.

 

Note you might want to think about "end cases", i.e. what do you do when going from "Sample" to "No Sample" and from "No Sample" to "Sample".

 

The second question, how to write to an Excel Worksheet (I assume you mean write to a .xls or .xlsx file), has been covered many times in this Forum.  There are also examples to be found in LabVIEW (Help, Find Examples).

 

Do some studying, read the samples, think about how to turn sampling on/off on the hour, write some code, and come back, posting your code (meaning "attaching your VI").  Note that if you have multiple VIs (as you should!), you can compress the folder containing them and attach the resultant .zip file.

 

Bob Schor

Message 4 of 7
(3,382 Views)

We need to see the VI, not a picture.

 

  • Why is "Temper 1" a control if it is seemingly used as an indicator.
  • Where is the terminal for "Temper 2"?
  • What determines the outer loop time if the outer case is false?
  • Use a shift register instead of the "savetime" local variables.
  • Most of your sequence frames serve no purpose. Why clutter the diagram?
  • Why do you need a local variable for the path name?
  • Why are many inputs to the concatenate node unwired?
  • What is happening in the yellow subVI?
  • Don't the two case structures conflict?
  • How do you know the value of "save time" the first time the local is read?
  • What is the purpose of the outer case structure?
  • What happens if the user changes the file name during the run?
0 Kudos
Message 5 of 7
(3,372 Views)

Unless you need a more accurate way of sampling, elapsed time express VI is your friend

timer.png

0 Kudos
Message 6 of 7
(3,363 Views)

@jetsfan123 wrote:

 

1- My original program samples data like an even/odd function so at 12 on the dot it wont sample and as soon as it turns 1pm it will sample. I am trying to fix my program so it isnt dependent on the time, so whenever I run the program it will run for an hour then not run for an hour and do that continuously.


I understand that it will sample every 4.8 seconds as long as the hour is odd, then pause for an our and start again if the hour is again odd.

(please clarify if this is incorrect)

 

Anyway, here's what you could do for problem #1.

 


@jetsfan123 wrote:

2. My second question is that currently my data is being sent to a text file then I copy and paste onto excel. Since I am running a multiple week test it will be tedious to continually do that. How do I simply export the running data onto a formatted excel sheet bypassing the text file?


You did not attach the File IO subVI, so we don't know what you are doing there.

0 Kudos
Message 7 of 7
(3,352 Views)