# Tankplayer Overview

(last revised September 9, 2008)

"tankplayer" is part of the four-program set for recording and playing back the trace data for selected time intervals. See also trig2disk, waveman2disk, and wave_serverV.

Tankplayer has two common uses and one new use:

Tuning Operating Earthworms:

For example, an Earthworm system fails to locate a significant earthquake. The waveform data for the earthquake is requested from the wave_server and saved in tankplayer format. Using an experimental Earthworm, the event is played back with tankplayer, tuning the operational parameters until Earthworm performs satisfactorally. The operational parameters are then changed to those used in the test.

Quality Assurance:

One is to perform quality assurance tests. For such tests, an experimental Earthworm system would be set up, and one or more tankplayers would be connected as the data source. Each tankplayer would be given a lengthy list of data files, and "tankplayer" would play (broadcast into the earthworm) the trace data from these files, one after another, generally overnight. The earthworm system under test would then process the incoming data. In the morning, we would come in and examine the rubble.

Menlo Park has created a collection of over 50 historic trace data files, representing the trace data traffic during various 'moments of horror' at CalNet. These include the Loma Prieta mainshock, swarms during wind storms, concurrent events in different parts of the net, events during telemetry malfunctions, etc. These files were painfully created by reformatting CUSP data archive files. The format of these files is simple: it is a series of messages of TYPE_ADBUF, written with a binary write.

Real Time Data Feed:

Alternatively, as of Earthworm 7.3, the tankplayer module now accepts tank files moved into a loading directory for automatic playback. This is configured using the GetFromDir setting in the .d file. The files must be loaded in time order for this mode to work. This provides the Earthworm user with a new way to load waveforms into the rings...by creating a tank file generating program.

How Tankplayer Works:

On startup, tankplayer reads its configuration file. This specifies the message ring into which to inject the data, and the module name to use. Tankplayer is generally told to imitate a real data source, such as an A/D module, or a digital acquisition module. The parameter file also lists the data files to be played back. It also specifies a pause period. This was implemented to prevent the earthworm associator (binder) from becoming confused by rapid jumps in time between data files. This time period should be set to be larger than binder's association memory, to prevent it from trying to associate phase arrivals from different data files.

In operation, tankplayer places the waveform messages from its input file(S) into shared memory in simulated real time, using the delta-t between time-stamps in successive message headers to determine its timing. When the end of file is reached, it waits "Pause" number of seconds, and goes on to the next file, as specified in the parameter file.

Tankplayer is location code compliant and backward compatible. It accepts messages of either tracebuf or tracebuf2 as configured using the PlayMsgType parameter.

Tankplayer Tools:

Separate from tankplayer are tools to help create tankfiles from sac format files. One can also archive tank files using waveman2disk and configuring appropriate output format. The two tools are sac2tb and remux_tbuf. The notes from Pete Lombard about these tools:

> This is sac2tb, a utility for turning SAC data files into tracebuf files. Usage: sac2tb [-n samples] sacfile > tbuf-file

> Without the -n option, sac2tb defaults to 100 samples per packet.

> The intended use is that you run sac2tb on a bunch of SAC files for a given event or time period, "cat" all the files together, and then run remux_tbuf to make a tankplayer file. For example, in a directory of SAC files:

>       foreach m (*)
>       sac2tb $m >> tbuf
>       end

>       remux_tbuf tbuf test.tnk

> SAC doesn't have a provision for byte-swapping, so to my knowledge, SAC files are only in SPARC byte-order. At least that's the assumption here. If sac2tb is run on an intel machine, the SAC file will be swapped into intel byte-order and the resulting tracebuf messages will be marked accordingly.

> Pete Lombard, 19 May 2001

Five New Tankplayer tools for EW v7.2:

- ms2tank - convert miniseed files into a tank player buffer. This version uses Chad Trabant's libmseed which is now a part of the stock earthworm distribution. The previous version, ms2tb, used the UCB qlib2 and was restricted to Solaris and Linux. This version works on Solaris, Windows, Linux, and Mac OS X.
- tanksniff - this module outputs a sniffwave like output when you pass it a tank. It allows you to look at the contents of your tanks without having to play them back in tankplayer. It takes one argument, a tank.
- tankcut - this module will extract out a specified time slice from a tank. It requires a starting time and duration for extraction. If you run the module without any arguments, it spits back the version number and the argument options/args:

    $ tankcut

    Error, an input and output tank name must be provided
    tankcut version v0.0.1 2007-08-27
    usage: tankcut -s StartTime [-e EndTime|-d Duration] intank outtank
    		all times for -s and -e options must be in YYYYMMDDHHMMSS format

            -s StartTime - when to start including tracebufs from intank
    	-e EndTime - when to end including tracebufs from intank
            -d Duration - Duration in seconds from start time when to end including tracebufs from intank
    		Default Duration is 600 seconds from start time

- ring2tank - have you ever wanted to suck the data out of your ring and play it back to simulate a few hours of running of your system....well now you can. This module does just what it says, it takes 2 arguments, the name of a RING to read from, and the name of a tankfile to write to. Be warned that this module has no real smarts and will just keep on filling a file till it grows infinitely. You must CAREFULLY run this module from the command line and kill it when you are done with your data gathering...or it may kill your system when the disk fills. On SOLARIS systems the disk size limit for a file is 2 gigabytes unless you compile the program with the LARGEFILE flag options. See tankcut above when you want to trim the tank generated from this module.
- dc2tank - Data Center to tank. This is a complex module that allows a user to gather some data from the IRIS DMC using the DHI2mseed.jar java program. It extracts the desired stations and builds a tank based on an event start time and duration. There is a README.dc2tank provided with the code. This module requires that you have java installed on your system and in your path.

Paul Friberg - December 27, 2007

Module Index | Tankplayer Commands