Hi
This is a simplified version of a program that I am trying to write - I am trying to get the program to send a time stamped file every 24 hours.
The full program also has an AM416 multiplexer, about 10 more sensors, and a few subroutines.
I am just trying to get the FTP part to work right now, but must be missing something. Thanks.
-------------------------------------------------------
'CR1000
'\\\\\\\\\\\\\\\\\\\\\\\\ Declare Variables and Units ///////////////////////////
Public BattV
Public GHR
Public Newfilename As String *50 'holds the timestamped destination filename
Public RemoteFileName As String *50
'Define constants - these are values with names that can be accessed by the program, but cannot be changed
Const ServerIP = "IP.address" 'This is the address of the FTP server that you want to send files to
Const User = "user" 'This is the user name needed to login to the FTP server
Const Password = "password" 'This is the password needed to login to the FTP server
Const DestPath = "/srv/home/jdr2823/Solar_data" 'This is the destination directory where the FTP'ed file will be saved on the FTP server
Units BattV=Volts
Units GHR=mV
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Build Table /////////////////////////////////////
'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,1,Min,10)
Average(1,BattV,FP2,False)
Average(1,GHR,FP2,False)
EndTable
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Main Program ///////////////////////////////////
BeginProg
Scan(5,Sec,1,0)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
'Generic Differential Voltage measurements GHR
VoltDiff(GHR,1,mV25,1,True,0,_60Hz,109.769,0)
'Call Data Tables and Store Data
CallTable(Table1)
NextScan
EndProg
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Name and Send File ///////////////////////////
SlowSequence 'Just to do the ftp without interferring with measurements.
Scan (1,min,3,0) 'Every minute check.
Newfilename = DestPath & " " & Public.TimeStamp(4,0) 'A quick way of generating a timestamp
Newfilename=Replace(Newfilename,":","") 'Get rid of the colons - not allowed in filenames
RemoteFileName=Newfilename &".dat" 'add a fixed suffix
FTPClient (ServerIP,User,Password,"Table1",RemoteFileName,0,1440,0)
NextScan
-------------------------------------------------------
That should work but you would not expect the instruction to send any data until 1440 records have been stored, i.e. after at least one day since you started running the program. The logger makes no attempt to synchronise the output to real time.
I am afraid we have recommend that you do not use the new ftpclient options in OS25 for "streaming" data, as some further testing revealed a serious issue with its implementation. We will fix this for the next OS release.