Difference between revisions of "Campbell::Comm"
Line 42: | Line 42: | ||
Besides the nominal TCP/IP connections, Net::Telnet is capable of supporting | Besides the nominal TCP/IP connections, Net::Telnet is capable of supporting | ||
− | interfaces using a direct serial or modem connection | + | interfaces using a direct serial or modem connection. This usage is |
+ | implemented in the (or various...) open() methods. | ||
− | + | A _bug_ in Net::Telnet (this is my view; it may be considered a _feature_ | |
+ | by the authors...) requires a patch; this should be represented in the | ||
+ | Net::Telnet version included in the above tree. Specifically, Net::Telnet | ||
+ | goes out of its way to handle ''timeouts'' using ''wall'' time (i.e., absolute | ||
+ | time as measured on a wall clock) rather than ''relative'' inactivity time | ||
+ | as used in the underlying select() system function. In our case the latter | ||
+ | form is required due to the many levels and sources of latency in the | ||
+ | communication system. | ||
+ | |||
+ | The Perl Expect module might provide a good alternative to Net::Telnet if | ||
+ | Campbell::Comm were to be rewritten. Both provide the key functionality | ||
+ | of being able to wait for and selectivly match on responses from the | ||
+ | remote system. | ||
+ | |||
+ | Due to the specific need to communicate with dataloggers via FreeWave | ||
+ | radios, the ... |
Revision as of 08:15, 6 July 2007
Campbell Scientific's CR10 family of dataloggers has been heavily used by WERC and many other research groups for years. Though now superseded by the CR1000 line of loggers, the CR10 line will likely be in service for years to come.
The CR10 loggers were provided with complete documentation, both for developing the datalogging programs themselves and for interfacing with other systems via serial communications. At WERC, we used this documentation to develop code in the Perl programming language for talking to these datalogging systems, with connections via serial radios (FreeWave) and the Internet.
Note that Campbell provides the LoggerNet (formerly PC208 and other) programs to interface dataloggers to PCs; WERC's Campbell::Comm and related programs serve a more limited function than LoggerNet/PC208, being primarily concerned with reliably downloading data and checking/setting the time.
WERC's code is posted online at http://www.uaf.edu/water/staff/irving/csi-code/, including a README file. This system has been in use for several years, downloading data from up to 50 remote loggers hourly in several different radio networks.
This code has not been packaged for distribution, or automatic installation, but it is intended to be available under the GNU Public License (GPL).
Brief technical descriptions of the primary components follow...
Campbell/Comm.pm
This module becomes part of a Perl program via the use or require keywords. It provides the machinery to connect and send/receive commands to/from a remote datalogger using Perl's object-oriented programming methodology. Individual methods are provided corresponding to some/most of the telecommunications commands documented in the Campbell Scientific CR10 family manuals.
Another Perl module is needed in order to interact with remote dataloggers, and that is Net::Telnet, which is included in the standard Perl distribution. This module allows automating the telnet protocol, but boils down to being able to send commands to the remote system and then wait for and handle responses -- or no response, if that's necessary.
Besides the nominal TCP/IP connections, Net::Telnet is capable of supporting interfaces using a direct serial or modem connection. This usage is implemented in the (or various...) open() methods.
A _bug_ in Net::Telnet (this is my view; it may be considered a _feature_ by the authors...) requires a patch; this should be represented in the Net::Telnet version included in the above tree. Specifically, Net::Telnet goes out of its way to handle timeouts using wall time (i.e., absolute time as measured on a wall clock) rather than relative inactivity time as used in the underlying select() system function. In our case the latter form is required due to the many levels and sources of latency in the communication system.
The Perl Expect module might provide a good alternative to Net::Telnet if Campbell::Comm were to be rewritten. Both provide the key functionality of being able to wait for and selectivly match on responses from the remote system.
Due to the specific need to communicate with dataloggers via FreeWave radios, the ...