12-01-2011 09:47 PM
I feel like this should be simple enough but I don't have any formal TestStand training and unfortunately don't have a ton of free time to write test code.
I have single data acquisition boards (measurement and computing boards unfortunately) that I want three different processes, we'll call them Alarms, Gauges, and Test, to access the boards for readings at any given time. Alarms will take some samples and then decide if the values are out of range and trigger a shutdown type of sequence. Gauges will also be taking samples and displaying the data to a LV front panel. Test will take some samples under certain DUT conditions and compare them to limits at those conditions.
We've spent a good bit of time modifying the Sequential model where we launch the Alarm process and the Gauge process as seperate threads in the model. These processes are calling the same non-reentrant VIs to get the readings so they "lock" the access to the board to one process at a time without us having to do any type of synchronization/locking/semaphoring in TestStand. For most of the testing we do in the Test process we also use this same VI so we don't have to worry about locking in TestStand for this either. Most of what we do we're never hogging the board from any 1 process to have to bother with priority or anything of that nature. However, there are some things we do in Test where we are using a different VI that is accessing the same board that Gauges and Alarms will try to access and we don't get the benefit of LV blocking for us so we have to manage it ourselves and we've done it up to now by setting FileGlobals in the Model to signal the Alarm and Gauge process to not try and access the boards.
This all works pretty well but we have one unfortunate side effect that any break points we set in the Test process will also stop the Alarms and Gauge process as well...and we've decided it would be very desireable if this weren't the case. Sooooo....I'm sizing up how much changing I'd have to do to convert Alarms/Gauges/Test into separate executions. For most reading of the boards the LV code will still do the locking but in instances where it doesn't I need to be able to communicate between executions and our existing Model Fileglobals scheme shouldn't work because the different executions getting their own copies. So in general, that is a lot of words to basically ask "what is the best way to have separate executions be able to pass data back and forth".
12-02-2011 10:14 AM
A couple of points:
1) You shouldn't be using fileglobals at all for synchronization, it's probably not synchronizing things completely, you likely have race conditions. You should be using critical sections (i.e. Locks in teststand) instead, or whatever the equivalent of that is in LV.
2) There is a setting on files to share the file globals between executions, its on the sequence file properties dialog.
3) Another way to share data between threads/executions in a thread-safe/synchronized way is by using Queue or Notification steps (or the labview equivalents if you want to do it in your code modules).
Hope this helps,
-Doug