Version 1 (modified by branden, 10 years ago) (diff)


Earthworm Module: reftek2ew

Contributed by:


A Reftek data feeding program


Module reftek2ew was developed and provided by Refraction Technologies, Inc. The module translates data from the Reftek data server, RTP, into Earthworm trace data format and writes Earthworm trace messages to an Earthworm shared memory ring.

Refraction Technologies, Inc. has provided the source code for both the Solaris and Windows 2000 versions. Along with this module, there are several other programs provided by Reftek which are required to run reftek2ew. Those can be found in the utils subdirectory in the reftek2ew source directory:


  • rtpd - rtp server daemon program used to boot up Reftek boxes and control communication with them
  • rtpc - rtp client program used for Reftek control

utils/winnt: (among other things)

  • rtpudpsvc.exe - rtp server
  • fsc.exe - Field Setup Controller
  • nci.exe - Network Control Interface


Lucky Vidmar Fri Jan 29 11:49:21 MST 1999

This file contains instructions for configuring RefTek data loggers
(e.g. model 72A with serial card RT422) to deliver data into a Solaris
or NT machine and convert it into Earthworm packets. The instructions
contained here are the result of trial-and-error, complemented with a
hefty dose of tech support from RefTek. Consulting ALL of the available
RefTek documentation is strongly recommended.

Communication between a RefTek data logger (Data Acquisition System -
DAS) and the server machine is done via the RefTek Protocol (RTP).  RTP
is designed to provide full-duplex, packet-oriented transport over UDP.
RTP is implemented as a client-server process with a DAS with a RT422
serial card as the client, and the RTPD application as the server. RTPD
is available for NT and Solaris - see instructions below for installing
RPTD on each platform.

RefTek recommends that RTP is implemented through a router, for example
a Cisco 2509, such that the set up will consist of two class C networks
(one on each side of the router).  The client DAS is on one network and
will connect to the router through an asynch serial interface using
PPP. The server is on the other network and the router takes care of
routing the traffic between the two networks.

          | network
                                 |                        |
                                 |    CISCO 2509          |
                                 |                        |
                                   |                   |
                                 Async1             Async2
                                   |                   |
                                   |      PPP          |
                                   |      LINK         |
                                   |                   |
                                   |                   |
                              ------------        ------------
                              |          |        |          |     
                              | DAS#7853 |        | DAS#7854 |     
                              |          |        |          |     
                              ------------        ------------

The Cisco router configuration for the setup shown above is as

hostname RefTekRouter
username das#7853 password 0 das#7853
username das#7854 password 0 das#7854
interface Ethernet0
 ip address
interface Serial0
 no ip address
interface Serial1
 no ip address
interface Async1
interface Async1
 ip address
 ip helper-address
 encapsulation ppp
 async mode interactive
 peer default ip address
 no cdp enable
 ppp authentication pap callin
interface Async2
interface Async2
 ip address
 ip helper-address
 encapsulation ppp
 async mode interactive
 peer default ip address
 no cdp enable
 ppp authentication pap callin
ip http server
ip classless
ip forward-protocol udp 2543
ip route Ethernet0
ip route Async1
ip route Async2
no logging console
access-list 101 permit ip any any
access-list 101 deny   igrp any host
dialer-list 1 protocol ip list 101
line con 0
 exec-timeout 0 0
line 1 2
 autoselect ppp
 modem InOut
 transport input all
 flowcontrol hardware
line 3 8
 transport input all
line aux 0
 transport input all
line vty 0 4
 exec-timeout 0 0
 password reftek

For more information about RTP consult the RefTek Protocol Manual.


More information about installing and troubleshooting RTPD can be
found in the RTPD Installation and Users Guide Manual.

1.  Windows NT 4.0

To configure the RTPD server as a Windows NT 4.0 service, copy the
service executable rtpudpsvc.exe and the startup file rtpd.ini from the
utils/winnt directory to, for example, c:\reftek. Edit the rtpd.ini
file to reflect local customizations (for example, directory names,
etc) then execute the following commands to install this program as a

 cd \reftek
 svcins rptd_service "RefTek Data Server" c:\reftek\rtpudpsvc.exe

The RTPD service can now be controlled like any other NT service,
using the Services icon within the Control Panel.

2.  Solaris 2.6

o Copy the rtpd binary from the utils/solaris directory to whatever
  directory you find convenient, and make sure it is setuid as the user
  you want it to run as.

This example assumes user "root", with executables in /usr/local/bin.
In that case you would copy rtpd to /usr/local/bin and execute the
following commands:

   chown root /usr/local/bin/rtpd
   chmod 4555 /usr/local/bin/rtpd

o Copy the rtpd.ini file from solaris/winnt to, for example,
  /usr/local/etc directory and make any local customizations to it.

The Solaris version of the file is identical to the NT version, with
the exception that path names are different.  You also have the choice
of using the syslog logging facility.  Suppose you want to use syslog.
Then select a facility and give it in the ini file like:

Facility   LOCAL6

Then, edit /etc/syslog.conf and include the following line:

local6.debug	/var/log/local6

Note that it should be a TAB between the two tokens.  Create
/var/log/local6 and HUP syslogd (as root, kill -HUP ),
once to get it to reread the conf file.  See syslog.conf(4) and
syslogd(1M) for additional information.

o Copy the startup script utils/solaris/rtpd_init to /etc/init.d 
  and make sure that it is executable (mode 544) and owned by root. 
  Change directory names and make any other local customizations. 

  Make the following soft links::

# ln -s /etc/init.d/rtpd_init /etc/rc3.d/S75rtpd_init
# ln -s /etc/init.d/rtpd_init /etc/rc2.d/K10rtpd_init
# ln -s /etc/init.d/rtpd_init /etc/rc0.d/K10rtpd_init

This will cause RTPD to be started automatically at boot time, and to
go down gracefully at system shutdown.  

The following command will manually stop the RTPD server:

reftek% /etc/init.d/rtpd_init stop

The following command will manually start the RTPD server:

reftek% /etc/init.d/rtpd_init start

How to Compile Reftek2ew

In order to build this program, you need to define the following in
your earthworm.d file:

RAW_RING       - transport ring for raw packets from the RTP server
MOD_IMPORT_RTP - module id for this process
TYPE_REFTEK    - message type for raw RTP server packets

If you want to assign pin numbers, you will need to define them in a
parameter file.  See import_rtp.d for the specification syntax, and
see reftek.scn for an example.

All dialog with the RTP server is done via the Refraction Technology
API and libraries.  You can get a copy of this toolkit from


Install the libraries and include files as per the instructions provided
with the toolkit.  You will need to specify the installation location in
your makefile.  See the comments in the makefile appropriate for your

Example Configuration File

# @(#)import_rtp.d	1.3 07/01/98
# reftek2ew parameter file

#  Basic Earthworm setup:

MyModuleId         MOD_REFTEK2EW  # module id for this process
WaveRing           WAVE_RING      # output ring for TRACEBUF messages
RawRing            RAW_RING       # output ring for REFTEK messages
HeartBeatInterval  30             # seconds between heartbeats

# At least one of WaveRing and RtpRing must be defined.
# If you have selected a WaveRing to output TRACEBUF messages, then it
# is necessary to define a mapping between the digitizer, stream, channel
# information that is contained in each packet to the station, channel,
# net, and pin number that is required by the TRACEBUF messages.  There
# is no standard way to do this in vanilla Earthworm, therefore import_rtp
# defines yet another parameter file.  If you don't specify this file,
# then import_rtp issues a warning message on start up and then generates
# its own names.  Station name is the unit id, channel name is built up
# from the stream and channel values in the DT header (stream:chan), the
# networm name is set to "RTP", and the pin number is set to -1.

SCNLFile            reftek.scnl

# Give the fully qualified host name, or the IP address of the server in
# the usual decimal dot notation, followed by the port number for the RTP
# service.  If you are running this on the same computer as the RTP server,
# then specify "localhost" as the host name.

Server             localhost    7000

# The API allows you to request data from a single, specific, DAS or from
# all DAS(es).  There is no provision in the API for requesting data from
# a subset of the available digitizers.  If you want data from a single DAS,
# give its unit id here, otherwise enter 0 to select all digitizers.

DASid              0

# You may filter the input based on packet type.  The following types are
# supported: AD CD DS DT EH ET OM SC SH.  List the ones you want, or enter
# ALL for all available.

PktMask            ET DT SC

# You may filter the DT packets based on stream.  List the stream id's you
# want to see.  The stream codes here are the one-based values that are
# used by people, not the zero-based values that are in the headers.

StrMask            1 2 3 4 5 6 7 8


modName  reftek2ew
tsec: 60  page: 0  mail: 10
# Uncomment the "restartMe" line to enable automatic restart of this
# process by statmgr/startstop.  statmgr will issue a TYPE_RESTART
# message for this process_id if it declares the patient dead.
err: 1  nerr: 1  tsec: 0  page: 0  mail: 20 
text: "RTP server OK."
err: 2  nerr: 1  tsec: 0  page: 0  mail: 20 
text: "RTP server not responding."
err: 3  nerr: 1  tsec: 0  page: 0  mail: 20 
text: "no data from RTP server."

Helpful Hints