Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Event based table triggered to write at next 5 minute interval


AMK Dec 4, 2017 06:08 PM

Hello Forum,

We have a table on a CR1000 that is used to store values manually entered by a tech via ten key. They will manually measure a temperature, snow depth, use a 0,1 to indicate a sensor cleaning, etc. Currently these values are written to a table every 5 minutes. Most of the time, these values are a NaN. 

Is there a way to filter a datatable to delete rows where certain fields are all NaN or is there a way to set up an event based table so that it writes only at a defined interval?

Thanks,

AMK 


JDavis Dec 4, 2017 06:24 PM

It could be accomplished with the DataEvent instruction, or the TrigVar parameter of the DataTable instruction.

The TrigVar parameter is the simplest. The DataEvent instruction has more flexibility.

DataTable (Test,PTemp <> NAN,100)
   DataInterval (0,15,Sec,10)
   Minimum (1,Batt_volt,FP2,False,False)
   Sample (1,PTemp,FP2)
EndTable

When you have some kind of conditional table, it is recommended to not leave the size on autoallocate. Giving it more space than it needs takes space away from other tables.


AMK Dec 4, 2017 06:40 PM

@JDavis,

This is almost exactly what I'm looking for.

Is there a way to set up the TrigVar to check for <>NAN on multiple variables - (there's not much on that frunction in the Help docs)? There will always be a value for SiteID, LoggerID, and ProgID.

DataTable(SYS,true,-1)
DataInterval(0,5,min,10)
Sample (1,SiteID,FP2)
Sample (1,LoggerID,FP2)
Sample (1,ProgID,Long)
Sample(1,SITE_VISIT,FP2)
Sample(1,EC_BRUSH,FP2)
Sample(1,STAGE_RESET,FP2)
Sample(1,WATER_SAMP,FP2)
Sample(1,STAGE_HOOK,FP2)
Sample(1,AIRTEMP_CHECK,FP2)
Sample(1,EC_CHECK,FP2)
Sample(1,WATERTEMP_CHECK,FP2)
EndTable


JDavis Dec 4, 2017 07:19 PM

You can combine multiple logical expressions with operators like OR.

It could be easier to manage by making a boolean variable that turns the table on or off. Then you can set that variable with a logical statement within your scan.


AMK Jan 4, 2018 05:49 PM

@Jdavis,

The program guidance above works very well. One issue the field crew is having is after they initialize the table by setting a TrigVar, the values are sometimes written to the final storage table (thus public values return to nan) before they finish and they have to go back and enter all the manual values again. Is there a way to stop this from happening?

Thanks again,

AMK  

Log in or register to post/reply in the forum.