Is there a method to name tables at run time. I am attempting to create a common CR800 program that will run on several dataloggers, but that will output a table named for the specific datalogger.
We will be using these dataloggers in an RS-485 bus configuration with telephone connection to remote PC. The sensors, ECI corrosion sensors, are SDI12 each with its own unique address. Each of 8 datalogger can have 6-10 sensors so I am looking at 48-60 tables which if we define in the common program exceeds the limit of 30 tables.
It would be nice if we could change the name of the table at run-time so that it would be specific to the location/datalogger.
John
Virginia Technologies, Inc.
trinkle@vatechnologies.com
Assigning a Table Name at/on/during run time wouldn't be possible, but with a data logger OS modification I bet it could be done at compile time (using a Constant of type String). This isn't the first request for such capability. But, unfortunately this ability does not currently exist.
Four things come to mind
1) Maintain a master program where all references to the table name is something easy to search for and replace. For example "<TABLENAME>". Before deploying the program, you can do a find and replace for "<TABLENAME>" using the desired name.
2) Similarly, write a CRBasic program that finds and replaces all occurrences of "<TABLENAME>" in the master and then marks it to run now and on start up (FileManage). You'd want to make sure that the process was lined out in such a way that a simple power cycle would not destroy your internal tables.
3) Use Conditional compiling, but you might as well be using #1 above (in my opinion).
4) Use TableFile for generating station specific data files for collection.
------ #3---------------------------
Const SITE = "TWO"
Public PTemp, batt_volt
#If SITE = "ONE"
DataTable (TableOne,1,1000)
#ElseIf SITE = "TWO"
DataTable (TableTwo,1,1000)
#ElseIf SITE = "THREE"
DataTable (TableThree,1,1000)
#EndIf
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
EndTable
BeginProg
Scan (1,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
#If SITE = "ONE"
CallTable TableOne
#ElseIf SITE = "TWO"
CallTable TableTwo
#ElseIf SITE = "THREE"
CallTable TableThree
#EndIf
NextScan
EndProg
----- #4 -----------------------------
Const SITE = "TWO"
Public PTemp, batt_volt
Dim Outstat As Boolean
Dim LastFileName As String * 32
DataTable (Test,1,1000)
DataInterval (0,15,Sec,10)
TableFile ("USR:Table_" & SITE & "_",8,-1,0,1,Hr,Outstat,LastFileName)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
EndTable
BeginProg
SetStatus ("USRDriveSize",1000000)
Scan (1,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
CallTable Test
NextScan
EndProg
* Last updated by: Sam on 8/1/2011 @ 10:59 AM *
Sam, Thx. Your suggestions are helpful.
John