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.

Send the table file to the ftp server without loggernet.


echokr Dec 4, 2008 10:23 PM

I'd like to send the table file directely to the ftp server running PC without loggernet.
In addition I will not use Ethernet interface like NL115 but use CDMA modem's TCP/IP command through RS232 port of CR1000.
In other word, I will use CR1000's RS232 port to the ftp client for sending the table file to the ftp server running PC.

using AT command of CDMA modem I can connect ftp server and login via programming the serialout istruction of CR1000.
After login the ftp server what instructions needed for sending the table file of cr1000.
I need sample program example.
Thanks.

James


IslandMan Dec 5, 2008 10:57 AM

echokr,

Here's an example program that sends Panel Temp and Battery via FTP to a server once an hour.

IslandMan

'CR1000 Series Datalogger
'Program Name: FTP Data Table Example.CR1

'Declare Public Variables
Public PTemp, batt

'FTP Variables
Public FTPSuccess As Boolean
Public OutStat As Boolean
Public LastFileName As String * 25

'FTP Information
Const IPAddress="anyftpsite.com"
Const User="user"
Const Password="password"
Const Filename = "FTPdata.dat"

'Define Data Tables
DataTable (FTP,1,-1)
TableFile ("USR:FTP",12,5,1,0,Min,OutStat,LastFileName)
Sample (1,PTemp,FP2)
Sample (1,batt,FP2)
EndTable

'Main Program
BeginProg

'Set up USR drive to write data
SetStatus ("USRDriveSize",31744)

'Scan every hour
Scan (60,Min,0,0)

'Measure Panel Temperature
PanelTemp (PTemp,250)
'Measure Battery Voltage
Battery (batt)
'Call Data Table
CallTable (FTP)

'FTP Data
If Outstat Then
FTPSuccess = FTPClient (IPAddress,User,Password,LastFileName,Filename,0)
EndIf

NextScan
EndProg


echokr Dec 6, 2008 02:38 AM

IslandMan,

Thanks for your reply.
But I don't use Network devices like NL115.
I use CDMA TCP/IP external modem through RS232 port of CR1000.
I think the FTPClient instruction is for NL115.
for example, AT command of the CDMA modem is as belows.
Using the serialout instruction(Above AT commamds) of CR1000, cr1000 can be connected to the ftp server.

AT+CRM=130 ; change the modem to the TCP/IP connection mode
AT+DIP="XXX.XXX.XXX.XXX" ; ip address of the ftp server
AT+DPORT="2000" ; port# of the ftp server
ATDT1234 ; TCP/IP connction.

The ftp server reply the hello message.
But I couldn't send the tablefile in the USR drive of CR1000 after conncting the ftp server .


If you wish to send the data file in your PC to the ftp server you can use ftp commands in dos windows like belows sample.

open XXX.XXX.XXX.XXX XXXX(port#)
user id
password
ascii mode
put 000.dat
quit

I wish to know if CR1000 can be worked above commands by itself.

Thanks


IslandMan Dec 6, 2008 09:57 AM

echokr,

Sorry, what I neglected to add was that you use Device Config to set up the RS232 port for PPP. If you take a look at the latest RavenXT manual, Section B, there are instructions in there on how to set the RS232 port for PPP.

Not sure why you'd want to hard code all this when it's a simple matter of configuring the RS232 port and using the built in FTPClient command. :-)

If you want to use your commands, just use the part of the program I listed regarding:

TableFile ("USR:FTP",12,5,1,0,Min,OutStat,LastFileName)

'Set up USR drive to write data
SetStatus ("USRDriveSize",31744)

Use OutStat = true to call your manual code.

Regards,
Islandman


Ludo Feb 9, 2018 06:13 AM

I'm sending datas with FTP protocol (CR1000) to a server. Everything works but with your code I don't receive the file at midnight. I transfer the datas every 4 hours. Can you help me ?


smile Feb 9, 2018 06:33 AM

Hi,

CS has long since added the functionality of the data streaming and it's all simpler.

For modems you have to use the PPP in the setting or the PPPopen and PPPclose instructions in the program, the modem manuals are well described.

Smile


Ludo Feb 9, 2018 03:00 PM

I don't have any problems with the transmission and the data transfer with PPP. I received the files on my server during the day but the one at midnight no ! That's my Problem ?


smile Feb 9, 2018 08:37 PM

Hi Ludo,

do you have any errors in the status, for example skipped scans?


Ludo Mar 1, 2018 12:44 PM

I don't fint anything in the status while nothing is writted at midnight. I don't have any information in the TxLog table but the datas are recorded.Only one minute before and one minute after all is right.  Here's my configuration :

Public BattV

Public PTemp_C

Public SDI12(5)

Public WS_ms

Public WindDir

Public Rain_mm

Public ext_mm

 

Alias SDI12(1)=Temp

Alias SDI12(2)=Humrel

Alias SDI12(3)=Humabs

Alias SDI12(4)=Rosee

Alias SDI12(5)=Melange

 

Units BattV=Volts

Units PTemp_C=Deg C

Units WS_ms=meters/second

Units WindDir=degrees

Units Rain_mm=mm

Units ext_mm=mm 'remplace mv en mm pour affichage'

Units Temp=deg

Units Humrel=%

Units Humabs=g/m3

Units Rosee=deg

Units Melange=g/kg

 

Public OutStat As Boolean

Public LastFileName As String * 31

 

Const Host = "XXX" 'adresse serveur

Const User = "XXX"

Const Pass = "XXX"

Const RDir = XXX_"

Public RName As String * 63

Public Success As Boolean

 

'Define DATA TABLES

 

DataTable(TRH_sdi12,True,-1)

      DataInterval(0,10,Min,10)'interval 10 minutes signifie vitesse de scan et enregistrement dans table'

      TableFile ("USR:Gold_",8,5,0,1,Hr,OutStat,LastFileName)'fichier crée   pour transfert FTP et transfert toutes les 1 heure

      Sample(1,BattV,FP2)

      Sample(1,PTemp_C,FP2)

      Sample(1,Temp,FP2)

      Sample(1,Humrel,FP2)

      Sample(1,Humabs,FP2)

      Sample(1,Rosee,FP2)

      Sample(1,Melange,FP2)

      Sample(1,WindDir,FP2)

      Sample(1,WS_ms,FP2)

      Totalize(1,Rain_mm,FP2,False)

      Sample(1,ext_mm,FP2)

      FieldNames("Ext_mm")

      EndTable

 

DataTable(TxLog,1,1000)' table pour la verification des envois FTP

Sample (1,Success,Boolean)' si variable true c'est transmis

Sample (1,LastFileName,String)' nom du fichier transmis

Sample (1,RName,String)'nom du fichier enregistre sur serveur Crealp

EndTable

 

'MAIN PROGRAM

BeginProg

SetStatus("USRDriveSize",1000000)

PPPClose ' fermeture du PPP lors du lancement du programme pour eviter que le process de connection tourne

 'Main Scan

      Scan(5,Sec,1,0)

            'Default CR1000 Datalogger Battery Voltage measurement 'BattV'

            Battery(BattV)

            'Default CR1000 Datalogger Wiring Panel Temperature measurement 'PTemp_C'

            PanelTemp(PTemp_C,_60Hz)

            'Generic SDI-12 Sensor measurements 'Temp', 'Humrel', 'Humabs',

            'Rosee', and 'Melange'

            SDI12Recorder(SDI12(),1,"0","M!",1,0)

            '05103 Wind Speed & Direction Sensor measurements 'WS_ms' and 'WindDir'

            PulseCount(WS_ms,1,1,1,1,0.098,0)

            BrHalf(WindDir,1,mV2500,4,2,1,2500,True,20000,_60Hz,355,0)

            If WindDir>=355 Or WindDir<0 Then WindDir=0

            'CS700 Rain Gauge measurement 'Rain_mm'

            PulseCount(Rain_mm,1,2,2,0,0.2,0)

            'Generic Half Bridge measurements 'ext_mm'

            BrHalf(ext_mm,1,mV2500,1,1,1,2500,True,0,_60Hz,300,0)'att:facteur 300 correspond extenso 300mm'

            'Call Data Tables and Store Data

            CallTable TRH_sdi12

            If OutStat Then TriggerSequence (1,100)

 

      NextScan

 

' transfert FTP avec PPP open puis close

SlowSequence

Do

WaitTriggerSequence

SemaphoreGet (1) 

SW12 (1)

Delay(0,45,Sec)

 

PPPOpen 'Open the PPP

Delay(0,30,Sec)

 

RName = RDir & Replace (LastFileName,"USR:","")

If FileTime(LastFileName) > 0 Then 'if file exists

Success = FALSE

Success = FTPClient (Host,User,Pass,LastFileName,RName,2) 'attempt to ftp

CallTable (TxLog) 'diagnostics table

EndIf

SemaphoreRelease (1)'redonne le port com

 

PPPClose ' fermeture du protocol PPP

Delay(0,20,Sec)

 

SW12 (0)'turn off the modem

Loop

EndSequence

 

EndProg

Thank you for your help !

 

 

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