Appendix B. Example Programs
B-2
'In this program the sampler is triggering via sdi12 once every 15 minutes. But the scan interval is set at
every 10 ‘sec assuming the logger is doing more than just triggering the sampler. This can be changed very
easily.
Scan (10,Sec,0,0)
If IfTime(0,15,Min)AND Autorun Then
Run=true
End If
If Run Then
'Values initialized to 999 to make communication errors easier to identify.
'For example if the logger is powered up but the sampler is turned off, NAN is returned for the
'first array location and 999s will remain in the remaining 3 array locations. This is repeated
'each time the logger tells the sampler to run.
sdi12(1) = 999
sdi12(2) = 999
sdi12(3) = 999
sdi12(4) = 999
SDI12Recorder (sdi12(),1,SamplerAddr,"M!",1.0,0) 'Run the Sampler
'In this example the sampler is wired into com port 1
response_code_message=Response_List(Respon1)
Run=false
CallTable SamplerStat
EndIf
NextScan
EndProg
B.1.1.2 CR1000 Program for Running Three Samplers Concurrently
'VSC100 program for running 3 samplers concurrently via SDI-12.
'Once a C! command is issued the returned status values will not be available to the logger until the logger
tells the ‘samplers to run the next time. This is because a service command is not issued by the sensor with
a C! like in an ‘M! If you need data back sooner than the next sample follow the steps below.
'date 2014/10/17
Public PTemp, batt_volt
Public SamplerOne(4), SamplerTwo(4), SamplerThree(4) 'Returned Sampler status values for each sampler
Public CmdOne As String, CmdTwo As String, CmdThree As String
DataTable (SamplerStat,1,1000)
Sample (4,SamplerOne(),FP2)
Sample (4,SamplerTwo(),FP2)
Sample (4,SamplerThree(),FP2)
EndTable
BeginProg
Scan (5,Sec,0,0) 'scan interval every 5 seconds
PanelTemp (PTemp,250)
Battery (batt_volt)
If IfTime (0,2,Min) Then 'This example tells the samplers to run every 2 minutes
CmdOne = "C!"
CmdTwo = "C!"
CmdThree = "C!"
Else 'Else issue the "C" command every 5 seconds to get the status values when available
CmdOne = "C"
CmdTwo = "C"
CmdThree = "C"
EndIf
SDI12Recorder (SamplerOne,1,0,CmdOne,1.0,0) 'sampler address 0
SDI12Recorder (SamplerTwo,1,1,CmdTwo,1.0,0) 'sampler address 1
SDI12Recorder (SamplerThree,1,2,CmdThree,1.0,0) 'sampler address 2
'The following logic sets all 4 status values to NAN if the first one comes back as NAN when
'communication between the logger and sampler is interrupted.
If SamplerOne(1) >= 1E9 OR SamplerOne(1) = NAN Then Move (SamplerOne,4,NAN,1)
If SamplerTwo(1) >= 1E9 OR SamplerTwo(1) = NAN Then Move (SamplerTwo,4,NAN,1)
If SamplerThree(1) >= 1E9 OR SamplerThree(1) = NAN Then Move (SamplerThree,4,NAN,1)
CallTable SamplerStat
NextScan
EndProg
Summary of Contents for PVS5120 Series
Page 2: ......
Page 4: ......
Page 6: ......
Page 8: ......
Page 70: ...Appendix A Sample Transport Velocity A 2...
Page 78: ...Appendix B Example Programs B 8...
Page 86: ...Appendix C Monitoring Sampler Status via RS 485 C 8...
Page 96: ...Appendix G Generic Modbus Control G 4...
Page 100: ...Appendix H ISO5667 Conformity H 4...
Page 101: ......