LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write a binary file per day // show the samples only 1 in 1 minute

Solved!
Go to solution

well guys i know how to write a binary file...

u run ur program.. put the name u want at the binary file and it writes....

 

but now i need write a binary file per day... how can i do that?

i'm doing some monitoring about voltages and current... and i want to write the RMS of each day

like 9-9-2009, 9-10-2009, 9-11-2009

 

can someone help me with that??

 

------------------

 

Other question is that, in this program i monitore 3 voltages and 3 currents all the time... and show it in a client via tcp/ip

i want to know.. how can i show it like... show each minute... or show each hour....

i have 3600 samples per second.. so  i need like integrate it and show a media of each minute.. or second.. or hour... not ALL THE TIME... the value changes so fast that i can even see this.. and put a wait (ms) works... but i need see the voltages and current only in a period of time... like 1 in 1 minute... or 10 in 10 minutes.... how can i do that??

 

Thanks guys!

 

i will upload the vi's and sub-vi's so u can see better what i'm talking about!

0 Kudos
Message 1 of 59
(4,292 Views)

Capture.JPG

Hope this helps. 🙂

Message 2 of 59
(4,272 Views)
You need to learn some patience. This board is made up mostly of volunteers, and we can't always get to answer questions on a timely basis. For the record, the original post is here.
Message 3 of 59
(4,264 Views)
Also, please use some professionalism in your posts by typing full words rather than doing text messaging speak like u, ur.
Message 4 of 59
(4,257 Views)
m 1 v doz dat nt undstd wat d odr msg mnt.  Hv no clu wt dez shtct wds mean.
Message 5 of 59
(4,251 Views)

ok guys, sorry for that

i will try speak more correct from now!

 

and thanks for the help, now i can save the files...

 

now i only need to know how can i integrate the samples to show it only in a period of time...

like 1 in 1 minute, or 10 in 10 minutes, someone could help me with that?

 

and i will have more patience, i promise!

0 Kudos
Message 6 of 59
(4,193 Views)

If you showed us your code, we could see what you have implemented to date and suggest something that would go with it.

 

For example, if you store your data in a file, you could keep a pointer to the start & end locations within the file and simply read that portion of the file.  The feature is available with the read file function. 

 

Another trick is if the data is within an array, you would keep the pointer to the last element read and start from the next one. 

 

Or better yet, you could have an array to stores the location (in a file or array) at every 1 minute intervals.  That way you could retrieve any 1 minute block or blocks of 1 minute by knowing which start / end time that you want to retrieve.  (Example retrieve from 3 minute to 7 minute would give you those 5 blocks of 1 minute if you include the the last block which is 7 minute in this example).

Message 7 of 59
(4,177 Views)

well Ray.R

The vi and sub vi's are upload at the first post... i tryed make the write file... to write a different file per day

but i don't work... so my codes are the same at first post at the moment! 

 

I need to know how can i write a different binary file per day, like when each day finish this file is closed and another is open with a new name, like today my file is "09-14-2009" so tomorrow it will be "09-15-2009" or something like that!

 

After that, i need show the RMS value of voltage and current in a period of time... with this code at the moment i can show it but it shows i think 1 in 1 second... and it's to fast... i need put it to show like 1 in 1 minute.. so the binary file will occup only 2MB more less... so i can save a lot of files in the same Hard Disk!

 

Ray.R i'm very rookie at LabView, all i learned i learned by myself or asking here, so i didn't understand very well what are your idea in the last post, if you can show me the code, or an example i could understand better!

 

Thanks

 

 

0 Kudos
Message 8 of 59
(4,169 Views)
Have you considered putting a wait, in the loop where you are writing data to file? This way you can increase the time in the wait to as much as you want. I haven't gone through your code, but if you've not considered wait, I think it would solve your other problem. Hope you could use the same file name as date from  my previous post...
0 Kudos
Message 9 of 59
(4,161 Views)

Hi EduU,

 

I was answering your last question.  I thought you had progressed on the first portion.

I wish I had LV installed on this PC, as I would prepare a quick example for you.

 

I'll try to have a look at it tonight, if time permits.

 

In the meantime, let me try to explain how I would do it..  I don't like using Delay/Wait because if misused, they can be a source of problems, especially if longer than 1 sec.

 

First, I would need to determine the aquisition rate (how often data is sampled).

Then I would determine how often I want to write.

 

Usually, if I write slower than I acquire the data, which is often the case, then I would have producer / consumer loops.  The producer would do the acquisition od data and pass it to the consumer for processing, which includes writing to file.

 

The trigger for the consumer loop would be time based.  If there is not too much data, you can store the data within a shift register of a producer loop and send it all at 1 minute intervals to the consumer loop using a queue.  The consumer loop would have a state machine that gets the data and state from the producer loop.  The state would be writeToFile (or something similar).  The other approach would be to queue up the data and continuously send it to the consumer loop.  It would monitor the elapsed time and trigger its own write to file process (I don't want to use the word "event" because it may not be handled as such).  The latter may be better because it may prevent loss of data aquisition since the producer loop would do one thing only, to acquire data and put it in a buffer to send it to the consumer loop.  

 

In the consumer loop, since you would be checking the date at 1 minute intervals, you could also check the date.  If the date has not changed (now = filename date), then you keep writing to the same file.  As soon as the first ring of midnight strikes, you would detect the change of date and create a new filename and start writing to that one.

 

Since you are writing to the file at a rate of once per minute, I would open / write / close the file in order to make sure that the data is saved.  Notice that I did not say "open / read entire file / append to end / save / close".  There is a reason for that. You can keep tack of the last file position and it becomes the offset to where you want to append the new data.  Reading the entire file is very inefficient and not necessary.  Since you have that "offset", you could save it into an array.  To make your life easier, you could put it into a 2D array along with the timestamp.  You could even save that info for later use (there's a few way of doing this).

 

Am I missing anything??  (questionning myself.... probably 😄 )

 

Hope this helps.

 

R

Message 10 of 59
(4,148 Views)