Hi, I'm streaming data from 3 table to a server via SFTP, with CR6-WiFi. Slow and Stat table update every 1 sec. Sonic table updates every 50msec (Sonic anemometer data).
With this three different slowsequence the filename on server changes correctly at Midnight and the file starts with 00:00:00 and end with 23:59:59.95 as I want. I obtain one file a day for each table.
BeginProg
sftp_flag = True
Scan (50,mSec,1200,0)
VoltSe(u_1,1,mV5000,U1,False,200,15000,0.02,-50) '-20)
VoltSe(v_1,1,mV5000,U2,False,200,15000,0.02,-50) '-20)
VoltSe(w_1,1,mV5000,U3,False,200,15000,0.02,-50) '-20)
VoltSe(Ts_1,1,mV5000,U4,False,200,15000,0.022,-40)
VoltSe(u_2,1,mV5000,U5,False,200,15000,0.02,-50) '-20)
VoltSe(v_2,1,mV5000,U6,False,200,15000,0.02,-50) '-20)
VoltSe(w_2,1,mV5000,U7,False,200,15000,0.02,-50) '-20)
VoltSe(Ts_2,1,mV5000,U8,False,200,15000,0.022,-40)
CallTable Sonic
NextScan
SlowSequence
Scan(1,Sec,10,0)
'Default CR6 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
VoltSe(AirTC1,1,mV1000,U10,False,0,15000,0.1,-40)
VoltSe(RH1,1,mV1000,U9,False,0,15000,0.1,0)
If RH1>100 AND RH1<103 Then RH1=100
VoltSe(AirTC2,1,mV1000,U12,False,0,15000,0.1,-40)
VoltSe(RH2,1,mV1000,U11,False,0,15000,0.1,0)
If RH2>100 AND RH2<103 Then RH2=100
CallTable Slow
CallTable Stat
CallTable Avg
NextScan
EndSequence
SlowSequence
Scan(30,Min,10,0)
If sftp_flag Then
date_sonic = Mid(Sonic.Timestamp(5,12000),1,10)
FTPResult3=FTPClient(IPAddress,UserName,Password,"Sonic","Sonic_" & date_sonic & ".dat",28,0,0,Min,-1008)
EndIf
NextScan
EndSequence
SlowSequence
Scan(30,Min,10,0)
If sftp_flag Then
date_slow = Mid(Slow.Timestamp(5,600),1,10)
FTPResult=FTPClient(IPAddress,UserName,Password,"Slow","Slow_" & date_slow & ".dat",28,0,0,Min,-1008)
EndIf
NextScan
EndSequence
SlowSequence
Scan(30,Min,10,0)
'Send to server
If sftp_flag Then
date_stat = Mid(Stat.Timestamp(5,600),1,10)
FTPResult2=FTPClient(IPAddress,UserName,Password,"Stat","Stat_" & date_stat & ".dat",28,0,0,Min,-1008)
EndIf
NextScan
EndSequence
EndProg
But there is bug: sometimes, only the Sonic table file on server looks like (look at datetime column):
"2025-10-23 20:54:01.7",114807,0.234,0.217,0.473,23.86,0.02,0.193,0.241,25.09 "2025-10-23 20:54:01.75",114808,0.266,0.209,0.159,23.84,0.025,0.187,0.244,25.09 "2025-10-23 20:54:01.8",114809,0.15,0.183,0.154,23.78,0.026,0.185,0.247,25.1 "2025-10-23 20:54:01.85",114810,0.093,0.178,0.103,23.86,0"2025-10-23 20:30:00",85973,0.216,0.182,0.161,23.81,0.024,0.193,0.245,25.09 "2025-10-23 20:30:00.05",85974,0.394,0.18,0.168,23.83,0.026,0.189,0.24,25.09 "2025-10-23 20:30:00.1",85975,0.062,0.178,-0.032,23.85,0.018,0.193,0.239,25.09 "2025-10-23 20:30:00.15",85976,-0.027,0.199,0.476,23.82,0.025,0.187,0.244,25.09 "2025-10-23 20:30:00.2",85977,0.158,0.224,0.127,23.81,0.027,0.193,0.244,25.09 "2025-10-23 20:30:00.25",85978,0.36,0.196,0.143,23.82,0.019,0.192,0.25,25.08
I think is due to the high frequency of callTable Sonic. I have tried using TriggerSequence to enter the FTPClient() sequence, insteas using Scan. It didn't risolve the bug. What can I do?
Scan (50,mSec,1200,0)
VoltSe(u_1,1,mV5000,U1,False,200,15000,0.02,-50) '-20)
VoltSe(v_1,1,mV5000,U2,False,200,15000,0.02,-50) '-20)
VoltSe(w_1,1,mV5000,U3,False,200,15000,0.02,-50) '-20)
VoltSe(Ts_1,1,mV5000,U4,False,200,15000,0.022,-40)
VoltSe(u_2,1,mV5000,U5,False,200,15000,0.02,-50) '-20)
VoltSe(v_2,1,mV5000,U6,False,200,15000,0.02,-50) '-20)
VoltSe(w_2,1,mV5000,U7,False,200,15000,0.02,-50) '-20)
VoltSe(Ts_2,1,mV5000,U8,False,200,15000,0.022,-40)
CallTable Sonic
If TimeIntoInterval(0,30,Min) Then
TriggerSequence (2,0)
EndIf
NextScan
'slowsequence 1
SlowSequence 'Slowseq 2
Do
WaitTriggerSequence
date_sonic = Mid(Sonic.Timestamp(5,12000),1,10)
FTPResult3=FTPClient(IPAddress,UserName,Password,"Sonic","Sonic_" & date_sonic & ".dat",28,0,0,Min,-1008)
Loop
EndSequence
I think it probably does have something with the high rate of the sonic table keeping to too busy for the FTPClient instruction to always access it.
Maybe try using TableFile on the sonic table, and FTP the file when completed and closed. TableFile has an output flag variable you can use to trigger when to FTP. The FTP instruction then will be accessing a file instead of directly accessing the table.