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.

How to store daily files with datestamp as part of filename using TableFile


Darwyn72 Jul 14, 2022 10:15 AM

Hello, I am interested to know if I can store daily 24hr files on a CR1000X with the day's date on each file, instead of an icrementing number.

The program I have is sampling every 10 minutes from Skye and Decagon sensors. The line I have a question about is lines 94 - 98: (rest of program below) I want to store daily files with the format: SWE-SVB-SVB-FOR-F01_yyyymmdd

'Define Data Tables
DataTable(SWE-SVB-SVB-F01,True,-1)
DataInterval(0,SampleInterval,Min,10)
TableFile ("CRD:SWE-SVB-SVB-FOR-F01_",12,-1,0,1,Day,OutStat,LastFileName)
Sample (1,timestamps,String)

 Does anyone have any tips how to do this? Presumeably I need to specify a As String to cover the number of characters, (28) but should I just put the first date that the unit is on, as the filename and hope that it will increment by date to the card?

Thank you for any tips,

Paul

 

'Info about previous versions here
'Wiring details:
'Sensor SKYE Upward 46435
'Sensor SKYE Downward 46437
'Sensor Decagon SRS Ni 001
'Sensor Decagon SRS Nr 001
'Sensor Decagon SRS Nr 002
'Sensor Decagon SRS Ni 002

'formatting timestamp according to ETC
Dim timestamps  As String * 22 ' this variable will first receive a timestamp
'with 22 characters, following this format : yyyy-MM-dd_HH-mm-ss

Dim OutStat
Dim LastFileName As String *60

Public BattV
Units BattV = Volts
Public PAirTemp_C
Units PAirTemp_C = Deg C

' Skye sensor 1 pair
'Skye 46434: Signal vires -> SE 1,2,3,4
Public Up_530_150m_Avg
Public Up_570_150m_Avg
Public Up_644_150m_Avg
Public Up_858_150m_Avg
Units Up_530_150m_Avg = mV
Units Up_570_150m_Avg = mV
Units Up_644_150m_Avg = mV
Units Up_858_150m_Avg = mV

'Skye 46437: Signal vires -> SE 5,6,7,8
Public Dw_530_100m_Avg
Public Dw_570_100m_Avg
Public Dw_644_100m_Avg
Public Dw_858_100m_Avg
Units Dw_530_100m_Avg = mV
Units Dw_570_100m_Avg = mV
Units Dw_644_100m_Avg = mV
Units Dw_858_100m_Avg = mV

' Decagon sensor 2 pairs mounted below canopy
'NDVI Ni001: data red wire->C1; Power white wire->SW12
Public Up01(3)
Alias Up01(1) = Up_650_2m_1_Avg ' NDVI Ni01 Ch1
Alias Up01(2) = Up_860_2m_1_Avg ' NDVI Ni01 Ch2
Alias Up01(3) = Up_1_tilt

'NDVI Ni002: data red wire->C5; Power white wire->SW12
Public Up02(3)
Alias Up02(1) = Up_650_2m_2_Avg ' NDVI Ni01 Ch1
Alias Up02(2) = Up_860_2m_2_Avg ' NDVI Ni01 Ch2
Alias Up02(3) = Up_2_tilt

'NDVI Nr001: data red wire->C3; Power white wire->SW12
Public Dw01(3)
Alias Dw01(1) = Dw_650_2m_1_Avg ' NDVI Nr01 Ch1
Alias Dw01(2) = Dw_860_2m_1_Avg ' NDVI Nr01 Ch2
Alias Dw01(3) = Dw_1_tilt

'NDVI Nr002: data red wire->C7; Power white wire->SW12
Public Dw02(3)
Alias Dw02(1) = Dw_650_2m_2_Avg ' NDVI Nr01 Ch1
Alias Dw02(2) = Dw_860_2m_2_Avg ' NDVI Nr01 Ch2
Alias Dw02(3) = Dw_2_tilt

'Units For Public varibles
'Decagon Ni001
Units Up_650_2m_1_Avg = mV
Units Up_860_2m_1_Avg = mV
'Units Up01_tilt = Up_01
'Decagon Nr001
Units Dw_650_2m_1_Avg = mV
Units Dw_860_2m_1_Avg = mV
'Units Dw01_tilt = Down_01
'Decagon Ni002
Units Up_650_2m_2_Avg = mV
Units Up_860_2m_2_Avg = mV
'Units Up02_tilt = Up_02
'Decagon Nr002
Units Dw_650_2m_2_Avg = mV
Units Dw_860_2m_2_Avg = mV
'Units Dw02_tilt = Down_02

'Define constants - these are values with names that can be accessed by the program, but cannot be changed
Const SampleInterval = 10 'in minutes

'Define Data Tables
DataTable(SWE-SVB-SVB-F01,True,-1)
  DataInterval(0,SampleInterval,Min,10)
  TableFile ("CRD:SWE-SVB-SVB-FOR-F01_",12,-1,0,1,Day,OutStat,LastFileName)
  Sample (1,timestamps,String)

  Minimum(1,BattV,FP2,False,False)
  Average(1,PAirTemp_C,FP2,False)

  Average(1,Up_530_150m_Avg,FP2,False)
  Average(1,Up_570_150m_Avg,FP2,False)
  Average(1,Up_644_150m_Avg,FP2,False)
  Average(1,Up_858_150m_Avg,FP2,False)

  Average(1,Dw_530_100m_Avg,FP2,False)
  Average(1,Dw_570_100m_Avg,FP2,False)
  Average(1,Dw_644_100m_Avg,FP2,False)
  Average(1,Dw_858_100m_Avg,FP2,False)

  Average(1,Up_650_2m_1_Avg,FP2,False)
  Average(1,Up_860_2m_1_Avg,FP2,False)
  Average(1,Up_1_tilt,FP2,False)
  Average(1,Dw_650_2m_1_Avg,FP2,False)
  Average(1,Dw_860_2m_1_Avg,FP2,False)
  Average(1,Dw_1_tilt,FP2,False)

  Average(1,Up_650_2m_2_Avg,FP2,False)
  Average(1,Up_860_2m_2_Avg,FP2,False)
  Average(1,Up_2_tilt,FP2,False)
  Average(1,Dw_650_2m_2_Avg,FP2,False)
  Average(1,Dw_860_2m_2_Avg,FP2,False)
  Average(1,Dw_2_tilt,FP2,False)
EndTable

'Main Program
BeginProg
  SetStatus("UsrDriveSize","8192") 'Sets the USR drive size IP address datafile minmum 8192

  'Main Scan
  Scan(10,Sec,1,0)
    'Default Datalogger Battery Voltage measurement 'BattV'
    Battery(BattV)
    'Default Wiring Panel Temperature measurement 'PAirTemp_C'
    PanelTemp(PAirTemp_C,_50Hz)

    'The Skye sensor with inbuilt op-amp need 5-15V power up for at least 0.5 Sec
    SW12(1)
    Delay(0,500,mSec)
    'Skye 46434
    'Generic Differential Voltage measurements 'Up_531'
    VoltSe(Up_530_150m_Avg,1,mV2500,1,True,0,_50Hz,1,0)
    'Generic Single-Ended Voltage measurements 'Up_570'
    VoltSe(Up_570_150m_Avg,1,mV2500,2,True,0,_50Hz,1,0)
    'Generic Single-Ended Voltage measurements 'Up_640'
    VoltSe(Up_644_150m_Avg,1,mV2500,3,True,0,_50Hz,1,0)
    'Generic Single-Ended Voltage measurements 'Up_860'
    VoltSe(Up_858_150m_Avg,1,mV2500,4,True,0,_50Hz,1,0)

    'Skye 46437
    'Generic Single-Ended Voltage measurements 'Dw_531'
    VoltSe(Dw_530_100m_Avg,1,mV2500,5,True,0,_50Hz,1,0)
    'Generic Single-Ended Voltage measurements 'Dw_570'
    VoltSe(Dw_570_100m_Avg,1,mV2500,6,True,0,_50Hz,1,0)
    'Generic Single-Ended Voltage measurements 'Dw_640'
    VoltSe(Dw_644_100m_Avg,1,mV2500,7,True,0,_50Hz,1,0)
    'Generic Single-Ended Voltage measurements 'Dw_860'
    VoltSe(Dw_858_100m_Avg,1,mV2500,8,True,0,_50Hz,1,0)

    'Query sensor for 3 SDI-12 outputs.  Default address for all Decagon Digital sensors is 0.'
    Move (Up01(),3,NAN,1)
    Move (Dw01(),3,NAN,1)
    Move (Up02(),3,NAN,1)
    Move (Dw02(),3,NAN,1)
    SDI12Recorder (Up01(),1,0,"M!",1.0,0)
    SDI12Recorder (Dw01(),3,0,"M!",1.0,0)
    SDI12Recorder (Up02(),5,0,"M!",1.0,0)
    SDI12Recorder (Dw02(),7,0,"M!",1.0,0)

    'Turn SW12V off
    SW12(0)
    
    CallTable SWE-SVB-SVB-F01
  NextScan
EndProg
Log in or register to post/reply in the forum.