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


Earthworm Module: adsend

Contributed by:


Digitizes analog seismic signals on Win2000 system only using National Instruments digitizer boards.


Adsend is the digitizing program for Earthworm. Adsend, which runs under Windows 2000, produces demultiplexed data. It does not work for Linux yet, but this is a work in progress. It was converted to SCNL as of Earthworm Version 7.0.

This program was designed to work with a single National Instruments DAQ board (model PCI-MIO-16E-4) and up to four MUX boards (model AMUX-64T). The DAQ board can be used without MUXs as a 16 channel system. Up to four MUX boards can be used, for a maximum of 256 channels, 64 channels per MUX. Adsend uses the NIDAQ function library, supplied by National Instruments. The NIDAQ functions may not be used in multi-threaded applications. For this reason, adsend is compiled single threaded, and it is linked with single-threaded versions of the earthworm library functions.

Adsend is designed to produce the highest quality data it can, but to keep running even if there is a loss of the IRIGE signal or external A/D trigger.


Adsend time stamps the trace data by de-coding an IRIGE time channel. At least one channel must contain IRIGE time code, which is decoded in software and used to time-stamp the data. When the program starts up, it will not send data until the IRIGE time signal is in sync. After adsend syncs to IRIGE, it will keep sending data even if time sync is lost. If the IRIGE sync is lost, a bit is set in the trace header to indicate "time code out of sync".

If the parameter SendBadTime is set in the adsend configuration file, adsend will use the PC system clock instead of an IRIGE signal to time stamp the data. This is NOT RECOMMENDED for production use, but is handy for testing purposes.

IRIGE time code does not contain the year. The adsend program can determine the year using one of two methods. In method 1, adsend reads the current year from its configuration file and puts it into the TYPE_TRACEBUF message headers. At midnight (GMT), on New Year's Eve, the year must be manually changed in the configuration file, and the A/D system must be restarted. In method 2, adsend reads the year from the PC clock. In order to insure that adsend and the PC clock are in sync, the PC clock time should be updated from the IRIGE time code. This is an option in the adsend configuration file.

To insure accurate time stamping at all times, adsend allows for the use of multiple IRIGE channels. If lock is lost on one IRIGE channel, the next on the list will be attempted.


Under certain conditions, the A/D system may experience "channel-rotation", a condition in which the digitized signals appear on the wrong channels. To detect channel rotation, adsend can monitor one "guide channel" from each MUX. The guide channels are connected to a triangle wave generator. If a guide channel does not contain a triangle wave, we assume that a channel rotation has occurred on a MUX, and we reset the entire DAQ system. The reset process takes about one second, producing a gap in the data stream. To avoid continual resetting, the system is not reset unless all guide channels have been in sync for a period of 30 seconds. Guide channels, if used, consist of 2 hz triangle waves, with amplitude -1V to +1V.???? I thought the amplitude could be variable.

The algorithm for detecting the guide channel can be tuned in the adsend configuration file. There are two threshold values. If the mean value of first-differences of the guide channels falls below a threshold value, adsend will do a restart. This will occur if a guide channel goes dead. If the standard deviation of first-differences of the guide channels exceeds a threshold value, adsend will also do a restart. This will occur if a guide channel is noisy.

During a restart, the resetting of the DAQ takes only about a second, but it takes about 20-30 seconds to re-sync on the IRGIE signal. Therefore, a gap of up to 30 seconds should be expected if there is a restart.

On startup or after a restart, if the guide channels do not lock in after ErrNoLockTime seconds (set in configuration file), adsend will send a message to statmgr.


Adsend can now be set to ring the computer bell if time code is not in sync or the guide channels are not locked in. This feature can be enabled or disabled using the EnableBell configuration file parameter.


A/D sampling may be internally triggered using a clock on the DAQ card, or an external trigger may be used. To insure the sampling rate is precise, it's best to use "external triggering" from a precision clock. We tested the system using an externally generated trigger, consisting of a 100 hz square wave, with amplitude 0-5V.

If the external trigger disappears for a user-specified amount of time, adsend will switch to internal triggering. If this occurs, an error message is logged and sent to the statmgr.


The system uses non-referenced, single-ended inputs (NRSE). The input signal's ground reference is connected to the DAQ AISENSE pin, which is also connected to the DAQ AIGND pin.


The National Instruments AMUX-64T boards sometimes have a problem with cross feed between channels. Additional hardware is needed to reduce cross feed, such hardware is available from VLF Design and is being designed at USGS, Menlo Park.


When using the Dell Optiplex series to digitize, care must be used as to which pci slot is used for the National Instruments PCI-MIO E-series card. You MUST use either slot PCI1 or PCI2 (the two slots closest to the mother board on the expansion riser). These are connected directly to the 100MHz bus. Higher slots connect via a bridge which causes a "bottleneck" and may result in unpredictable errors usually culminating in catastrophic failure and a physical memory dump (i.e. the infamous "blue screen crash"). For 64 channels or more, this error will be immediately obvious; for 16 channels the error may occur at some later time (perhaps only after quitting earthworm and logging out). As of 3/11/1999 this was an undocumented feature (neither in supplied nor online docs), but Dell Tech Support was aware of it.

Sample Configuration File

#                    -----------------------------
#  If there are no mux boards in the system, OnboardChans (16) channels are
#  digitized.  If there are mux boards in the system,
#  (4 * OnboardChans * NumMuxBoards) channels are digitized.
#  The station file must contain an entry for each channel digitized.
ModuleId         MOD_ADSEND_A   # Module id of this instance of adsend
OutRing          WAVE_RING      # Transport ring to write waveforms to
HeartbeatInt     15             # Heartbeat interval in seconds
EnableBell       1              # If non-zero, ring the computer bell if time
                                #   code is out of synch or the guide channels
                                #   are not locked on.
#                        CHANNEL CONFIGURATION
OnboardChans     16             # Number of channels on the DAQ card
NumMuxBoards     4              # Number of 64-channel mux's (0,1,2, or 4)
ChanRate         100.0          # Sampling rate in samples/second
ChanMsgSize      100            # TraceBuf message size, in samples
Gain             2              # Channel gains (-1: +/-10V)(1: +/-5V)(2: +/-2.5V)
SampRate         250000.0       # Sample rate/scan (max for PCI-MIO-16E-4 = 250000.)
#                           GUIDE CHANNELS
NumGuide         4              # Number of guide channels (usually one per mux)
GuideChan        0 4 8 12       # The channels carrying the guide signal
MinGuideSignal   110.0          # Guides are declared dead if the mean value of
                                #   guide 1st differences < MinGuideSignal
MaxGuideNoise    8.0            # Guides are declared dead if standard error of
                                #   guide 1st differences > MaxGuideNoise
TimeForLock      5              # The guide channel system is declared "locked on"
                                #   if all guide channels remain locked on for
                                #   TimeForLock seconds.
ErrNoLockTime    30             # At program startup or after a restart, if the
                                #   guide channel system does not lock on for
                                #   ErrNoLockTime seconds, adsend will report an
                                #   error to statmgr (see adsend.desc).
#                         TIMING INFORMATION
NumTimeCodeChan  2              # Number of time code channels
TimeCodeChan     1 2            # Get the time code from these channels
Year             1998           # Current year (reset manually at New Years)
YearFromPC       0              # 1->Ignore "Year" and take from PC clock
SendBadTime      0              # NOTE: if set to one, adsend will use the PC  
				# system time to time stamp the data.
				# It will make no attempt to decode IRIGE
UpdateSysClock   0              # 1->PC time updated with IRIGE
IrigeIsLocalTime 0              # 1 if Irige represents local time; 0 if GMT time.

TimeoutNoSend    120            # If no data is sent for TimeoutNoSend seconds,
                                # possibly due to bad time code, the program will
                                # switch to the next TimeCodeChan and restart the
                                # DAQ system.  If TimeoutNoSend = 0, this feature
                                # is disabled.

TimeoutNoSynch   1800           # If there is no time-code synch for TimeoutNoSynch
                                # seconds, the program will switch to the next
                                # TimeCodeChan and restart the DAQ system.
                                # If TimeoutNoSynch = 0, this feature is disabled.
#                         EXTERNAL TRIGGERING
# This program uses "High-Hysteresis Analog Triggering Mode".
# Triggering occurs when the trigger voltage becomes greater than HighValue.
# Detriggering occurs when the trigger voltage becomes less than LowValue.
# HighValue minus LowValue must be >= 0.1 volt.
# For more information on triggering, see the National Instruments "PCI-MIO
# E Series User Manual", Jan 1997 edition, chapter 3.
ExtTrig          1              # 0 for internal triggering; 1 for external
LowValue         2.75           # In volts (-10V to 10V) (must be < HighValue)
HighValue        3.25           # In volts (-10V to 10V) (must be > LowValue)

TimeoutNoTrig    5              # If no tracebuf messages are obtained for
                                # TimeoutNoTrigger seconds, the program will
                                # assume the external trigger is disconnected.
                                # The program will switch to internal triggering.
# Chan lines must follow the Channel Configuration lines in this file.
# Unused channels may be omitted from the list.  Pin numbers are optional.
# If a pin number is not specified for a channel, the pin number is set to
# the DAQ channel number.
#     DAQ      Station/
#   Channel    Comp/Net/Loc     Pin
#   -------    -------------    ---
Chan    0    GUIDa --- NC --     0
Chan    1    IRG1a T   NC --     1
Chan    2    IRG2a T   NC --     2
Chan    3    MMC   VHZ NN --     3
Chan    4    GUIDb --- NC --     4
Chan    6    NFI   VHZ NC --     6
Chan    7    MBU   VHZ NC --     7
Chan    8    GUIDc --- NC --     8
Chan   10    NRL   VHZ NC --    10
Chan   11    BMR   VHZ NN --    11
Chan   12    GUIDd --- NC --    12
Chan   13    RYS   VHZ CI --    13
Chan   15    PDR   VHZ NC --    15
Chan   16    LPG   VHZ NC --    16
Chan   17    JSA   VHZ NC --    17
Chan   18    RCC   VHZ NN --    18
Chan   19    PSA   VHZ NC --    19
Chan   20    GAX   VHZ NC --    20
Chan   22    CBW   VHZ NC --    22
Chan   23    OCM   VHZ NC --    23
Chan   24    CRG   VHZ CI --    24
Chan   25    PTA   VHZ NC --    25
Chan   26    BRM   VHZ NC --    26
Chan   27    BEN   VHZ NN --    27
Chan   28    GSN   VHZ NC --    28
Chan   30    FRI   VHZ BK --    30
Chan   31    CMN   VHZ NC --    31
Chan   32    PST   VHZ NC --    32
Chan   33    WSH   VHZ CI --    33
Chan   34    STR   VHZ NN --    34
Chan   35    BCG   VHZ NC --    35

Helpful Hints