11-22-2011 10:09 AM
Hi All
I have a large vi which consists of a sequence of frames which execute one after another following data entry.
In the first few frames I set the instrument up and in the second last frame , I give the instrument a command to start doing a task.
In the last frame .....a timed loop ( 1 kHz clock option) is present which acquires the data every so often and exits when all the data is acquired.
A strange thing is happening...there seems to be a some kind of ''hidden' timer or clock which starts at the very beginning of the VI on the start of the first frame....by the time I get to my 'data acquire loop' frame ...the timing seems to be off for my data acquisition .....depending on how much time I take to enter the data.
Is there some way of starting the 'timing' when my 'data acquire loop' frame is initiated ?
Regards
B
11-22-2011 10:26 AM
Attach your code.
11-22-2011 10:32 AM
Its far too big mate
It is really a sequence of frames ...second last frame has a timed loop inside it which terminates when a certain number of data points have been acquired.
The only timing in the whole VI is the timed loop......I need time=0 (whatever that can mean) when the timed loop is intiated.
Each frame before the timed loop frame has a while loop which terminates on recieving a boolean signal (such as true or false) and then moves immediately onto the next frame.
I noticed the data acqusition depends on how fast it takes me to get through to the 'timed loop' frame ........Does some timing start with the While loops ?
regards
B
11-22-2011 10:37 AM
If you don't want to attach your VI, you can attach a picture. It is kind of difficult without looking at the code at all. I am suspecting that ran into a race condition.
11-22-2011 10:45 AM
Ok ...I will try and attach a picture when I get to the office tomorrow..
what is a race condition btw ?
B
11-22-2011 11:01 AM - edited 11-22-2011 11:02 AM
There are way too many open questions to solve this without seeing some code.
In any case, a simple state machine would probably be much more appropriate than a rigid train of sequence frames. Who wrote the code?
11-22-2011 11:04 AM
barrys wrote:
what is a race condition btw ?
http://en.wikipedia.org/wiki/Race_condition
You're spewing out a lot of "timing" statements, with very vague explanations. There is no "hidden" timer that starts at the beginning of a VI. There is no relationship with "timing starting" with while loops somewhere else in the code. I have no idea why you would think that a while loop and a timing loop would have any connection as far as "timing starting". You also state that your "timing is off" in your timed loop. Yet you said that you're supposed to run the loop until you receive all of your data. What is the criteria for this? Time or quantity? If it's quantity why are you using a timed loop? You also said "the timing seems to be off for my data acquisition .....depending on how much time I take to enter the data.". OK, so are you entering the data, or is the data coming from the instrument?
As noted, unless you provide a better explanation of what you are doing, you're going to need to show us some code. It's very confusing as to what you are actually doing.
11-22-2011 11:07 AM
Your explanation is confusing. You say the loop terminates on number of samples acquired and yet you are concerned about having t=0. I don't see how any sort of clock can affect a sample count.
11-22-2011 11:27 AM
I will try and answer each response and post the code tomorrow
@altenbach
1.I know the timing is off because the instrument starts spitting out NaN. If I enter all my 'set up' parameters quickly enough the data is acquired with little or no NaN. I found the NaN to be due to the loop overunning the instrument.
2. I think I am running on the plain development computer.
3. I use a timed loop because the instrument is a potentiostat which acquires data at a set rate depending on the scan rate ...the loop is timed according to the scan rate and therefore is a few timeframes just behind the instrument as the potentiostat is an old one.
I wrote the code , the rigid frame is due to my inexperience , but for this application it just needs to work and not look pretty. I enter my instrument set-up parameters sequentially (in sections) and thus a rigid sequence fits well (in this case)
11-22-2011 11:32 AM
@ smercurio_fc
The 'data acquisiton loop' terminates when the last data point # (as a number) is acquired. Off the instrument the string is composed of 3 numbers ...the data point #, the current , the potential...I know how many data points in a scan and thus I terminate the loop when total # iterations = total number of data points.
I set the instrument up first , with scan parameters ( a potentiostat) , current levels, define the potential scan e.t.c. and then I tell the instrument to 'run' the defined scan. The data is acquired by asking the instrument for the last data point taken , to which it replies with the 3 number string as above. As the instrument is old I have found it a lot safer to be a few data point numbers behind the actual data point acquired otherwise the instrument times out and spits out NaN.
Wil post code tomorrow.