LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Usage, what kind of Format to use and which Factors are decisive ?

Solved!
Go to solution

I have a general question. while aquiring data with a rate of 20 kHZ but logging the array after the mean function every 1 min a time to write in a spreadsheet of csv. shouldn't be a problem ro run for few months ? everytime the logged data is written in the spreadsheet i overwrite the array with 0, does that work to delete them from the app memory ?

I need recomendation about data managment as i am struggling to make the right decesion. Although, consedring another Format wouldn't be smart as i am not streaming with high speeds such as 10Mb/s for days..

Thanks for anyone who can help.

0 Kudos
Message 1 of 17
(224 Views)

Your application does not involve any challenge about memory (RAM) usage.

You simply need to acquire and accumulate a sum (a double precision value, most probably) and a measurement counter for each datum. That's all. You don't need to overwrite anything. Just reset the sum and the measurement counter (actually if you use the Mean PtByPt vi, the vi will do it for you).

pincpanter_0-1618327169971.png

Every minute, you will write the mean values to a text file. This means less than 45000 lines per month, which is not that much.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 2 of 17
(200 Views)

@MahmoudNajamy wrote:

I have a general question. while aquiring data with a rate of 20 kHZ but logging the array after the mean function every 1 min a time to write in a spreadsheet of csv. shouldn't be a problem ro run for few months ?


I don't think so. But you can do bad implementations of course.

 

It also depends on the number of channels you log.

 

But at 86400 samples per day [EDIT: for seconds, even less for minutes] per channel, ~8 bytes per value, you should be pretty save.

 


@MahmoudNajamy wrote:

everytime the logged data is written in the spreadsheet i overwrite the array with 0, does that work to delete them from the app memory ?


I'm not sure what that means.

 

Overwriting a value in LabVIEW memory with 0 doesn't do much, and not much good for sure.
 

I'd have to see that to make a definite judgement.

 


@MahmoudNajamy wrote:

I need recomendation about data managment as i am struggling to make the right decesion. Although, consedring another Format wouldn't be smart as i am not streaming with high speeds such as 10Mb/s for days..


It all depends on what you want.

 

The right format doesn't just depend on the data speed...

 

A text file can be read in notepad, a database can be queried. A TDMS file can be used in Diadem, and so on.

0 Kudos
Message 3 of 17
(196 Views)

@MahmoudNajamy wrote:

I have a general question. while aquiring data with a rate of 20 kHZ but logging the array after the mean function every 1 min a time to write in a spreadsheet of csv. shouldn't be a problem ro run for few months ? everytime the logged data is written in the spreadsheet i overwrite the array with 0, does that work to delete them from the app memory ?


We can offer much more specific help if you would show your code or at least explain in significantly more detail. So are you averaging 1 minute worth of 20kHz data into a single value to be written to file? A "point-by-point mean" does not need an array at all. All you need to keep is the sum and count, both scalars and reset them with every save.

 

Why would you need to overwrite the array elements with zeroes (the correct term is replace with zeroes) if the values eventually get replaced by new data anyway? correctly programmed, the code should be aware which data is valid (even a zero can be valid data!). And no, a DBL "zero" takes exactly the same amount of memory as any other DBL value.

 

If you have arrays with a known upper size limit, it is important to allocate them once at the start of the program and keep them in a shift register, then do all operation in-place.

 

For such long running application, you also need to make sure that interruptions are handled gracefully. There can always be a power failure or computer crash, etc.

 

Feel free to show us your code for further advice.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 4 of 17
(170 Views)

how to reset them after every save ?

i saved them in the shift register of the main VI in my application and after everysave i delete logged measurment by changing the value of the array in shift register to an empty 0 array. But i don't know if this is the right method!

0 Kudos
Message 5 of 17
(130 Views)

As I said, avoid constant array resizing. Resetting to an empty array is pointless, especially since it will soon grow again.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 6 of 17
(126 Views)

and do you have an application in mind, where people need high speed streaming ? i was asked to explain difference between high speed streaming and basic streaming with ASCII, do you have any good explanation? in Motor testing would be high speed streaming relevant?

0 Kudos
Message 7 of 17
(124 Views)

but how can i delete data while my applicaton is running ?

0 Kudos
Message 8 of 17
(123 Views)

@MahmoudNajamy wrote:

but how can i delete data while my applicaton is running ?


Show your code. The concept of "deleting" data in a LabVIEW program is ambiguous at best. Data is represented in LabVIEW by wires and its content is created in LabVIEW when needed and ceases to exist when the wire ends. LabVIEW will internally hold on to the memory buffer and simply reuse it when it is needed again, so what do you want to "delete". 

Rolf Kalbermatter
Averna BV
Message 9 of 17
(117 Views)
@MahmoudNajamy wrote:

how to reset them after every save ?

i saved them in the shift register of the main VI in my application and after everysave i delete logged measurment by changing the value of the array in shift register to an empty 0 array. But i don't know if this is the right method!


That seems right.

 

If you store data in an array in a shift register, that data will grow. If you empty the array, the memory is released (conceptually, LabVIEW might try to reuse it). 

 


@MahmoudNajamy wrote:

but how can i delete data while my applicaton is running ?


You're using layman's terms here. It seems to me you are doing it right.

 

'Reset' and 'delete' data aren't terms used for this. Data isn't 'reset' though. It's not 'deleted' either.

 

Data uses memory, and that memory can be released. If you empty the array in a shift register, the data is released from memory. Or, you can say, the memory is released.

 

If the data isn't in a shift register, you don't have to do anything to release the data from memory. LabVIEW will detect if the data isn't used anymore. This is not quite garbage collection, but there are overlaps.

 

Bottom line is you usually don't have to care about it. If you keep adding to a shift register, memory will grow. That's not even a memory leak, officially. It's a bug. If you don't want data usage to grow, empty (or reduce) the array. 

0 Kudos
Message 10 of 17
(115 Views)