Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

measure write different time

Hi:
 
I would like to measure data every 200ms, but only every 600ms I want to write this data in an excel sheet. Does anybody know how to solve it?
I tried it with two while loops with different timers, but this doesn't work.
Please see my attached VI.
 
Thank you!
 
 
0 Kudos
Message 1 of 10
(8,618 Views)

You've posted this question to the Dynamic Signal Acquisition board instead of the LabVIEW board.

Your main problem is that you have the file write outside the loop where you are generating the data. This cannot work. The file write loop will not receive any data from the other loop until the other loop finishes. The ay you have it wired, the file write loop would also only get the result of the very last iteration of the other loop. These are basic dataflow principles in LabVIEW.

You can place an elaspsed time function in the main loop set to 600 msec and put the file write inside a case statement. Wire the Time has Elapsed output to the case statement. You could also use the Quotient and Remainder function in a manner as shown below to write every third iteration.

Message Edited by Dennis Knutson on 08-13-2007 08:10 AM

0 Kudos
Message 2 of 10
(8,614 Views)
Hi Dennis,
 
thanks for your answer. I didn't recognize that, I will post it to the LabVIEW board as well.
 
I tried to do it the way you mentioned, but the data is still saved every 200 ms instead of only every 600 ms: ( Do you know why? I attached the VI.
 
And could you explain the Quotient and Rest VI? I don't know what 'floor' means (it is written in the LabVIEW help for the Quotient and Rest VI). I don't know why you wire the i and a 3 to that VI and why you compare the result with a 2? Starts i at 0 as the i of a for loop does? Sorry for these questions, I'm sure it's quite simple...
 
Thank you!!
0 Kudos
Message 3 of 10
(8,606 Views)

It is writing every third iteration but every time the file write is called, you are writing the entire table. You would want to get the last three rows and just write those. And please, don't use a local variable. Just wire the data into the case structure.

The Quotient and Remainder works the same was as the modulo function in other languages. The output counts 0,1,2 and repeats. 0 divided by 3 equals 0 with no remainder. 1 divided by 3 is zero with a remainder of 1. 2 divided by 3 is zero with a remainder of 2. 3 divdided by 3 equals 1 with 0 remainder. 4 divided by 3 equals 1 with a reaminder of 1, etc.

0 Kudos
Message 4 of 10
(8,601 Views)

That makes sense, thanks!

But how can I only write the actual row of the table with every third iteration? Maybe with the bundle by name function? I don't know how to use it exactly (which cluster should I wire there?)? Could you help me one more time?

 

THANK YOU!

0 Kudos
Message 5 of 10
(8,583 Views)

Hi Dennis,

 

now I have a VI which writes every third iteration the actual row to the file, but I think it overwrites every time as I only have one value at the end: (

Can you have a look at my posted VI?

Thanks

0 Kudos
Message 6 of 10
(8,581 Views)
You are correct, it is overwriting. That's one of the 'features' of LabVIEW 8.x which I just got. Looking at the help, it says that if you have a file path wired to the input (like you have) it will replace the contents. You will need to open the file outside of the loop and wire a reference to the input. You'll also have to set the file position. Try the attached modification.
0 Kudos
Message 7 of 10
(8,578 Views)

Hi Dennis,

 

almost!: ) Thank you very much for your help.

Now I want to delete the contents of the file when I start the program, so that I only have the values from one run in the file. Do you know what I mean?

Right now it alway starts writing at the end of the old run, so it will become a very big list (file).... I want to start at the beginning of an empty file every time I run the program.

 

 

0 Kudos
Message 8 of 10
(8,569 Views)
The default setting for the Open/Create/Replace operation input is Open. You can right click on this input and select 'Create Constant'. This will create an enum with different values that you can select. You probably want 'replace or create' or 'replace or create with confirmation'.
0 Kudos
Message 9 of 10
(8,564 Views)

Thank you very much, Dennis.

Now I got what I want: )

THANK YOU

0 Kudos
Message 10 of 10
(8,552 Views)