I am trying to write a CR800 program that features equal flow increment automated sampling using Shortcut. I think am very close, but can't get the final step that resets my cumulative flow "user entered" field whenever it exceeds a defined threshold. It should be a simple script (if cumulative flow >= value, then reset cumulative flow to "0:), but I can't figure it out. What do I have to enter to make this work?
Does anyone have a program that they would be willing to share that has equal flow automated sampling?
Why don't you post what you have so we can try to spot the problem.
Just off the cuff, maybe something like this?
Const SampCPort = 1
Public PanTemp, BattV
Public SampMethod = 1 '0 = time, 1 = equal flow
Public SampTimeInt = 5 'minutes
Public SampFlowInt = 10 'cf
Public CFlowMax = 100 'cf, reset to 0
Public SampleNow As Boolean 'boolean trigger
Public CFlow 'cf measurement
Dim IntCntr = 1
DataTable (FlowData,1,-1)
DataInterval (0,60,Sec,10)
Minimum (1,BattV,FP2,0,False)
Sample (1,PanTemp,FP2)
Sample (1,CFlow,FP2)
EndTable
DataTable (SampEvent,True,500)
Sample (1,CFlow,FP2)
EndTable
BeginProg
Scan (10,Sec,0,0)
PanelTemp (PanTemp,250)
Battery (BattV)
'Measure Flow
CFlow = CFlow + 5*RND+1 'simulation of cflow
If SampMethod = 0 Then
If TimeIntoInterval (0,SampTimeInt,Min) Then
SampleNow = TRUE
EndIf
ElseIf SampMethod = 1 Then
If CFlow >= (IntCntr * SampFlowInt) Then
SampleNow = TRUE
IntCntr = IntCntr + 1
EndIf
EndIf
If SampleNow Then
PulsePort (SampCPort,35000)
SampleNow = FALSE
CallTable SampEvent 'log sampling event
EndIf
CallTable FlowData 'log regular measurements
If CFlow >= CFlowMax Then
IntCntr = 0
CFlow = 0
EndIf
NextScan
EndProg