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.

Help with skipped slow sequence scans


ganzlin Nov 12, 2015 02:52 PM

Hello,

I am getting a lot of skipped slow sequence scans (slowsequence scan interval 60sec). My main program is eddy covariance with scan interval of 100msec. Is there any way to avoid all these skipped slow sequence scans? Would a faster slowsequence scan interval help? Attached is the slow sequence program

NextScan
SlowSequence
Scan (60,Sec,3,0)
RealTime (rTime) 'get various time elements

'check for the hours of 5:30am to 9pm CST for camera operations
If (Hour > 5 AND Minute > 30) OR Hour >= 6 OR Hour < 21 Then
EndIf
'turn on camera at 5 min before the hour and half hour
If (IfTime(25,60,min) OR IfTime(55,60,min)) Then
SW12(2,1) 'turn on camera
EndIf

'Take a picture every 30min
If (IfTime(0,60,min) OR IfTime(30,60,min)) Then
'intialize rgb filename
HGetResp = "USR:rosemountc6_" & rTime(1)&"_"&FormatLong(rTime(2),"%02u")&"_"&FormatLong(rTime(3),"%02u")&"_"&FormatLong(rTime(4),"%02u")&FormatLong(rTime(5),"%02u")&FormatLong(rTime(6),"%02u") &".jpg"
HGetHead = "" 'important to initialize
'get image and store to USR drive
HGetHandle = HTTPGet("http://192.168.1.100/netcam.jpg",HGetResp,HGetHead)
CallTable HGetLog 'log retrieval
SW12(2,0) 'turn off camera
EndIf
'turn off camera after last image capture, since camera powered on at 20:55 CST
If (Hour = 21) Then
SW12(2,0)
EndIf
NextScan
EndProg


JDavis Nov 12, 2015 03:31 PM

HTTPGet can take quite a while. If you wanted to not see any skipped slow scans, the thing to do would actually be to use a slower scan rate.

I recommend against using IfTime within a slow sequence. You are likely to never hit the exact times in a slow sequence. One way to handle things is use IfTime within your main program to set variables used to trigger behavior in the slow sequence. The other way would be to use the RealTime instruction and look for ranges of time.


ganzlin Nov 12, 2015 03:51 PM

Thanks for the suggestions. Could you possibly post an example of using IfTime in the main program to this effect? I am a bit unsure of how to run part of this SlowSequence block in the main program.


bconrad Nov 12, 2015 03:51 PM

Hello Peter,

By the looks of your code there is some optimization that could be done. For example:

'check for the hours of 5:30am to 9pm CST for camera operations
If (Hour > 5 AND Minute > 30) OR Hour >= 6 OR Hour < 21 Then
EndIf

appears to not be doing anything since there are no instructions between the If and EndIf statements. This is how I would do your code:

'Located in Variable Declarations
Public TakePic As Boolean

'Located at end of Main Scan
'between 5:30 and 21:00 trigger an image every 30 minutes
If TimeIsBetween (5:30,21,24,Hr) Then
If IfTime(0,30,min) Then TakePic = TRUE
EndIf
NextScan

'In SlowSequence Scan
Slowsequence
Do
Delay (1,1,Sec)
RealTime (rTime) 'get various time elements
If TakePic Then
SW12(2,1) 'turn on camera
Delay(1,70,Sec) 'delay, let camera boot up
'intialize rgb filename
HGetResp = "USR:rosemountc6_" &
rTime(1)&"_"&FormatLong(rTime(2),"%02u")&"_"&FormatLong(rTime(3),"%02u")&"_"&FormatLong(rTime(4),"%02u")&FormatLong(rTime(5),"%02u")&FormatLong(rTime(6),"%02u") &".jpg"
HGetHead = "" 'important to initialize
'get image and store to USR drive
HGetHandle = HTTPGet("http://192.168.1.100/netcam.jpg",HGetResp,HGetHead)
CallTable HGetLog 'log retrieval
SW12(2,0) 'turn off camera
TakePic=False
EndIf

Comment out your old code and see if this code helps.

Best,
Ben


ganzlin Nov 12, 2015 03:57 PM

Thank you! I will give this a try


bconrad Nov 12, 2015 06:49 PM

Peter,

One last thing. After:

TakePic=False
EndIf

Put in:

Loop


I forgot to add that above.

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