LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Log

Hi all,
 
Just wondered if i could pick your brains.
I want to put an event log in a programme that will put the date, time, reason etc in a list box when something happens
There are various areas in the programme loops that may wish to add something to the list box and i was wondering what the best way was.
Originally i thought it best perhaps to append the updates to an array and then have a 2nd loop which processes the array and updates the event box...I have found with the list box im using to hold the event log that if lots of things are happening on the channels, and im changing the text colour etc in the list box it can slow the main loop down which i would not want. So this is why i put it in a 2nd loop.
The problem now though is that i want to remove items from the original array once they have been processed but what happens if im appending to the array in the 1st loop?
 
With VB this would not be a  problem but because with labview when you use append you always have to give it the array its appending to, obviously that read could be done before i have removed the items i have processed, then i remove them then the programme adds a new one to the array - hope that makes sense. Also i may need another loop and wish to update the array from there.
 
I suppose what im asking is what is the best way to update an array from several places ensuring its integrity is kept
 
Regards
 
Mike
 
0 Kudos
Message 1 of 5
(4,220 Views)
Hi Mike,
you can use action engines (functional global variable) the vi can be called only ones at the same time. Therefore you can use different cases for "add" or "delete". You can also use a Queue and send commands and data to one receiver which handle the "add" and "delete" commands. I think the point is that you have only one array, so if new data should be added you have current array.
 
Mike
0 Kudos
Message 2 of 5
(4,214 Views)

never heard of action engines before, could you post an example?...how do you ensure it can only be called once at a time - if something ese tries to call it - what happens - does it just wait for the other routine to finish with it?

 

many thanks

 

Mike

 



Message Edited by MikeW1973 on 06-04-2008 05:32 AM
0 Kudos
Message 3 of 5
(4,204 Views)
Hi Mike,
If you call a sub vi then it is locked and can first be called again if it is ready, except you make it reentrant.
Mike
0 Kudos
Message 4 of 5
(4,199 Views)

Yes I have done this with an action engine.  Essintially you have a loop that eaexutes 1 time and stores the log in a shift register.  The loop has modes of operation : 

Initialize - reset the shift register.

Append to Log - takes an log event cluster and appends it to the shift register (array of events)

 Read log - Returns the shift registers current value

 

External support functions

Save Log - Writes shift register to file

Load - loads a log from file into the shift register.

 

This is nice Because it acts like a "functional global"  labview provides for locking of the vi (and its shift register) so race conditions are not much of an issue when concurent writers want access.

 

Paul

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 5
(4,189 Views)