LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sensor mote power question

hi everyone, i have posted here before about this, but i have attached some excel files to give you a better idea this time.....
 
ok, from the vi atached i have 2 write measurement files, one is giving me time vs power/current/volts
the other gives me time vs mean power
this is exactly what i want, however i was told to improved 'performance' i should move the write measurement blocks outside the loop, when i did this, no data was written?
 
also, when i attached the second write measurement block (for mean power vs time) the sampling time increased drastically! in fact, its not much good this way. i want samples every 2/3 seconds. for  *both measurment blocks.
 
does the value of 'N'  in the for loop slow things down? i want to keep this vi running until i stop the program manually i should add.
 
any help is much appreciated...!

Message Edited by 1231 on 02-19-2006 01:08 PM

Download All
0 Kudos
Message 1 of 3
(2,670 Views)

Hi

 

The N value is how many time the for loop iterates.  The bigger the N value is the more times the for loop will iterative and the longer it will take to finish. So at the moment you have 1000 iterations at 10 milliseconds therefore it will take 10s to complete the for lope before it moves on to anything else. This will mean that it will take at least 10s between each iteration of the main while loop.

 

Regarding the for loop what are you actual trying to do? At the moment you are running the same proses on 1 bit of data (the input to the loop) 1000 times which intern will return the same value each time.

 

Making your code more efficient regarding your writing to a file. I would suggest you open the file before you start the while loop and just write to it within the while loop then close the file on exit of the while loop. This might not make to much difference as at the moment you aren’t running particularly fast.

 

Regards

 

Tim

 

NI UK AE

0 Kudos
Message 2 of 3
(2,610 Views)

Hi

 

I wrote this little VI for you it probably isn’t completely what you are trying to do but might give you some ideas.

 

I have used a random number generator to create the data. The data is then written to a file in blokes of a set amount. The file is then written to, until it reached a maximum size.

 

The VI shows how to initialize a file before you start any acquisition, and only write to the file in the loop then close it once stop is pressed or the file has reached its maximum size.

 

If you use the terminate button during the code then the file wont get written to or closed properly and some data might be lost. You should never have to stop your code with the terminate button.

 

Hope this helps

 

Regards

 

Tim

 

NI UK AE

0 Kudos
Message 3 of 3
(2,596 Views)