Appendix C. Monitoring Sampler Status via RS-485
C-5
C.4 Programming for RS-485 Monitoring
C.4.1 Monitoring via PakBus®
When monitoring via PakBus® you will need to issue the
GetVariables()
instruction and save the returned values to variable array. Below is the
instruction’s structure and an example instruction. Also a CR1000 program is
available.
GetVariables(
ResultCode, ComPort, NeighborAddr, PakBusAddr, Security,
TimeOut, “TableName”, “FieldName”, Variable, Swath
)
GetVariables(
Result(3),ComSDC7,0,sampler_PakBus_address,0000,0,
"Public","Bottle",Sampler_status(1),4
)
(p. 36)
, for more explanation of the
GetVariables
instruction or the
CRBasic Help
.
C.4.1.1 CR1000 Program for PakBus® Monitoring with Time-Based
Configuration
'PVS5120/VSC100 program communicating via PakBus
'hardware includes MD485
'program monitors the status of a sampler running on a time-based configuration via PakBus.
'date: 2014-10-21
PreserveVariables
'Declare Public Variables
Public sampler_PakBus_address 'The PakBus address is set or designated
'in DevConfig. The default value for the sampler is 95. If you have
'multiple samplers on the network they each need a unique PakBus address.
'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
Public Sampler_status(4)
'*** Status Values returned by the sampler once a sample is collected ****
Alias Sampler_status(1) = CurrentBottle 'Discrete distrubitor arm position
Alias Sampler_status(2) = SampleCount 'How many samples are currently in bottle
Alias Sampler_status(3) = ResponseCode 'Numeric Response Code
Alias Sampler_status(4) = SamplerBatt 'Sampler battery voltage (V)
'***Results returned for each communication instruction***
Public Result
'Define tables
DataTable (SamplerStat,True,1000) 'stores sampler status values
Sample (1,CurrentBottle,FP2)
Sample (1,SampleCount,FP2)
Sample (1,ResponseCode,FP2)
Sample (1,response_code_message,String)
Sample (1,SamplerBatt,FP2)
EndTable
DataTable (Errors,true,1000) 'stores the communication errors
Sample (1,Result,FP2)
EndTable
'Main Program
BeginProg
'The following text is associated with the numeric response codes provided
'from the sampler after each attempted sample.
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)"
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: ......