Hi,
I am doing a measurement, which is triggered by some flags. So once the flag is -1 the measurement starts. After that I want to write the data just recorded to a datafile on the USR or CRD.
The only option I found is via TableFile, which does not satisfy me as the write interval I can set are limited by time and I have not found a possibility to write the data based on some trigger.
So the question is: Is there any posibbility to write the data of a particular measurement period to a file, based on a trigger and then reset the internal data storage for the next measurement?
Thanks in advance!
Ponce10
If I understand your problem correctly, you have a TableFile instruction within DataTable/EndTable structure. Since the DataTable instruction includes the possibility of using a flag to trigger the table's operation, it seems to me that it would solve your problem.
For example, the following code comes from the CR9000 help section with a modification to the first line. In it, the DataTable is executed when Flag(1) is true.
DataTable (Test,Flag(1),-1)
DataInterval (0,5,Min,10)
TableFile ("CRD:Test",8,-1,0,60,Min,OutStat,LastFileName)
Sample (1,Bat,FP2)
Sample (1,Temp,FP2)
EndTable
Unfortunately that does not solve the problem. I am running into the same problem...
It would help us if we could see your code, at least the portion including the data table.
Right. Sorry for that.
So here we go. The Data table part of the program looks like this:
DataTable(HighFR,WriteDataH,-1)
DataInterval(0,Averageinterval,sec,1)
DataEvent(0,MST,MEN,0)
TableFile ("CRD:Test",8,-1,0,Measinterval,Sec,OutStat,LastFileName)
Average(1,dp1,IEEE4,False)
EndTable
The output file looks then something like this:
"TOA5","WT_Logger","CR1000","E7922","CR1000.Std.27","CPU:WS_Meas.CR1","44751","HighFR"
"TIMESTAMP","RECORD","dp1_Avg"
"TS","RN",""
"","","Avg"
"2015-01-13 15:48:38",0,0.27,0
"2015-01-13 15:48:39",1,0.27,0
"2015-01-13 15:48:40",2,0.27,0
"2015-01-13 15:48:41",3,0.27,0
"2015-01-13 15:48:42",4,0.27,0
"2015-01-13 15:48:43",5,0.27,0
"2015-01-13 15:48:44",6,0.27,0
"2015-01-13 15:48:45",7,0.27,0
"2015-01-13 15:48:46",8,0.27,0
"2015-01-13 15:48:47",9,0.27,0
"2015-01-13 15:48:48",10,0.27
"2015-01-13 15:48:49",11,0.27
"2015-01-13 15:48:50",12,0.27
"2015-01-13 15:48:51",13,0.27
"2015-01-13 15:48:52",14,0.27
"2015-01-13 15:48:53",15,0.27
"2015-01-13 15:48:54",16,0.27
"2015-01-13 15:48:55",17,0.27
"2015-01-13 15:48:56",18,0.27
"2015-01-13 15:48:57",19,0.27
"2015-01-13 15:48:58",20,0.27
"2015-01-13 15:48:59",21,0.27
"2015-01-13 15:49:00",22,0.27
What is important here is that the measurement was started at 15:48:38 and was supposed to run for 30 seconds until 15:49:08. The data are actually recorded until 15:49:08, but the file was written once the full minute was reached, so the data file that has been written to the card only reflects values up to 15:49:00.
My problem is that I do not find a way to write the data between 15:48:38 and 15:49:08 into one file.
Further ideas are highly welcome!
I have another question on top of the above decribed problem. I am using the Tablefile Instruction within Datatable declaration. So far so good, but it is not possible to update the number of data that will be written into the new file:
TableFile("CRD:"+FileName,8,-1,Measinterval,0,Sec,OutStat,LastFileName)
The variable "Measinterval" is updated based on user input. Nevertheless the number of data recorded is not changing! If I set Measinterval = 20 for example and change it then to 10 no file is written, as there are not 20 data in the final datatable.