CSLUG - Central South LabVIEW User Group (UK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Logging Script Folder LV9.zip

Here's version in LV9...

#############################################################

I've added a new version (at least I think I have!).

I've put in a queued logging option and removed the global logged data.

This will the reduce the risk of losing data (missing a global update). Also the queued part could include some logging to file because time is spent in this loop won't cause issues in your other loops

Hope it helps

Steve Watts

#################################################

ooops that was the original. Version 3 is the Queued version

0 Kudos
Message 1 of 5
(8,688 Views)

Hi Steve,

Yes that looks alot better!  I like the way the feedback nodes work here in the LoggedDataQ vi - must admit I've never used them in this way before.  Also lke the way the logging loop is closed when the queue is deleted - pretty sneaky!

Thanks a million for your advise.

0 Kudos
Message 2 of 5
(5,498 Views)

I've implemented some logging of serial (RS232 and RS485) comms which can be enabled using a registry entry. I place a logging vi in a common transmit/receive vi used by all our comms and this will log all data if the correct entry in the registry is set. This solution works in production so we can enable or disable logging but the operators have no knowledge of what is going on. I also allow different log files to be used for different events (environmental chamber control to one file, temp/humidity sensor to another, serial data measurements to another) and set a maximum file size which renames and creates a new file to allow logging to be left on for long periods (we have some 8 hours tests).

To enable or disable logging while the program is running you could use an FGV to hold the state instead of my registry implementation. This would allow you to put together a library of vi's that are not dependant on globals which may make them easier to reuse.

As the serial comms is not that fast I've not had to worry too much about the overhead of opening files, writing and closing them each time but this could be changed to use a queue as Steve Watts demonstrated.

Steve Swindley (CLA since Feb 2008)
0 Kudos
Message 3 of 5
(5,498 Views)

Now I really feel like I'm showing my ignorance but what's an FVG?

0 Kudos
Message 4 of 5
(5,498 Views)

FGV=Functional Global Variable (also called LabVIEW 2-Style Global Variables). They basically allow a subvi to keep state information between calls. This used to be achieved by nesting a case structure inside a while loop and placing shift registers but we can now do away with the while loop and wire up a feedback node. Action Engine is also another name that is used sometimes although I usually think of these as having extra functionality above just storing data.

Steve Watts demonstrated this in 'LoggedDataQ.vi' and uses a feedback node to store the Queue refnum between calls and a typedef control 'StateQCommand.ctl' to set the function performed on this data. This vi will let you setup, write data to, close the queue without having to pass the queue refnum wire around your main diagram, it is used in  'Process.vi' to write data to the queue.

Steve Swindley (CLA since Feb 2008)
0 Kudos
Message 5 of 5
(5,498 Views)