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.

Missed scans using SerialInRecord


trexmiller Jul 20, 2015 01:25 AM

I am trying to read a serial sensor on Com2 port of a CR1000 every second using the SerialInRecord command. I have other sensors in other ports, including SDI12 sensors scanned using the SlowSequence method every 60 seconds. Using the program below I get missed scans when I look at Station Status and the message that I should increase scan interval or buffer size. However, using terminal emulator I can see that the data from the sensor I am scanning comes in Com2 port every 7 milliseconds, delimited by "$" and "&." The output is below. I don't know why I get missed scans. Doesn't seem like I would need to increase scan interval. Do I need to increase the buffer size? Any help is appreciated.

R 20:01:15.75 $0.01, 0.01, -0.08, 4.77
R 20:01:15.77 , -45.12, 0.01, 0.01, -0
R 20:01:15.80 .08, 0.01, 0.01, -0.08,
R 20:01:15.82 &
R 20:01:16.77 $0.01, 0.01, -0.09, 5.48
R 20:01:16.79 , -45.06, 0.01, 0.01, -0
R 20:01:16.82 .09, 0.01, 0.01, -0.09,
R 20:01:16.84 &
R 20:01:17.79 $0.02, 0.01, -0.08, 5.18
R 20:01:17.81 , -45.24, 0.02, 0.01, -0
R 20:01:17.84 .08, 0.02, 0.01, -0.08,
R 20:01:17.86 &
R 20:01:18.81 $0.02, 0.01, -0.08, 5.22
R 20:01:18.83 , -45.08, 0.02, 0.01, -0
R 20:01:18.86 .08, 0.02, 0.01, -0.08,
R 20:01:18.88 &
R 20:01:19.83 $0.01, 0.01, -0.09, 5.45
R 20:01:19.85 , -45.06, 0.01, 0.01, -0
R 20:01:19.88 .09, 0.01, 0.01, -0.09,
R 20:01:19.90 &

CR1000 program
Public PTemp, batt_volt
Public WS601Temp(9)
Public WS601Humidity(13)
Public WS601Pressure(9)
Public WS601Wind(14)
Public WS601Compass(1)
Public WS601ppt(4)
Public RDO1(3)
Public RDO2(3)
Public Chl
Public PAR
Public InStringACL As String * 200
Public Bytes(1) As String * 10, FloatValues(1)
Public ResultStringACL(11) As String * 200

Alias RDO1(1)=SurfaceDO
Alias RDO1(2)=DO1B
Alias RDO1(3)=SurfaceTemp
Alias RDO2(1)=DepthDO
Alias RDO2(2)=DO2B
Alias RDO2(3)=DepthTemp
Alias WS601Temp(1)=AirTemp
Alias WS601Temp(2)=AirTempMin
Alias WS601Temp(3)=AirTempMax
Alias WS601Temp(4)=AirTempAvg
Alias WS601Temp(5)=DewPointAct
Alias WS601Temp(6)=DewPointMin
Alias WS601Temp(7)=DewPointMax
Alias WS601Temp(8)=DewPointAvg
Alias WS601Temp(9)=WetBulbTemp
Alias WS601Humidity(1)=RelHumidity
Alias WS601Humidity(2)=RelHumidityMin
Alias WS601Humidity(3)=RelHumidityMax
Alias WS601Humidity(4)=RelHumidityAvg
Alias WS601Humidity(5)=HumidityAbs
Alias WS601Humidity(6)=HumidityAbsMin
Alias WS601Humidity(7)=HumidityAbsMax
Alias WS601Humidity(8)=HumidityAbsAvg
Alias WS601Humidity(9)=SpecificEnthalpy
Alias WS601Humidity(10)=AtmPressureMixingRatio
Alias WS601Humidity(11)=MixingRatioMin
Alias WS601Humidity(12)=MixingRatioMax
Alias WS601Humidity(13)=MixingRatioAvg
Alias WS601Pressure(1)=AirPressureAbsAct
Alias WS601Pressure(2)=AirPressureAbsMin
Alias WS601Pressure(3)=AirPressureAbsMax
Alias WS601Pressure(4)=AirPressureAvg
Alias WS601Pressure(5)=AirDensityAct
Alias WS601Pressure(6)=RelAirPressureAct
Alias WS601Pressure(7)=RelAirPressureMin
Alias WS601Pressure(8)=RelAirPressureMax
Alias WS601Pressure(9)=RelAirressureAvg
Alias WS601Wind(1)=WindSpeedAct
Alias WS601Wind(2)=WindSpeedMin
Alias WS601Wind(3)=WindSpeedMax
Alias WS601Wind(4)=WindSpeedAvg
Alias WS601Wind(5)=WindSpeedVct
Alias WS601Wind(6)=WindDirectionAct
Alias WS601Wind(7)=WindDirectionMin
Alias WS601Wind(8)=WindDirectionMax
Alias WS601Wind(9)=WindDirectionVct
Alias WS601Wind(10)=WindDirectionCorr
Alias WS601Wind(11)=WindQuality
Alias WS601Wind(12)=WindChillTempAct
Alias WS601Wind(13)=WindSpeedStd
Alias WS601Wind(14)=WindDirStd
Alias WS601Compass(1)=Compass
Alias WS601ppt(1)=pptAmountAbs
Alias WS601ppt(2)=pptAmountDiff
Alias WS601ppt(3)=pptIntensity
Alias WS601ppt(4)=pptType
Alias ResultStringACL(1)=MagX
Alias ResultStringACL(2)=MagY
Alias ResultStringACL(3)=MagZ
Alias ResultStringACL(4)=Roll
Alias ResultStringACL(5)=Pitch
Alias ResultStringACL(6)=AccelX
Alias ResultStringACL(7)=AccelY
Alias ResultStringACL(8)=AccelZ
Alias ResultStringACL(9)=GyroX
Alias ResultStringACL(10)=GyroY
Alias ResultStringACL(11)=GyroZ

Units PTemp= Celsius
Units batt_volt= Volts
Units Chl=mV
Units PAR=umoles/s/m^2
Units SurfaceDO= mg/L
Units DO1B=%
Units SurfaceTemp=Celsius
Units DepthDO=mg/L
Units DO2B=%
Units DepthTemp=Celsius
Units AirTemp=Celsius
Units AirTempMin=Celsius
Units AirTempMax=Celsius
Units AirTempAvg=Celsius
Units DewPointAct=Celsius
Units DewPointMin=Celsius
Units DewPointMax=Celsius
Units DewPointAvg=Celsius
Units WetBulbTemp=Celsius
Units RelHumidity=%
Units RelHumidityMin=%
Units RelHumidityMax=%
Units RelHumidityAvg=%
Units HumidityAbs=g/m^3
Units HumidityAbsMin=g/m^3
Units HumidityAbsMax=g/m^3
Units HumidityAbsAvg=g/m^3
Units SpecificEnthalpy=kJ/kg
Units AtmPressureMixingRatio=g/kg
Units MixingRatioMin=g/kg
Units MixingRatioMax=g/kg
Units MixingRatioAvg=g/kg
Units AirPressureAbsAct=hPa
Units AirPressureAbsMin=hPa
Units AirPressureAbsMax=hPa
Units AirPressureAvg=hPa
Units AirDensityAct=kg/m^3
Units RelAirPressureAct=hPa
Units RelAirPressureMin=hPa
Units RelAirPressureMax=hPa
Units RelAirressureAvg=hPa
Units WindSpeedAct=m/s
Units WindSpeedMin=m/s
Units WindSpeedMax=m/s
Units WindSpeedAvg=m/s
Units WindSpeedVct=m/s
Units WindDirectionAct=Degrees
Units WindDirectionMin=Degrees
Units WindDirectionMax=Degrees
Units WindDirectionVct=Degrees
Units WindDirectionCorr=Degrees
Units WindQuality=%
Units WindChillTempAct=Celsius
Units WindSpeedStd=m/s
Units WindDirStd=Degrees
Units Compass=Degrees
Units pptAmountAbs=mm
Units pptAmountDiff=mm
Units pptIntensity=mm/h
Units pptType=None/Liquid/Solid/NA

DataTable (Fast,1,10000)
DataInterval (0,1,Sec,10)
Sample(1,MagX,FP2)
Sample(1,MagY,FP2)
Sample(1,MagZ,FP2)
Sample(1,Roll,FP2)
Sample(1,Pitch,FP2)
Sample(1,AccelX,FP2)
Sample(1,AccelY,FP2)
Sample(1,AccelZ,FP2)
Sample(1,GyroX,FP2)
Sample(1,GyroY,FP2)
Sample(1,GyroZ,FP2)
EndTable

DataTable (Slow,1,1000)
DataInterval (0,60,Sec,10)
Sample(1,AirTemp,FP2)
Sample(1,AirTempMin,FP2)
Sample(1,AirTempMax,FP2)
Sample(1,AirTempAvg,FP2)
Sample(1,DewPointAct,FP2)
Sample(1,DewPointMin,FP2)
Sample(1,DewPointMax,FP2)
Sample(1,DewPointAvg,FP2)
Sample(1,WetBulbTemp,FP2)
Sample(1,RelHumidity,FP2)
Sample(1,RelHumidityMin,FP2)
Sample(1,RelHumidityMax,FP2)
Sample(1,RelHumidityAvg,FP2)
Sample(1,HumidityAbs,FP2)
Sample(1,HumidityAbsMin,FP2)
Sample(1,HumidityAbsMax,FP2)
Sample(1,HumidityAbsAvg,FP2)
Sample(1,SpecificEnthalpy,FP2)
Sample(1,AtmPressureMixingRatio,FP2)
Sample(1,MixingRatioMin,FP2)
Sample(1,MixingRatioMax,FP2)
Sample(1,MixingRatioAvg,FP2)
Sample(1,AirPressureAbsAct,FP2)
Sample(1,AirPressureAbsMin,FP2)
Sample(1,AirPressureAbsMax,FP2)
Sample(1,AirPressureAvg,FP2)
Sample(1,AirDensityAct,FP2)
Sample(1,RelAirPressureAct,FP2)
Sample(1,RelAirPressureMin,FP2)
Sample(1,RelAirPressureMax,FP2)
Sample(1,RelAirressureAvg,FP2)
Sample(1,WindSpeedAct,FP2)
Sample(1,WindSpeedMin,FP2)
Sample(1,WindSpeedMax,FP2)
Sample(1,WindSpeedAvg,FP2)
Sample(1,WindSpeedVct,FP2)
Sample(1,WindDirectionAct,FP2)
Sample(1,WindDirectionMin,FP2)
Sample(1,WindDirectionMax,FP2)
Sample(1,WindDirectionVct,FP2)
Sample(1,WindDirectionCorr,FP2)
Sample(1,WindQuality,FP2)
Sample(1,WindChillTempAct,FP2)
Sample(1,WindSpeedStd,FP2)
Sample(1,WindDirStd,FP2)
Sample(1,Compass,FP2)
Sample(1,pptAmountAbs,FP2)
Sample(1,pptAmountDiff,FP2)
Sample(1,pptIntensity,FP2)
Sample(1,pptType,FP2)
Sample(1,RDO1(1),FP2)
Sample(1,RDO1(2),FP2)
Sample(1,RDO1(3),FP2)
Sample(1,RDO2(1),FP2)
Sample(1,RDO2(2),FP2)
Sample(1,RDO2(3),FP2)
Minimum (1,batt_volt,FP2,0,False)
Average(1,Chl(),FP2,False)
Sample (1,PTemp,FP2)
Average(1,PAR(),FP2,False)
EndTable

BeginProg
SerialOpen (Com2,9600,19,0,7000)
Scan (1,Sec,6,0)
SerialFlush(Com2)
SerialInRecord(Com2,InStringACL,36,0,38,Bytes(1),0)
SplitStr(ResultStringACL,InStringACL,",",11,0)
CallTable Fast
NextScan

SlowSequence
Scan (60,Sec,3,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
VoltSe(Chl(),1,0,1,True,0,_60Hz,1,0)
VoltDiff(PAR(),1,mV2_5,2,True,0,_60Hz,266.04,0)
SDI12Recorder(WS601Temp(1),1,0,"M1!",1,0)
SDI12Recorder(WS601Humidity(1),1,0,"M2!",1,0)
SDI12Recorder(WS601Pressure(1),1,0,"M3!",1,0)
SDI12Recorder(WS601Wind(1),1,0,"M4!",1,0)
SDI12Recorder(WS601Compass(1),1,0,"M5!",1,0)
SDI12Recorder(WS601ppt(1),1,0,"M6!",1,0)
SDI12Recorder(RDO1(),7,"2","M!",1,0)
SDI12Recorder(RDO2(),7,"1","M!",1,0)
CallTable Slow
NextScan
EndProg


JDavis Jul 20, 2015 04:10 PM

Try taking out the SerialFlush. It shouldn't be needed.

Look at the MaxProcTime and BufferDepth values in your Status table. The MaxProcTime is the best indicator of what the max buffers should be set to for your scan.


trexmiller Jul 20, 2015 05:40 PM

Thanks JDavis, that fixed the problem. MaxProcTime was ~41000 so I changed the buffer to 50000 and now I am getting no missed scans.

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