03-11-2010 09:43 AM
03-11-2010 11:35 AM
Can you post what you coded so far?
Or at least a screen capture (image) of the code..
The black color means that there is no data type associated to the Shift Register.
What error message do you get?
03-11-2010 02:29 PM
03-11-2010 04:03 PM
You are getting the signals from DAQ, right? I can't remember if you mentionned what you were measuring (signal) what the voltage level measured by the DAQ was and at what rate you were sampling the data, as well aswhat is the rate of change of the signal.
Just for the fun of experimenting, try putting your threshold to some really low value, like 0.1 or even 0 (zero) to write data to file.
Then open the file and look at each measurement. Do some delta calculations and you may find that a threshold of 1 is way too high and the boolean is never true at the Case Structure.
Another easy way of verifying this is to turn on "Highlight Execution" and place a probe at the boolean wire and the delta value (double) before the comparison (>).
I think you will find the answer to why it does not write to file.
🙂
03-12-2010 10:30 AM
Ray has an excellent point. It could be that your delta values are never greater than the threshold you have set, thus you are never writing to a file. Also, I opened up the Write to Measurement File Express VI that you are using and one thing you might want to make sure of is to select the "Append to File" option rather than the "Use Next Available Filename" option. The option you currently have set will create a new file each time you enter the True case, but it sounds like you would like to have only one file with all the values that have a delta greater than your threshold. Give Ray's suggestions a try and also be sure to change your Write to Measurement File configuration.
Regards,
03-15-2010 11:55 AM
Ok, so I have the threshold properly working. However, I have run into more problems. The time column seems to be messed up, and I get multiple readings for one time. I think the for or if loops are doing something with it that I cannot figure out. In addition, I have three channels that I am trying to record, but end up with only one in the text file. Below is an example of what is being recorded into the text file.
Just to clarify what I am doing- I have an 3-axis accelerometer that is outputting voltages that I am then acquiring through the DAQ. I am sampling at 64 Hz, and want the data to be written to the text file only when the threshold conditions are met. I need a separate column for each axis (X, Y, Z) and a time column that reflects when it is being recorded.
0.000000 2.475296
0.000000 1.579085
0.000000 1.684749
1.562500 2.470786
1.562500 1.587783
1.562500 1.668642
3.125000 2.474652
3.125000 1.606790
3.125000 1.680239
4.687500 2.250116
4.687500 2.190841
4.687500 1.715675
6.250000 2.537793
6.250000 1.520455
6.250000 1.877392
7.812500 2.529739
7.812500 1.707299
7.812500 1.801688
9.375000 2.402813
9.375000 1.559434
9.375000 1.937956
10.937500 2.302303
10.937500 1.223437
10.937500 1.724695
12.500000 2.530706
12.500000 1.611944
14.062500 2.501068
14.062500 1.671541
15.625000 1.462791
15.625000 1.980479
15.625000 0.872943
17.187500 1.773017
17.187500 0.969265
17.187500 1.678628
18.750000 1.729850
18.750000 0.894205
18.750000 1.924426
03-15-2010 02:26 PM
Faizah wrote:The time column seems to be messed up, and I get multiple readings for one time.
Do you have any delay(s) in your loop(s)? Even 1 ms..
Are you doing 3 different readings per iteration?
Do you have 3 parallel loops?
The time column may not be messed up, it may take 3 readings, but a single timestamp was taken.
There may be other reasons... Can you post your code?
03-15-2010 02:36 PM
03-15-2010 02:48 PM - edited 03-15-2010 02:53 PM
You have stripped all time information from the data by converting the dynamic data to a 1D array of DBL. Since you are writing one sample at a time to a file, not sure what time data you want to record. To record the absolute time, you would have to convert to waveform data type, get the t0 and dt with the Get Waveform Components. You would then calculate an absolute or relative time for each sample that you write.
You should know how many readings per iteration you are doing and you most definitely have a loop. That is something that you set in the DAQ Assistant. You set a rate of 64 S/sec and tell it to return 100 samples. Kind of an odd rate but the number samples is the number of readings. The loop is the squarish object around your code. If you do not recognize that as a loop, you really should be taking the basic tutorials.
Edit - since you are doing continuous acquisition and using the Write to Measurement File, do not be surprised if you eventually get an error that you are not reading the samples fast enough. You might want to build an array of values to write and pass that to another loop with a queue.
03-15-2010 03:35 PM