B-1
Appendix B. Example Programs
B.1 SDI-12 Example Programs
B.1.1 CR1000 SDI-12 Programs
B.1.1.1 CR1000 Program Controlling One Sampler
During testing, it was helpful to include an
Autoru
n parameter as
a Boolean variable. It allows the user to set the
Autorun
variable
to false in the
Public
table before opening up the sampler for
servicing without having to cut power to either the datalogger or
the sampler. Also the list of
Responses
includes a string message
for numeric response code (TABLE
). This will allow a text
message to be returned to the user in the data table. The following
program is available for download from the PVS5120 webpages.
'VSC100 program with SDI-12 communication
'date: 2014/05/13
PreserveVariables
'Declare Public Variables
Public sdi12(4) 'This is the destination array for the output values from the sampler
Alias sdi12(1)= Bottle
Alias sdi12(2)= Smpl_count
Alias sdi12(3) = Response_Code
Alias sdi12(4) = Sampler_Volt 'this is the voltage of the sampler battery
Public SamplerAddr As String *1 'This is the sdi-12 address assigned to the sampler in DevConfig
Public Run As Boolean
Public Autorun As Boolean 'This variable allows the user to prevent the logger from triggering
'the sampler. It is helpful when servicing the sampler or testing in the lab. Just set the variable
'to false in the public table and sampling is stopped until the user sets the variable true.
'The following two variables are used to convert the numeric response code value from the sampler
'to a text message.
Dim Response_List(9) As String
Public response_code_message As String
'Define Data Tables
'Sdi-12 output from the sampler including bottle number, sample number in a given bottle,
'response code, and sampler voltage at the time of the sample)
DataTable (SamplerStat,1,1000)
Sample (1,Bottle,FP2)
Sample (1,Smpl_count,FP2)
Sample (1,Response_Code,FP2)
Sample (1,response_code_message, String)
Sample (1,Sampler_Volt,FP2)
EndTable
'Main Program
BeginProg
'Program startup values
SamplerAddr = "0" 'This is the sdi12 address assigned to the sampler. It is set in DevConfig.
Response_List(1) = "No error"
Response_List(2) = "All samples complete"
Response_List(3) = "Low start battery (V<11.0 V)"
Response_List(4) = "Low run battery (V<10.5V)"
Response_List(5) = "Sampler vacuum timed out, no sample detected"
Response_List(6) = "Sample overflow detected"
Response_List(7) = "No sample liquid detected"
Response_List(8) = "Arm calibration error"
Response_List(9) = "Conductivity rod and Sample tube are shorted"
Autorun=true
NOTE
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: ......