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.

CR310 skip record problem


Franky.C Feb 5, 2020 01:16 AM

Hello,

There only one rain gaue on P_SW, and three DI signal on SE2~4, and GPS on RS232 only for time correction.

And also output string evert 10 minutes on C1/C. 

But someting there will skip records at random time(10min dat and 1 min data) and also stop output data via C1/2. 

Below are the program code

Is anyone can help ?

'Declare Public Variables
'SMARTEC Franky
'Revision:3.1.3
'Add GPS Function
'Revise low battery voltage point to 12.5V
'Revise low Battery voltage point to 12.0V 2019-07-26
'Revise low Battery voltage point to 11.4V 2019-11-25
Dim nmea_sentence(2) As String * 100
Public PTemp, Batt_volt,Rain,
Public CityPower,Batt,Out(2)
Public OutString As String * 28
Public OutString1 As String 'Date & Time
Public OutString2 As String 'Rain 1 min
Public OutString3 As String 'Citypower
Public OutString4 As String 'Battery Voltage under 11.6VDC output 1,above 12.5 output 0
Public OutString5 As String 'Reserved(1)
Public OutString6 As String 'Reserved(2)
Public GPS_DATA(15)
Alias GPS_DATA(1) = latitude_a 'Degrees latitude (+ = North; - = South)
Alias GPS_DATA(2) = latitude_b 'Minutes latitude
Alias GPS_DATA(3) = longitude_a 'Degress longitude (+ = East; - = West)
Alias GPS_DATA(4) = longitude_b 'Minutes longitude
Alias GPS_DATA(5) = speed 'Speed
Alias GPS_DATA(6) = course 'Course over ground
Alias GPS_DATA(7) = magnetic_variation 'Magnetic variation from true north (+ ='East; - = West)
Alias GPS_DATA(8) = fix_quality 'GPS fix quality: 0 = invalid, 1 = GPS, 2= 'differential GPS, 6 = estimated
Alias GPS_DATA(9) = nmbr_satellites 'Number of satellites used for fix
Alias GPS_DATA(10) = altitude 'Antenna altitude
Alias GPS_DATA(11) = pps 'usec into sec of system clock when PPS
'rising edge occurs, typically 990,000 once
'synced
Alias GPS_DATA(12) = dt_since_gprmc 'Time since last GPRMC string, normally less 'than 1 second
Alias GPS_DATA(13) = gps_ready 'Counts from 0 to 10, 10 = ready
Alias GPS_DATA(14) = max_clock_change 'Maximum value the clock was changed in msec
Alias GPS_DATA(15) = nmbr_clock_change 'Number of times the clock was changed

'Define Units to be used in data file header
Units latitude_a = degrees
Units latitude_b = minutes
Units longitude_a = degrees
Units longitude_b = minutes
Units speed = knots
Units course = degrees
Units magnetic_variation = unitless
Units fix_quality = unitless
Units nmbr_satellites = unitless
Units altitude = m
Units pps = ms
Units dt_since_gprmc = s
Units gps_ready = unitless
Units max_clock_change = ms
Units nmbr_clock_change = samples

'Define Data Tables.
DataTable (Min,1,-1)
DataInterval (0,1,min,-1)
Totalize (1,Rain,FP2,False)
Sample (1,CityPower,FP2)
Sample (1,Batt,FP2)
Sample (2,Out(),FP2)
EndTable

DataTable (Ten,1,-1)
DataInterval (0,10,min,-1)
Totalize (1,Rain,FP2,False)
Sample (1,CityPower,FP2)
Sample (1,Batt,FP2)
Sample (2,Out(),FP2)
EndTable

DataTable (Misc,1,-1)
DataInterval (0,1,min,-1)
Minimum (1,Batt_volt,FP2,False,False)
Sample (1,PTemp,FP2)
EndTable

DataTable (Location,1,3000)
DataInterval (0,60,min,-1)
Sample (15,GPS_DATA(),IEEE4)
EndTable

DataTable (Output,1,30000)
DataInterval (5,600,sec,-1)
Sample (1,OutString,String)
EndTable

'Main Program
BeginProg
SerialOpen (COM1,9600,0,0,50)

Scan (5,Sec,0,0)
PanelTemp (PTemp,60)
Battery (Batt_volt)

PulseCount (Rain,1,P_SW,2,0,0.5,0)

PortGet (CityPower,se2)
PortGet (Out(1),se3)
PortGet (Out(2),se4)

If Batt_volt >11.4 Then Batt=0
If Batt_volt <11.4 Then Batt=1

OutString1 =Ten.TimeStamp(1,1) 'Date&Time
OutString2 =Ten.Rain_Tot(1,1) 'Rain Minute
OutString3 =Ten.CityPower(1,1) 'CityPower
OutString4 =Batt 'Battery Volatge
OutString5 =Out(1) 'Reserved(1)
OutString6 =Out(2) 'Reserved(2)
OutString =OutString1+","+OutString2+","+OutString3+","+OutString4+","+OutString5+","+OutString6+CHR(10)

If IfTime (5,600,sec) Then
SerialOut (COM1,OutString,"",0,0)
EndIf

GPS (GPS_DATA(),ComRS232_RX,0,28800,100,nmea_sentence(1),4800)

CallTable Output
CallTable Min
CallTable Ten
CallTable Misc
CallTable Location
NextScan
EndProg


JDavis Feb 5, 2020 07:47 AM

The skipped records must be caused by adjusting the clock to GPS time. If the clock jumps over time to output a record, you will skip a record.

Without using PPS, there is a lot more jitter in reading time from the GPS. The datalogger is relying on just the serial data strings from the GPS. You should increase the MaxTimeDiff parameter. I would suggest a value between 500 and 1000.

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