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.

lost data at 12:00 am


Arno Jun 26, 2012 01:47 PM

Hello, I wrote this programm with the help of this forum.(http://www.campbellsci.com/forum/messages.cfm?threadid=5FF6008B-013F-673B-CF27BDC1BBC4FFB0)
So I take 1:1 the file handling of this programm. But at 12:00 am it lost the data. I screw on different adjustments.
Nothing helps. The file sending the rest of the day is working well.
Have anybody an idea? Who is the bug? Thanks for helping.
Sorry for my english. And here is the full programm (without real the adress):
Public PTemp, batt_volt,

'TABLE FILE DECLARATIONS
Public OutStat As Boolean
Public LastFileName As String * 31

'SERVER DECLARATIONS
Const RDir = "/"
Public LName As String * 31
Public RName As String * 31
Public Success As Boolean

Public FileOut As String * 50
Public rTime(9) 'declare as public and dimension rTime to 9

Alias rTime(1) = Year 'assign the alias Year to rTime(1)
Alias rTime(2) = Month 'assign the alias Month to rTime(2)
Alias rTime(3) = DOM 'assign the alias Day to rTime(3)
Alias rTime(4) = Hour 'assign the alias Hour to rTime(4)
Alias rTime(5) = Minute 'assign the alias Minute to rTime(5)
Alias rTime(6) = Second 'assign the alias Second to rTime(6)
Alias rTime(7) = uSecond 'assign the alias uSecond to rTime(7)
Alias rTime(8) = WeekDay 'assign the alias WeekDay to rTime(8)
Alias rTime(9) = DOY 'assign the alias DOY to rTime(9)

'FILE QlastUEUE DECLARATIONS
Const QL = 10 'queue buffer size
Public Queue(QL) As String * 31

' SUB ROUTINE FOR ADDING TO QUEUE
Sub QueueAdd()
Dim I
If OutStat Then 'add new file to queue
RealTime(rTime)
Second=0
For I = 1 To QL 'find an empty spot
If Queue(I) = "" Then
Queue(I) = LastFileName
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) = LastFileName
EndIf
EndIf 'end if outstat
EndSub

'SUB ROUTINE FOR REMOVING OLDEST ITEM IN QUEUE
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

'DATA TABLES
DataTable (Test,1,1000)
DataInterval (0,10,Min,10)
CardOut (1,-1)
TableFile ("USR:Test_",8,QL,120,120,min,OutStat,LastFileName)
Sample (1,batt_volt,FP2)
Sample (1,PTemp,FP2)
Call QueueAdd()
EndTable

DataTable(TxLog,1,1000)
Sample (1,Success,Boolean)
Sample (1,LName,String)
Sample (1,RName,String)
EndTable

BeginProg
SetStatus("USRDriveSize",1000000)
Scan (10,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
Call QueueAdd()
CallTable Test
NextScan

SlowSequence
Do While TRUE 'TimeIntoInterval(1330,1440,min)OR TimeIntoInterval(720,1440,min)
Do While (Queue(1) <> "") 'If queue is not empty
LName = Queue(1)
RName = Replace (Queue(1),"USR:","")
If FileTime(LName) > 0 Then 'if file exists
SW12(1)
Delay(1,5,sec)
FileOut=Trim("Daten" & Trim(FormatFloat(Year,"%04.00f")) & Trim(FormatFloat(DOY,"%03.00f")) & Trim(FormatFloat(Hour,"%02.00f")) & Trim(FormatFloat(Minute,"%02.00f")) & Trim(FormatFloat(Second,"%02.00f")) & ".dat")
Success = FTPClient ("IP adress","user name","password",LName,"Hecklingen/" & FileOut,0) 'attempt to ftp
CallTable (TxLog) 'diagnostics table
Delay (1,4,Sec) 'pause after attempt, yes this is a good idea
If Success Then Call QueueRemove() Else ExitDo 'send succeeded or failed, if failed exit and try later
Else 'file does not exist
Call QueueRemove()
EndIf 'end if filetime
If Success Then
'Turn off modem
SW12(0)
EndIf
Loop 'end do while queue
Delay (1,10,Sec) 'Control SlowSequence Execution Frequency
Loop 'end do while true
EndSequence
EndProg


Arno Jun 29, 2012 06:28 AM

Sorry, I mean 12 pm. What a fatal failure for understanding.

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