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.

erasing USR


Sylvia Dec 7, 2015 08:35 AM

Hi,
We have a CR800, working with loggernet, sending files to our ftp via a fasttrack modem (with RS232 plug).
Receving files works, but the files sent are still present on the USR (instead of deleting them after sending sucess. Then, fter som time, USR is full, and sending process stops. The CR800 is creating new files (date of creation is changing!), erasing the old ones (writing on top of them...), but not sending anything anymore.
So it seems we have troubles with erasing files on the USR after sending them...
If someone knows how to help, it would be great!
Here's our program running:

'Declare Variables
Public BattV
Public PTemp_C
Public TRHData(2)
Alias TRHData(1)=AirTC
Alias TRHData(2)=RH
Public SlrkW
Public SlrMJ
Public T_ground
Public WS_ms
Public WindDir
Public Rain_mm
Public SR50A(2)
Alias SR50A(1)=DT
Alias SR50A(2)=Q
Public TCDT
Public DBTCDT
Public BP_mbar
Public i

Public ppp As String * 50

' Variable de temps
Public rTime(9)
Alias rTime(1) = Year 'assign the alias Year to rTime(1)
Alias rTime(9) = Day_of_Year 'assign the alias Day_of_Year to rTime(9)


Public testif As Boolean

'Declaration variables pour FILE QUEUE - empilage des fichiers si la connexion GPRS est mauvaise
Const QL = 3 'queue buffer size - 1 fichier / jour donc 50 jours de buffer !!!!!!!!!!!!!!!transforme de 50 a 3!!!!!!!!!!!!!!!!!!!!!!!!
Public Queue(QL) As String * 31

'TableFile variables
Public Outstat As Boolean, OutStatTrig As Boolean, LastFilename As String * 31
Public NewFileName As String * 50

'Declaration variables pour le FTP
Public FTPResult As Boolean
Public RemoteFileName As String * 50
Const LoggerID="sassiere"
Const IPAddress="134.214.32.76"
Const UserName="**********"
Const Password="**********"
Public LName As String * 31

'Parametre Modem
Const GPRS_ModemBaudRate = 9600 'This is the baud rate at which the modem is already configured
Const GPRS_ModemPort = ComRS232 'This is the port to which the modem is attached
Const GPRS_CR = CHR(13)
Const GPRS_OK = CHR(10)& "OK"


'Declare Variables and Units
Units BattV=Volts
Units PTemp_C=Deg C
Units SlrkW=kW/m^2
Units SlrMJ=MJ/m^2
Units T_ground=Deg C
Units WS_ms=meters/second
Units WindDir=degrees
Units Rain_mm=mm
Units BP_mbar=mbar
Units AirTC=Deg C
Units RH=%

'Declaration tableau de donnees
DataTable(donnees_sassiere,True,-1)
Average(1,PTemp_C,FP2,False)
Average(1,AirTC,FP2,False)
Maximum(1,AirTC,FP2,False,False)
Minimum(1,AirTC,FP2,False,False)
Average(1,T_ground,FP2,False)
Minimum(1,T_ground,FP2,False,False)
Maximum(1,T_ground,FP2,False,False)
Average(1,SlrkW,FP2,False)
Totalize(1,SlrMJ,IEEE4,False)
WindVector(1,WS_ms,WindDir,FP2,False,0,0,0)
FieldNames("WS_ms_S_WVT,WindDir_D1_WVT,WindDir_SD1_WVT")
Sample(1,RH,FP2)
Maximum(1,WS_ms,FP2,False,False)
Sample(1,WindDir,FP2)
Totalize(1,Rain_mm,FP2,False)
Average(1,DT,FP2,False)
Average(1,Q,FP2,False)
Average(1,TCDT,FP2,False)
Average(1,DBTCDT,FP2,False)
Sample(1,BP_mbar,FP2)
Minimum(1,BattV,FP2,False,False)
TableFile ("USR:sassiere",8,-1,0,24,Hr,Outstat,LastFilename)

EndTable

Sub ModemOFF 'arret du modem
'Shutdown procedure
PPPClose

SerialOpen(GPRS_ModemPort,GPRS_ModemBaudRate,0,20000,100)
'Send the modem shutdown command, trying up To 3 times To try To ensure the command
'Is actioned.
SerialOut(GPRS_ModemPort,"AT+CFUN=0" & GPRS_CR,GPRS_OK,3,200)
Delay(1,5,sec) 'delay a few more seconds just to be sure the modem is offline
SerialClose(GPRS_ModemPort) 'Release the serial port connection.
'Turn off the modem (where necessary)
SW12 (0)
Delay(1,10,sec)
EndSub

Sub ModemON ' demarrage du modem
SW12 (1) ' allimentation du modem
Delay(1,45,sec)
ppp=PPPOpen
Delay(1,15,sec)
EndSub

' stockage des fichiers en attente d'envoi dans une pile
Sub QueueAdd()
Dim i
If OutStatTrig Then 'add new file to queue
Day_of_Year=Day_of_Year - 1
NewFileName="USR:sassiere"+"_"+Year+"_"+Day_of_Year+"_"+rTime(4)+"_"+rTime(5)+".dat"
FileRename(LastFilename,NewFileName)
For i = 1 To QL 'find an empty spot
If Queue(I) = "" Then
Queue(i) = NewFileName
ExitFor 'queued so exit
EndIf 'end if queue
Next I 'end for I
If I > QL Then 'there wasn't room, make some and add
Move (Queue(1),QL-1,Queue(2),QL-1) 'shift queued names down - 2 to 1, 3 to 2, 4 to 3, etc.
Queue(QL) = NewFileName
EndIf
EndIf 'end if outstatTrig
EndSub

'enleve le fichier de la pile si celui-ci est envoye
Sub QueueRemove()
Move (Queue(1),QL-1,Queue(2),QL-1) 'shift queued names down - 2 to 1, 3 to 2, 4 to 3, etc.
Queue(QL) = "" 'clear trailing name
EndSub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'Programme principal
BeginProg

SetStatus ("USRDriveSize",3500000)'Definition de l'espace de stockage USR pour les donnees


'Mesure (intervalle de temps = 1, unite = minute, 0 = dure illimitee)
Scan(5,min,1,0)

'Default Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,_50Hz)
'CS215 Temperature & Relative Humidity Sensor measurements 'AirTC' and 'RH'
SDI12Recorder(TRHData(),3,"0","M!",1,0)
'CS300 Pyranometer measurements 'SlrMJ' and 'SlrkW'
VoltSe(SlrkW,1,mV250,1,1,0,_50Hz,1,0)
If SlrkW<0 Then SlrkW=0
SlrMJ=SlrkW*5E-05
SlrkW=SlrkW*0.005
'107 Temperature Probe measurement 'T_ground'
Therm107(T_ground,1,2,1,0,_50Hz,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,3,1,1,2500,True,0,_50Hz,355,0)
If WindDir>=360 Or WindDir<0 Then WindDir=0
'Generic Tipping Bucket Rain Gauge measurement 'Rain_mm'
PulseCount(Rain_mm,1,2,2,0,203,0)
'SR50A Sonic Ranging Sensor (SDI-12 Output) measurements 'DT', 'Q', 'TCDT', and 'DBTCDT'
SDI12Recorder(SR50A(),3,"1","M1!",1,0)
TCDT=DT*SQR((AirTC+273.15)/273.15)
DBTCDT=2-TCDT
'CS100 Barometric Pressure Sensor measurement 'BP_mbar'
PortSet(1,1)
VoltSE(BP_mbar,1,mV2500,4,1,0,_50Hz,0.2,851.2971)
BP_mbar=BP_mbar*1
'Call Data Tables and Store Data
CallTable (donnees_sassiere)
NextScan


'''''''''''''''Boucles secondaires'''''''''''''''''


SlowSequence
Scan(5,min,3,0) 'toutes les 1min si creation fichier outstat=True empilage fichier dans la pile
RealTime( rTime )
If Outstat Then
OutStatTrig=True
EndIf
Outstat=false
Call QueueAdd() 'a chaque creation de fichier, stockage dans la pile en attendant l'envoi par ftp
OutStatTrig=false
NextScan
EndSequence

SlowSequence

Scan(5,min,3,0)

If rTime(4) = 14 AND rTime(5)=05 Then
'Every day at 11:15 am turn on the modem
testif=true
ModemON

Do While (Queue(1) <> "") 'If queue is not empty
LName = Queue(1)
Day_of_Year=Day_of_Year - 1 'jour julien de l'annee
' RemoteFileName= LoggerID + "/" + Year+"_"+Day_of_Year+"_"+LoggerID+".dat"
RemoteFileName= "/panhome/pardonnet/" +LName
If FileTime(LName) > 0 Then 'if file exists
FTPResult = FTPClient (IPAddress,UserName,Password,LName,RemoteFileName,2) 'attempt to ftp

Delay (1,4,Sec) 'pause after attempt, yes this is a good idea
If FTPResult Then
Call QueueRemove()
Else
ModemOFF
ExitDo 'send succeeded or failed, if failed exit while queue and try later
EndIf 'endif ftpresult
Else 'file does not exist
Call QueueRemove()
EndIf 'end if filetime
Loop 'end do while queue
Delay (1,10,Sec) 'Control SlowSequence Execution Frequency
ModemOFF
EndIf 'EndIf Hour=1


NextScan
EndSequence

EndProg

And here the status table and summary:

Status Summary
07/12/2015 09:33:23
RecNum: 12
TimeStamp: 07/12/2015 10:29:37
OSVersion: CR800.Std.27.05
OSDate: 141021
OSSignature: 114
SerialNumber: 12295
RevBoard: 017.008
StationName: 12295
PakBusAddress: 1
ProgName: USR:TEST03_11_2015.CR8
StartTime: 03/11/2015 21:00:07
RunSignature: 2568
ProgSignature: 41888
Battery: 12,47318
PanelTemp: 21,75184
WatchdogErrors: 0
LithiumBattery: 3,44149
Low12VCount: 0
Low5VCount: 0
CompileResults: Warning: Voltage calibration failure! Possible input to analog channel beyond +/- 8V. USR:TEST03_11_2015.CR8 -- Compiled in SequentialMode.
StartUpCode: 0
ProgErrors: 0
VarOutOfBound: 0
SkippedScan: 0
SkippedSystemScan: 0
SkippedSlowScan(1): 0
SkippedSlowScan(2): 1
ErrorCalib: 94554
MemorySize: 4194304
MemoryFree: 20356
CPUDriveFree: 475136
USRDriveFree: 2505728
CommsMemFree(1): 14251504
CommsMemFree(2): 305
CommsMemFree(3): 3260
FullMemReset: 0
DataTableName(1): donnees_sassiere
SkippedRecord: 0
DataRecordSize: 3432
SecsPerRecord: 300
DataFillDays: 11,91667
MeasureOps: 184
MeasureTime: 216400
ProcessTime: 1801089
MaxProcTime: 1809804
BuffDepth: 0
MaxBuffDepth: 0
LastSystemScan: 07/12/2015 10:28:08
LastSlowScan(1): 07/12/2015 10:25:00
LastSlowScan(2): 07/12/2015 10:25:00
SystemProcTime: 6996
SlowProcTime(1): 1813680
SlowProcTime(2): 1815245
MaxSystemProcTime: 8374
MaxSlowProcTime(1): 2175329
MaxSlowProcTime(2): 13979521
PortStatus(1): true
PortStatus(2): false
PortStatus(3): false
PortStatus(4): false
PortConfig(1): Output
PortConfig(2): Input
PortConfig(3): Input
PortConfig(4): Input
SW12Volts: false
Security(1): 0
Security(2): 0
Security(3): 0
RS232Power: true
RS232Handshaking: 0
RS232Timeout: 0
CommActiveRS232: true
CommActiveME: false
CommActiveCOM310: false
CommActiveSDC7: false
CommActiveSDC8: false
CommActiveCOM320: false
CommActiveSDC10: false
CommActiveSDC11: false
CommActiveCOM1: false
CommActiveCOM2: false
CommConfigRS232: 4
CommConfigME: 4
CommConfigCOM310: 4
CommConfigSDC7: 4
CommConfigSDC8: 4
CommConfigCOM320: 0
CommConfigSDC10: 4
CommConfigSDC11: 4
CommConfigCOM1: 0
CommConfigCOM2: 0
BaudrateRS232: 9600
BaudrateME: 9600
BaudrateSDC: 115200
BaudrateCOM1: 0
BaudrateCOM2: 0
IsRouter: false
PakBusNodes: 50
CentralRouters(1): 0
CentralRouters(2): 0
CentralRouters(3): 0
CentralRouters(4): 0
CentralRouters(5): 0
CentralRouters(6): 0
CentralRouters(7): 0
CentralRouters(8): 0
BeaconRS232: 0
BeaconME: 0
BeaconSDC7: 0
BeaconSDC8: 0
BeaconSDC10: 0
BeaconSDC11: 0
BeaconCOM1: 0
BeaconCOM2: 0
VerifyRS232: 0
VerifyME: 0
VerifySDC7: 0
VerifySDC8: 0
VerifySDC10: 0
VerifySDC11: 0
VerifyCOM1: 0
VerifyCOM2: 0
MaxPacketSize: 1000
USRDriveSize: 3503104
IPInfo: PPP IP: 0.0.0.0 PPP gw: 0.0.0.0 ppp state: timed out -> close success
TCPPort: 6785
pppInterface: 2
pppIPAddr: 0.0.0.0
pppUsername:
pppPassword:
pppDial: AT+CGDCONT=1,"IP","orange.m2m.spec";ATD*99***1#
pppDialResponse: 21
IPTrace: 0
Messages:
CalGain(1): 0
CalGain(2): -0,7347977
CalGain(3): 0
CalGain(4): 0
CalGain(5): 0
CalGain(6): 0
CalGain(7): 0
CalGain(8): 0
CalGain(9): 0
CalGain(10): 0
CalGain(11): 0
CalGain(12): 0
CalGain(13): 0
CalGain(14): -0,367647
CalGain(15): NAN
CalGain(16): NAN
CalGain(17): NAN
CalGain(18): 0
CalSeOffset(1): 0
CalSeOffset(2): 5
CalSeOffset(3): 0
CalSeOffset(4): 0
CalSeOffset(5): 0
CalSeOffset(6): 0
CalSeOffset(7): 0
CalSeOffset(8): 0
CalSeOffset(9): 0
CalSeOffset(10): 0
CalSeOffset(11): 0
CalSeOffset(12): 0
CalSeOffset(13): 0
CalSeOffset(14): 10
CalSeOffset(15): 0
CalSeOffset(16): 0
CalSeOffset(17): 0
CalSeOffset(18): 0
CalDiffOffset(1): 0
CalDiffOffset(2): 0
CalDiffOffset(3): 0
CalDiffOffset(4): 0
CalDiffOffset(5): 0
CalDiffOffset(6): 0
CalDiffOffset(7): 0
CalDiffOffset(8): 0
CalDiffOffset(9): 0
CalDiffOffset(10): 0
CalDiffOffset(11): 0
CalDiffOffset(12): 0
CalDiffOffset(13): 0
CalDiffOffset(14): 0
CalDiffOffset(15): 0
CalDiffOffset(16): 0
CalDiffOffset(17): 0
CalDiffOffset(18): 0


thanks for helping!
sylvia


Thein Dec 7, 2015 10:13 AM

Hi Sylvia,

I had had a similar FTP problem recently with my CR1000. After upgraded the CR1000 O.S., it goes smoothly as CRBasic help file says. Noticed your CR800 OS is 27.05, which should be upgraded to CR800 OS Std 28.02, which is the latest OS. I think, in this O.S there got a lot improvement on FTP, TLS, Data Streaming etc. Here is the link:-

https://www.campbellsci.com/19_1_9999_121

Please note following before upgrading datalogger OS.
1) Please use reputable USB serial cable (such as from vendor who use FTDI chips).
2)All important data files must be download to PC as the upgrade process will wipe out everything.
3) Backup datalogger settings, as after upgrading yout need to restore setting of the datalogger.
4) Do not attemp remote upgrade.

Good luck,


smile Dec 7, 2015 02:31 PM

Hi,

I found very useful, on several occasions, the "file manager" in datalogger setting, (using DevConfig setup utility). You can decide how many last files, to be left in memory.
There are few rules in the files name.

Smile


Sylvia Dec 7, 2015 07:22 PM

ok, thanks, we'll start by OS update and see, and I'll check file manager too...

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