LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Logging data into a Global variable, while execution is in parallel.

Solved!
Go to solution

Hello all,

 

Can anyone give me an gist of how to Log data that's been recorded or executed, across sites running in parallel to be logged within same file.

The method that am thinking is to put a file global under, file properties - same global variable for each and every sites and logging my Data inside one global. Is there any other procedure of handling the same.

 

 We can't help everyone, but everyone can help someone.. Smiley Happy

0 Kudos
Message 1 of 9
(3,283 Views)

@PriyadarsiniS wrote:

Can anyone give me an gist of how to Log data that's been recorded or executed, across sites running in parallel to be logged within same file.


What do you mean by "sites"?  Parallel loops in the same application?  Separate computers?

 

Other factors to consider:

Do you need to save all data?

Is the data to be logged at the same rate?

What file type do you want?  Raw binary?  Text?  TDMS?

 

But short answer: Global Variables are NOT for logging.  I inherited a project that did that and it did not work well.

 

Need more information before I can give better advice.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(3,279 Views)

 

Need more information before I can give better advice. 

Sure.. pleasure explaining!!


 

Sites as mentioned represents; sockets running in parallel in TestStand, which is more or less similar to a parallel loop running independent of each other.

 

I can elaborate this further as:

  1. 2 parallel test sequence, measuring different signals that are independent.
  2. the data from both the socket is logged in a 'single' file, differentiated by socket numbers.
  3. Logging (.txt) of data will be at same rate, as the code is written for once and duplicated according to the process model (in this case, parallel process model).
  4. As an initiation of logging data in test sequence, a variable was created to store such data at execution time and project it to the data-log, palette when all sockets have finished measure_part. Am I clear.

This was also interesting, can you share knowledge about it.


 

Global Variables are NOT for logging. I inherited a project that did that and it did not work well.

 

0 Kudos
Message 3 of 9
(3,223 Views)
Solution
Accepted by topic author PriyadarsiniS

In this case, I would use an Action Engine to store your log data.  This ensures the read-modify-write process is protected by having the VI itself act as a semaphore (non-reentrant VI, so only one call can run at a time).  The cases I can think of you will need are Initialize, Clear, Add, and Get.  Of course you will have an input for socket number.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 9
(3,219 Views)

PriyadarsiniS wrote:

This was also interesting, can you share knowledge about it.


 

Global Variables are NOT for logging. I inherited a project that did that and it did not work well.

 


A Look At Race Conditions

Are Global Variables Truely Evil?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 9
(3,216 Views)


This ensures the read-modify-write process is protected by having the VI itself act as a semaphore (non-re entrant VI, so only one call can run at a time).

But, the VI must be accessed at the same time in-order to log data whenever it's present or at the time of execution of that particular test sequence step, right.

 

Will not, a 2 D File global that is hard coded based upon socket numbers as column numbers to store respective sockets data serves the purpose.. even-though, its a risky method.

final_log_data.PNG

 

Let suppose this data must be processed, which storage method would be convenient to retrieve data (.txt, .csv etc.,). 

 

 

 



0 Kudos
Message 6 of 9
(3,203 Views)

PriyadarsiniS wrote:

Will not, a 2 D File global that is hard coded based upon socket numbers as column numbers to store respective sockets data serves the purpose.. even-though, its a risky method.




Very risky.  You are opening yourself up to one major race condition that will make you lose data.  That's why I recommended the Action Engine as that prevents the race condition.  And the operation will be fast enough, that the parallel work will still mostly be there (about as much as things actually run in parallel purely due to CPU limits).

 


PriyadarsiniS wrote:

Let suppose this data must be processed, which storage method would be convenient to retrieve data (.txt, .csv etc.,).




Personally, I like to store my data as tab delimited text or TDMS files.  Since you just have a 2D Array of numbers, I would be more tempted to go with the TDMS and make a different channel for each column.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 9
(3,197 Views)

That was very helpful, thank you Tim.. Smiley Happy

Actually is there any recommended site for downloading TDMS viewer, as I have already

implemented LV2G and its working fine!!

0 Kudos
Message 8 of 9
(3,164 Views)

@PriyadarsiniS wrote:

Actually is there any recommended site for downloading TDMS viewer


I am a big fan of Scout by Signal.X.  You can view the TDMS files with the free version.  If you want to edit the files and some more advanced things, then you can pay to get the Pro version.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 9
(3,157 Views)