So, I've been coding up this model based controller and have hit a snag:
The program starts and opens a datalog file and passes the refnum to two loops.
At a regular time interval (every 2 minutes), one loop (that's iterating once per second) writes the current information to a datalog file.
Meanwhile, another loop (that's iterating continuously) checks to see if the file is big enough to support training of the model, if it is, then the training process begins. Once this happens a period of recent information is read from the file. Initially, this read would fail and return 0 data. However, this problem was fixed by passing in the data file path rather then the refnum and having the vi open,
read, and close the data file. With the path, the vi was able to read all the data. However, still in the same loop, another vi downstream tries to read the file and returns error code 1, and no data is read. I tried passing that vi the path and seeing if it made any difference to open, read and close the file. But even then the read failed (with error code 1).
I don't understand why it can read in one vi and not the other!
Does anyone know what is going on here? It seems that semaphores would probably solve the problem, but would prefer a simpler solution. Thank you very much.