09-26-2014 09:19 AM
I am having 2 issues:
1. I am having issues with my logging occuring at the right time.
I have a few things occuring based on the state of 'Injection'. In the case of logging, the following needs to happen:
When injection is 'True' nothing should occur. When injection goes 'False', data logging should occur. If my injections are 'continuous' the boolean goes:
True, False, True, False. I would have 2 logging sessions during both 'False' occurrences. What appears to be happening is that the logging occurs during the 'True' state. I am not sure why.
2. The logging needs to save a certain amount of samples to the text file. If my 'False' state lasts for 1 second, I need to have 1000 samples. If 2seconds, 2000 seconds, if 1.5seconds, 1500 samples..you get the idea. At current I am only getting 100 samples at a time, at dt of .1
Code below:
09-26-2014 09:39 AM
It seems that my shift register and logic does the correct item.
It is initialized as FALSE. Injection goes TRUE, the output of the logic of the shift registers on the left is still FALSE. When the Injection goes FALSE, the output of the shift registers is TRUE (not false & True = True) and so the logging should occur, however it seems to have recorded at the wrong time, perhaps of how the data acquired is buffered? This is where I am lost..thanks!
09-26-2014 09:44 AM - edited 09-26-2014 09:50 AM
I am guessing it is because the DAQmx Read occured during the time when it was *not* logging, so it simply records whatever is available at the time the case goes TRUE? How do I go about getting it to acquire during the time it goes TRUE?
I had it working prior, but the issue became that I need to do all of the following (some of which is not in my code yet):
-Read Voltage on AI0/Record Voltage on AI0 (the logging I am trying to achieve as described)
-Read voltage on AI1 (and simply display it, continuously, for observation)
-Read current on AI2 (still need to implement; and simply display it, continuously, for observation)
The other things my program does is:
-Set voltage on AO0
-Set current on AO1. (still need to implement)
09-26-2014 09:51 AM
I can't speak about your timing issues- it is difficult to tell from a picture (insert a snippet!) where we can't see the data that is setting up the timing for the channel.
As to logging..... why is this missing from your block diagram?![]()
Use your boolean to enable/disable logging or just log all data encluding the boolean and post process it by timestamp to ignore the "injection" times
09-26-2014 09:55 AM
Customer requests .txt file logging, not TDMS.
The output needs to be a simple 2 column file with time in the first column and data in the second.
Setup for both channels. Example 'Delay(s)' is: 1. In this case, I should be logging 1000 data points.
09-26-2014 10:23 AM
09-26-2014 10:55 AM
Thanks Dennis.
i seem to have issues w my UI updating when I specifiy samples to read. It appears to lag, which is OK, as long as the timing is still correct..
Can I acquire continuously, without specifing how many samples, but specify how many samples to read?
09-26-2014 11:07 AM
@belopsky wrote:
Thanks Dennis.
i seem to have issues w my UI updating when I specifiy samples to read. It appears to lag, which is OK, as long as the timing is still correct..
Can I acquire continuously, without specifing how many samples, but specify how many samples to read?
DAQmx Read will return the number of samples requested immediatly if they are available otherwise it will wait for the number of samples requested to be avilable and return the number of samples requested. This of course, means that the loop will only iterate no faster than "number of samples * Sample rate". (probably what you mistook for "Lag") IF the number of samples requested is not available before the timeout period DAQmx Read will return with the number of samples available and a timeout in the error cluster so your calling code can handle the exception intelegently. If the number of samples requested is -1 DAQmx Read returns the number of samples available now without waiting at all.
Clear?
09-26-2014 12:57 PM
Thanks, yes, that seems to make sense, I suppose my question is:
What must I do to ensure that the samples I need to log are available when logging occurs? It is pretty time sensitive that this be right..
I need to record as soon as the injection goes FALSE and stop as soon as it goes TRUE..
09-26-2014 01:34 PM
I suppose the issue is that I cannot have my while loop lag, as it then slows down my relay control and some voltage events (i have voltage that drops and ramps depending on the relay).
I am working off some old Labview code that used TraditionalDAQ. The setup is in a stacked sequence structure where the 'AI Start' and 'AI Config' are in the first frame, and the 'AI Read' is in the main acquisition loop.
See below for old code: