Seiscomp-2 1
Seiscomp-2 1
1 Manual
2 Installation Procedure 4
2.1 Station and Stream Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Using the make key Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Configuring Dial-up Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4 Uninstalling Stations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4 Command-line Utilities 11
4.1 seiscomp ctrl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2 slinktool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3 SeedStuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5 Configuration Schemes 12
8 SeedLink Protocol 24
8.1 Handshaking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8.2 Data Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.3 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9 Troubleshooting 27
9.1 Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.2 SeedLink’s Plugin Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.3 SeedLink’s StreamProcessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.4 SeedLink’s I/O System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.5 SeedLink’s StreamMonitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.6 Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
B XML DTDs 33
B.1 streams.dtd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
B.2 seedlink.dtd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
B.3 chain.dtd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2
1 Introduction
The Seismological Communication Processor (SeisComP) is a new concept for a networked seismo-
graphic system, originally developed for the GEOFON network and further extended within the
MEREDIAN project under the lead of GEOFON/GFZ Potsdam and ORFEUS. SeisComP resources can
be found at the following locations:
• data acquisition
• data recording
• real-time communication
• user access
• automatic (N)RT data processing (quality control, event detection and location) ∗
The primary software components have been released as a software package called simply SeisComP.
The core of the software package is the SeedLink data acquisition system. SeedLink clients connect to
the server using a robust TCP/IP application level protocol (SeedLink protocol). The following clients
are included in the package:
slarchive saves data to the disk in Mini-SEED format, using either the SDS (SeisComP Data Structure),
BUD (Buffer of Uniform Data) or a user-defined directory structure.
slqplot is used to plot traces in real time, either in an X-Window or by creating image files.
slinktool is used mainly for testing a SeedLink server and to get information about the available stations,
time spans of streams, gaps, etc. See section 4.2.
The package also includes the libslink software library with its own documentation, which can
be used by C programmers to create their own clients. For backwards compatibility a version of Comserv
running in parallel with SeedLink is included in the package as well.
The data source for a SeedLink server can be anything which is supported by a SeedLink “plugin”.
Data supplied by a plugin can be in the form of 512-byte Mini-SEED packets or just raw integer
samples with associated timing and naming information. In the latter case, the SeedLink server uses an
integrated, highly configurable Stream Processor to create the desired datastreams and assemble Mini-
SEED packets. The following plugins are included in the package:
serial plugin supports Earth Data PS2400/PS6-24 (3 and 6 channels), Guralp DM24, Geotech DR-24
digitizers (HLCP protocol), and Prema DMM 5017 Digital Multimeter (experimental).
∗
Not covered by this manual
3
m24-plug supports Lennartz M24 (contributed by Lennartz Electronic GmbH).
fs plugin is used to feed data from files (Titan, Seisan or Mini-SEED format) into SeedLink (near-real
time).
comserv plugin is used to feed data from Comserv into SeedLink. This allows acquisition from older
generation Quanterra digitizers (Q380/Q680, Q4120, Q720, etc.).
q330 plugin supports the Quanterra Q330 (based on Quanterra’s Mountainair software).
More plugins (Kinemetrics K2, Lennartz MARS-88, Lennartz PCM 5800, Visitec, Geoscope CCU,
MK6) have been contributed, but not (yet) included in the package. The included C language plugin
interface is described in section 7.
The clients slink2orb and slink2ew can be used to import data from SeedLink directly into
Antelope and EarthWorm respectively. orb_plugin can be used to import data from an Antelope ORB
into SeedLink. In order to compile these modules, the development environment of a corresponding
system is needed. These packages can be downloaded from ftp://orfeus.knmi.nl/pub/software/seiscomp/.
An overview of SeedLink connectivity is shown on figure 1.
In order to simplify the installation procedure SeisComP configuration files can be created automati-
cally, using ”key files” to fill in templates. However, for advanced configuration, it is necessary to modify
the generated configuration files or templates by hand.
2 Installation Procedure
1. Create a user account that uses the ”bash” shell (the preferred user name is ”sysop” with home
directory ”/home/sysop”).
2. If you want to have an interactive (telnet-based) data request manager (DRM), create a second user
account that uses the ”tcsh” shell, having a different user ID, but the same group ID and working
directory as ”sysop”. Then add ”umask 002” to /.bashrc. (DRM is currently not maintained
and may not work correctly!)
3. Unpack the SeisComP binary distribution in ”/home/sysop” or whatever directory you chose in
step 1. This creates directories ”/home/sysop/{bin,doc,man,templates}”.
4. Create a ”key file”, using the bin/make_key utility. If you want to add more stations, run
bin/make_key again. See section 2.2.
5. Run bin/make_conf to create the configuration files for all stations from templates.
4
Linux/Solaris Computer Linux/Solaris Computer
Figure 1: Overview of SeedLink connectivity
TCP/IP
slinktool LISS
TCP/IP
slqplot
Quanterra datalogger Comserv comserv_plugin
TCP/IP
slarchive
Antelope−supported
Antelope orbplugin TCP/IP,
source Linux/Solaris Computer
dialup
NAQS source SeedLink chain_plugin slinktool
naqsplugin
(TCP/IP) SeedLink
5
slqplot
LISS source server
(TCP/IP) sockplugin slarchive
server
SeedLink source Solaris Computer
chain_plugin
(TCP/IP, dial−up) TCP/IP
slink2orb Antelope
PS6−24, etc. serial_plugin
Linux/Solaris/Windows Computer
TCP/IP
slink2ew Earthworm
6. Log in as root and run bin/make_root, which does the following:
If none of the above is needed (or done manually), then running bin/make_root is not
necessary.
7. Log in as ”sysop” or whatever login name you chose in step 1 and you will be in the SOM menu
(Station Operation Manager). See section 3.
For advanced configuration it might be necessary to modify the generated configuration files by hand.
It is also possible to edit the templates files such that subsequent runs of bin/make_conf produce
the desired configuration. make conf removes the content of “config” directory, so any manual
changes in config files will be lost! Therefore it is recommended to keep a copy of modified config files
in another directory.
6
2.2 Using the make key Utility
The make_key utility asks the user a series of questions. Some questions have default answers in square
brackets. To choose a default answer, enter an empty string. The questions are explained below:
Station code:
Name of your local station or the station you want to request from a remote server; up to 5
characters, uppercase.
7
If the data source is based on TCP/IP, you are now asked about the IP address and port. In case of
a local data source, the path to device file is asked.
Stream selectors:
If you want to get all available data leave it empty. Otherwise enter the selectors (uppercase,
separated by space), e.g. BH?.D. For more information, refer to the slinktool manpage.
8
Comserv segment ID [9600]:
The ID of station’s shared memory segment. Arbitrary number, but must be unique for each station
configured.
9
Uptime [900]:
The maximum time to keep the connection open. In dial-up mode the connection is closed as soon
as all available data is transmitted (in fact that is the only difference between real-time and dial-up
mode as far as SeedLink is concerned).
q - quit
Command --->
s - Start data acquisition starts SeedLink (if configured) and all configured local clients of all
stations. Also installs the SeisComP crontab.
k - Stop data acquisition stops SeedLink (if configured) and all configured local clients of all
stations. Removes the SeisComP crontab.
b - Start current station starts SeedLink (if configured) and all configured local clients of the
default station.
t - Terminate current station stops all configured local clients of the default station (SeedLink
is not stopped).
10
x - Start default plot in X-window starts real-time plotting of the default station in an X-window.
Plot configuration can be changed in config/slqplot station (see also section 6.1).
X - Abort default X-window plot stops the real-time plotting of the default station.
h - Change display host changes the DISPLAY environment variable. Set it to hostname:0.0.
o - Escape to Linux shell takes you to the user login shell, where command-line utilities can be used
(see also section 4).
4 Command-line Utilities
4.1 seiscomp ctrl
Instead of using the “b” and “t” options in the Acquisition Control Menu, you can start and stop all local
SeedLink clients of a single station with seiscomp_ctrl. The syntax is
seiscomp_ctrl {start|stop|check} station station...,
where station is a station ID.
It is harmless to use the “start” option when local clients are already running. SeisComP uses lockfiles
to ensure that superfluous program instances are not started.
The third option, “check”, only starts the station if it is not previously stopped by seiscomp_ctrl.
It is normally called from crontab.
When omitting the station names, the full start or stop is performed for all stations (including
SeedLink). However, seiscomp_ctrl does not change the SeisComP crontab (unlike “s” and “k”
options in the Acquisition Control Menu), so the crontab must be installed or removed manually.
4.2 slinktool
The slinktool utility can be used to check the status of a SeedLink server as well as request data.
Here are few examples:
slinktool -I localhost:18000
Shows general info about the server, including software version.
slinktool -L localhost:18000
Shows the list of stations available from the server.
slinktool -Q localhost:18000
Shows the timespan of data streams in SeedLink’s ring buffer.
slinktool -G localhost:18000
Shows the data gaps (missing data) in SeedLink’s ring buffer.
slinktool -C localhost:18000
Shows the status of connections.
11
slinktool -i all localhost:18000
Sends a generic query and returns the XML document. DTD of the document is given in
section B.2.
4.3 SeedStuff
SeedStuff is a collection of utilities that work with SEED data files (e.g. files created by slarchive).
Some of these utilities are included in SeisComP. Here are few examples:
check file data.mseed -B 512
Shows the content of file data.mseed (time span, gaps, etc.).
5 Configuration Schemes
If you answer “no” to the question “Install SeedLink” when using make_key, no local SeedLink server
will be configured, and all clients connect directly to remote server(s). Because each client has its own
connection to the server, the same data may be be transferred over the Internet many times. A permanent
Internet connection is required (no dial-up). This kind of setup is shown on figure 2.
In most cases, however, a local SeedLink server is used as shown in figure 3. In this case only
a single connection (via chain plugin) is established to each of the servers, minimizing the consumed
Internet bandwidth.
In some special cases it is desired to run two SeedLink servers as shown on figure 4. This will be
configured if you answer “yes” to the question “Install Digiserv” of make_key. (The primary SeedLink
server is called “Digiserv”).
12
Linux/Solaris Computer
TCP/IP
slinktool
TCP/IP
slqplot
TCP/IP
slarchive
Linux/Solaris Computer
TCP/IP
chain_plugin slinktool
SeedLink
slqplot
server
slarchive
Linux/Solaris Computer
slinktool
SeedLink
SeedLink
PS6−24, etc. serial_plugin server chain_plugin slqplot
server
(Digiserv)
slarchive
13
6 SeisComP Configuration Files
After running the make_conf utility the following files will be created in the “config” subdirectory
(station denotes station ID):
rc station some parameters used by SOM and other scripts. SOM and seiscomp_ctrl obtain the
station list based on these files.
slqplot station slqplot configuration for station. See also section 6.1.
station station main configuration file of Comserv (obsolete). Needs a symbolic link from data/station/
station.ini. See Comserv documentation.
stations.ini additional configuration file for Comserv (obsolete). Needs a symbolic link from /etc/
stations.ini, created by make_root. See Comserv documentation.
network.ini configuration file for Netmon (obsolete). Needs a symbolic link from /etc/network.ini,
created by make_root. See Comserv documentation.
plugins.ini configuration file for SeedLink plugins. Used by serial_plugin, fs_plugin and
comserv_plugin.
seedlink.ini main configuration file for SeedLink. See also section 6.2.
filters.fir coefficients of SeedLink’s decimating FIR filters. If a filter’s name ends with “M”, it is a
minimum-phase filter – causal filter with minimized (non-constant) phase delay; since the filter
is non-symmetric all coefficients must be given. Otherwise the filter is a zero-phase filter – non-
causal filter with zero phase delay; in this case the filter is symmetric and so only half of the
coefficients must be given (it is not possible to use a zero-phase filter with an odd number of
coefficients).
Important note: The coefficients for non-symmetric (minimum-phase) FIR filters in the filters.fir
file are stored in reverse order. It is important to reverse the order of coefficients if the operator adds
a new minimum-phase filter or uses the included minimum-phase filters for another application.
The coefficients for symmetric (zero-phase) FIR filters are not stored in reverse order. As a sanity
check for symmetric filters the largest coefficient is always in the middle of the symmetry.
streams.xml SeedLink stream configuration file for the internal Stream Processor, referenced from
seedlink.ini. See also section 6.3.
chain*.xml configuration file for chain_plugin. If one chain is used (no Digiserv), the file is called
chain.xml. Otherwise there will be two files: chain digiserv.xml and chain seedlink.xml. See also
section 6.4.
DTDs corresponding to the XML configuration files are included in the SeisComP package and also
shown in appendix B. An XML file can be checked against it’s DTD (“validated”) with the xmllint
utility like this:
14
xmllint is a part of “libxml2” package that can be downloaded from http://www.xmlsoft.org/.
INI files have a somewhat obscure syntax. They contain zero or more sections, each beginning with
a section name in square braces which should appear on a line of its own. Section name cannot contain
spaces and square braces, but it can be optionally surrounded by spaces. Each section consists of zero
or more entries – definitions and assignments. A definition consists of a keyword and a name separated
by spaces (e.g. “station EDD”). An assignment consists of a parameter and a value separated by the “=”
sign and optionally surrounded by spaces (e.g. “network = GE”).
The set of assignments that immediately follow a definition is in the scope of that definition.
Assignments in the beginning of a section are “global” – they are used to set some generic parameters
and provide default values (e.g. “network = GE” in the beginning of the section sets the default network
that can be overridden in the scope of a station definition).
Parameters and keywords are case insensitive and must not contain symbols “=”, “[”, “]” or spaces.
Names must not contain “=” signs or spaces. Values must not contain “=” signs or spaces, unless
enclosed in double quotes. Double quotes that are part of the value itself must be preceded by “\”.
Each assignment must be complete on a single line, but several assignments can appear on one line,
separated by spaces. Any line beginning with a “#” or “*” character is regarded as a comment and
ignored.
6.1 slqplot.ini
Usually there is one slqplot configuration file per station called slqplot station. The file may contain
several sections, but only one, either having the same name as the executable or specified with the “-
c” commandline option, is used. A section in qplot.ini has the following structure (default values, if
applicable, are shown in square brackets ∗ ):
parameter “scroll step” [1] how many traces to scroll when end of page is reached.
parameter “complete pages” [no] if “yes” wait until all channels have reached the end of page. If
“no” scroll as soon as the first channel reaches the end of page.
parameter “coloured traces” [no] if “yes” use different colors for subsequent traces. Colors are not
supported by all output devices; in textronix format special control sequences are used which are
only supported by the tek2gif program.
keyword “channel” (seedname) Adds one channel to the plot. E.g., “channel BHZ”.
∗
It is generally not recommended to rely on default values, because they may change in future versions.
15
parameter “filter” name of IIR filter used. Filters are defined in a file selected with the “-F”
command-line parameter of slqplot.
parameter “fmag” [100] additional magnification used when filtering.
keyword “plot” (format) adds one output display. Supported formats are “x”, “ps”, “hpgl”, “tek” and
“meta”. E.g., “plot tek”.
parameter “display” name of X display, overrides the DISPLAY environment variable. (Appli-
cable to “x” format.)
parameter “term” terminal type, overrides the TERM environment variable. Applicable to “tek”
format.
parameter “file” output file. If the value starts with a “|” output is sent to a pipe. First occurrence
of “*” is replaced with a timestamp. Applicable to all formats except “x”.
parameter “fg” [black] foreground color.
parameter “bg” [white] background color.
parameter “size” [1024x682] size of display in pixels. (Applicable to “x” format.)
parameter “paper” [a4] paper size. Applicable to “ps” and “hpgl” formats.
parameter “orientation” [landscape] “portrait” or “landscape”. Applicable to “ps” and “hpgl”
formats.
parameter “scale” x and y scale factors separated by “;”. E.g. “1.5;1”. Applicable to all formats
except “x”, default value depends on format.
parameter “offset” x and y offsets in dots separated by “;”. E.g., “-1250;0”. Applicable to all
formats except “x”, default value depends on format.
6.2 seedlink.ini
seedlink.ini may also contain several sections, but only one having the same name as the executable
being used. A section in seedlink.ini has the following structure:
parameter “organization” organization ID, shown with slinktool -I. (Arbitrary string.)
parameter “network” default network code; used when a network code is omitted by a client in
STATION request. Should be set to the network code of the majority of configured stations. 1
or 2 characters long, uppercase.
parameter “lockfile” path to the lock file; used by seiscomp_ctrl to check if seedlink is running.
parameter “streams” path to streams.xml. Setting this parameter activates the SteamProcessor.
parameter “encoding” [steim1] default encoding when converting raw streams to Mini-SEED. The
value must be “steim1” or “steim2”.
parameter “filebase” path to the base directory of SeedLink data files (disk buffer).
16
parameter “trusted” [0.0.0.0/0] list of trusted IP addresses or IP/mask pairs (in ipchains/iptables
syntax) separated by spaces and/or commas. The parameters with “ trusted” suffix are applicable
if the client has trusted IP address, otherwise the version without “ trusted” suffix applies.
parameter “stream check” [disabled] default for all stations (see below).
parameter “gap check pattern” default for all stations (see below).
parameter “gap treshold” [10000] default for all stations (see below).
parameter “window extraction” [disabled] can be “enabled” or “disabled”. Required for slinktool
option “-tw”.
parameter “window extraction trusted” [disabled] same as above for trusted IP addresses.
parameter “info” [capabilities] maximum info level available for clients (has an effect on “-L”, “-
Q”, “-G”, “-C” and “-i” options of slinktool). Possible values are (in increasing order) “id”,
“capabilities”, “stations”, “streams”, “gaps”, “connections”, “all”.
parameter “request log” [enabled] whether or not to show requests in log file. Value can be “enabled”
or “disabled”.
parameter “proc gap warn” [2] default for all stations (see below).
parameter “proc gap flush” [0] default for all stations (see below).
parameter “seq gap limit” [0] maximum “sequence gap” allowed. Used by the server to decide what
to do if a client requests a packet with sequence number that is not in the buffer. If the difference
between the sequence number of the oldest packet in the buffer and the sequence number requested
is equal or less than “seq gap limit” then data transfer starts from the oldest packet in the buffer.
Otherwise data transfer starts from the next packet coming in.
parameter “connections” [0] maximum number of connections allowed to the server (0—no limit).
parameter “bytespersec” [0] maximum connection speed in bytes per second per TCP/IP connection
(0—no limit).
parameter “plugin timeout” [0] default for all plugins (see “timeout” below).
parameter “plugin start retry” [0] default for all plugins (see “start retry” below).
17
parameter “plugin shutdown wait” [0] default for all plugins (see “shutdown wait” below).
keyword “plugin” (plugin id) adds a plugin instance. Some plugins handle multiple stations while
others require one instance per station. Keyword “plugin” is followed by a unique identifier of the
plugin instance.
parameter “cmd” shell command to start a plugin instance. Plugin ID is appended to the string.
parameter “timeout” if no data arrives within this time period in seconds SeedLink shuts down
the plugin (0—wait for data forever).
parameter “start retry” restart terminated plugins after this time period in seconds (0—never
re-start terminated plugins). Plugins may terminate themselves because of some internal
error or they can be shut down by SeedLink if timeout occurs or invalid data received.
parameter “shutdown wait” wait this time period in seconds for a plugin to terminate after
sending the TERM signal (0—wait forever). If a plugin does not terminate on it’s own within
this time period, the KILL signal will be sent.
parameter “dynamic stations” if “enabled”, new stations are added automatically, even if they
are not explicitly defined. Such “dynamic” stations support send mseed() only.
parameter “station description” default description used by dynamic stations or if a station
definition lacks the “description” attribute.
keyword “station” (station id) adds a station. Followed by a unique identifier of the station (used in
the plugin interface).
parameter “name” SEED station code (up to 5 characters, uppercase). Defaults to station id.
parameter “network” SEED network code (1 or 2 characters, uppercase).
parameter “description” station description, shown with slinktool -L (arbitrary string).
parameter “buffers” size of memory buffer (number of recent Mini-SEED records kept in
RAM).
parameter “segments” number of disk buffer segments (files under <dir>/station/segments/
where <dir> is the directory pointed by the “filebase” parameter).
parameter “segsize” size of one disk buffer segments in records (512-byte units).
parameter “blanks” number of blank records to insert after the re-scan of disk buffer if
<dir>/station/buffer.xml is not found (assuming the server did not terminate cleanly).
parameter “request log” whether or not to show requests in log file. Value can be “enabled” or
“disabled”.
parameter “access” list of IP addresses or IP/mask pairs (in ipchains/iptables syntax), separated
by spaces and/or commas. Only if a client’s IP address matches one of those is the station
shown (slinktool -L, etc.) and accessible. If omitted, the global “access” parameter is
used. If the global “access” parameter is not set any client can access the station.
parameter “proc” name of the “proc” object (defined in streams.xml); used for processing raw
streams (streams submitted by a plugin as raw samples).
parameter “proc gap warn” minimum time gap in a raw stream (microseconds) that causes
warning in log file (0—disabled).
18
parameter “proc gap flush” minimum time gap in a raw stream (microseconds) that causes a
flush of all Mini-SEED streams associated with it (0—disabled).
parameter “encoding” encoding of Mini-SEED records created by SeedLink. The value must
be “steim1” or “steim2”. If omitted, the global “encoding” parameter is used.
parameter “stream check” if “enabled” Mini-SEED data (both input and locally generated
Mini-SEED streams) will be checked for time spans and (optionally) gaps. Required for
“window extraction” and slinktool options “-Q” and “-G”.
parameter “gap check pattern” regex pattern of streams to be checked for gaps. Default is to
check all data streams.
parameter “gap treshold” time difference between records (microseconds) above which a gap
is declared.
If “stream check”, “gap check pattern” or “gap treshold” is changed it is necessary to remove files
<dir>/*/buffer.xml, where <dir> is the directory pointed by the “filebase” parameter. In this case the
disk buffer is re-scanned when SeedLink is started (which will take some time).
6.3 streams.xml
This file, like all XML documents, has a tree-like structure. The root element is called “stream” and it in
turn contains “proc” elements which are referenced by name in seedlink.ini. A “proc” element contains
one or more “tree” elements, which in turn contain “input” and “node” elements. There should be one
“input” element per plugin channel—if an “input” element is missing, the channel is ignored and you
will see a message like:
element “proc” defines a “proc” object (set of “stream trees”), referenced from seedlink.ini.
attribute “name” name of “proc” object, for reference.
element “using” used to include all “stream trees” defined by one “proc” object in another
“proc” object.
attribute “name” the name of referenced “proc” object.
element “tree” defines a “stream tree” – a downsampling scheme of an input channel.
element “input” associates an input channel with the stream tree.
attribute “name” name of the input channel; depends on the configuration of the
particular plugin (usual channel names are “Z”, “N” and “E”).
attribute “channel” name of the output channel (last letter of a Mini-SEED stream
name).
attribute “location” Mini-SEED location code of the output channel (up to two
characters).
attribute “rate” sample rate of the input channel (must match the actual sample
rate, which is dependent on the configuration of the plugin and digitizer).
19
element “node” defines a node of a stream tree; this element is recursive, meaning that
it may contain one or more “node” elements itself.
attribute “filter” use the named filter for decimation; filters are defined in file
filters.fir.
attribute “stream” create Mini-SEED output stream at this node. The value of the
attribute should be Mini-SEED stream name excluding the last character (which
is taken from the attribute “channel” of element “input”).
6.4 chain.xml
This is the configuration file of chain_plugin which is used to connect two SeedLink servers
together. If you chose “SeedLink” as the type of data source (section 2.2) then chain.xml will be created
by make_conf. However, you may want to edit it by hand to use the advanced settings.
Here is the description of all elements and attributes:
attribute “verbosity” Overrides verbosity level given on the command line. Set this to “1” if you
want to see more messages. Higher values are probably only useful for debugging.
attribute “timetable loader” path to the program used to load the initial end times of streams.
Used for initial overlap detection.
attribute “overlap removal” [none] should be set to “full”, “initial” or “none”. Default for
enclosed elements (see below).
attribute “multistation” [yes] default for enclosed elements (see below).
attribute “netto” [0] default for enclosed elements (see below).
attribute “netdly” [0] default for enclosed elements (see below).
attribute “keepalive” [0] default for enclosed elements (see below).
attribute “standby” [0] default for enclosed elements (see below).
attribute “seqsave” [0] default for enclosed elements (see below).
element “extension” adds an extension module instance. Extension module is an external
program that runs as a child process and communicates with chain plugin using the
“chain plugin extension interface”. The latter is compatible, but extended version of the
SeedLink plugin interface (in principle, any SeedLink plugin can be used as chain plugin
extension module).
attribute “name” name of the extension module instance. The name of each instance must
be unique.
attribute “filter” regular expression that determines which streams are sent to the particular
extension module instance. The regular expression is matched against string “n s l c t”,
where n is network code, s is station code, l is location code, c is SEED channel code
and t is stream type. For example, “GE APE BHZ D” means that BHZ.D stream of
station APE with network code GE is sent to this extension module, while “.* BH. D”
means that streams BHZ.D, BHN.D and BHE.D of all stations are sent.
attribute “cmd” shell command to start the executable. The name of the extension module
instance is appended to the string.
20
parameter “recv timeout” [0] if no data arrives within this time period in seconds, then
chain plugin shuts down the extension module (0—wait for data forever).
parameter “send timeout” [60] maximum number of seconds to wait when sending a data
record to the extension module. if the record is not accepted during this time period, then
chain plugin shuts down the extension module (0—wait forever, risking with hangup of
chain plugin).
parameter “start retry” restart terminated extension modules after this time period in
seconds (0—never re-start extension modules). Extension modules may terminate
themselves because of some internal error or they can be shut down by chain plugin
if timeout occurs or invalid data received.
parameter “shutdown wait” wait this time period in seconds for an extension module to
terminate after sending the TERM signal (0—wait forever). If an extension module
plugin does not terminate on it’s own within this time period, the KILL signal will be
sent.
element “group” defines a station group corresponding to a single SeedLink connection. One
child process per group is created.
attribute “address” address of the remote server in hostname:port format.
attribute “overlap removal” default for enclosed elements (see below).
attribute “multistation” should be ”yes” if the version of remote SeedLink server is ≥ 2.5,
otherwise ”no” (in this case only one station per group can be defined).
attribute “netto” “network timeout” in seconds. If no data (and heartbeat responses) are
received during this period the connection is reopened (0—disabled).
attribute “netdly” “network reconnect delay” in seconds. After closing the connection due
to timeout wait this amount of seconds before trying to open the connection again.
attribute “keepalive” if no data is received during this period a keepalive packet will be
requested (0—disabled).
attribute “uptime” [0] setting this to any value other than 0 activates dial-up mode. In this
case the value is the maximum connection time in seconds.
attribute “standby” when dial-up connection cycle is finished wait this amount of seconds
until starting a new cycle (overridden by “schedule”, see below).
attribute “seqsave” interval of saving the connection state (SeedLink sequence numbers)
in seconds.
attribute “seqfile” path to file where the connection state is saved.
attribute “ifup” path to a program or script that is called at the beginning of a dialup cycle.
If you are not using “demand dialing” this script can be used to initiate PPP connection.
attribute “ifdown” path to a program or script that is called at the end of a dialup cycle.
Can be used, for example, to terminate PPP a connection.
attribute “schedule” dialup schedule in crontab format. Overrides “standby”.
attribute “lockfile” connection lock file. Useful to prevent several dialup connections using
the same modem at the same time.
element “station” defines station within a group.
attribute “id” station ID known to SeedLink, defaults to network station.
attribute “name” station code at the remote server.
21
attribute “network” network code at the remote server.
attribute “out name” local station code (used to change the station code). Defaults to
name.
attribute “out network” local network code (used to change the network code).
Defaults to network.
attribute “selectors” list of stream selectors separated by spaces. If left empty all
available streams will be requested. See slinktool manpage for more information.
attribute “overlap removal” if “full” all overlapping records will be filtered out. If
“initial” only initial overlaps will be removed (initial overlaps may happen if
saved connection state is not current due to a power failure). Removal of initial
overlaps is based on the input from an external program referenced by the attribute
“timetable loader”. If the value is “none” no overlaps will be removed.
attribute “default timing quality” timing quality put into the Mini-SEED header if
not defined in source data (used only in case of unpacking; see below).
element “rename” used to rename streams.
attribute “from” source stream in format “LLCCC”, where LL is location code
and CCC is SEED channel code. Wildcard “?” is allowed. If LL is omitted, ?? is
implicitly used.
attribute “to” target stream in format “LLCCC”, where LL is location code and
CCC is SEED channel code. Wildcard “?” is allowed. If LL is omitted, ?? is
implicitly used.
element “trigger” defines a “triggered” stream which can be switched on and off based
on detections, etc.
attribute “src” source stream in format “LLCCC”, where LL is location code and
CCC is SEED channel code. LL should be omitted if the location code is empty.
Wildcards are not allowed. allowed).
attribute “buffer length” [60] amount of buffered data in seconds.
attribute “pre seconds” [20] turn on the stream this amount of seconds before
trigger on time (provided the data is still in the buffer).
attribute “post seconds” [20] turn off the stream this amount of seconds after
trigger off time.
element “unpack” creates raw streams from Mini-SEED streams. Raw streams can be
downsampled by SeedLink.
attribute “src” source stream in format “LLCCC”, where LL is location code and
CCC is SEED channel code. LL should be omitted if the location code is empty.
Wildcards are not allowed.
attribute “dest” target channel name (must have matching “input” element in
streams.xml).
attribute “double rate” [no] doubles the sample rate by adding zeros to datas-
tream. Only spectrum above Nyquist frequency is affected (eg. 25Hz in case of
50Hz sample rate), so using this option it is possible to downsample from 50Hz
to 20Hz.
22
7 SeedLink Plugin Interface
In order to implement a SeedLink plugin a developer needs two files included in the SeisComP
distribution: plugin.h and plugin.c. In these files the following public functions are defined:
int send mseed(const char *station, const void *dataptr, int packet size);
is used to send a Mini-SEED packet to SeedLink. Such packets are not further processed. The
parameters are:
23
station station ID.
dataptr pointer to 512-byte Mini-SEED packet.
packet size must be 512.
8 SeedLink Protocol
SeedLink session starts with opening the TCP/IP connection and ends with closing the TCP/IP
connection. During the session the following steps are performed in order:
2. handshaking;
4. closing connection.
We will take a closer look at the protocol. Note, however, that the details are normally hidden from
the clients by the “libslink” software library, therefore it is not necessary to be familiar with the protocol
in order to implement clients.
8.1 Handshaking
When the TCP/IP connection has been opened the server will wait for the client to start handshaking
without initially sending any data to the client. During handshaking the client sends SeedLink commands
to the server. Commands are used to set the connection into a particular mode, setup stream selectors,
request a packet sequence number to start with and, eventually, start data transmission.
SeedLink commands consist of an ASCII string followed by zero or more arguments separated by
spaces and terminated with carriage return (ASCII code 13) followed by an optional line feed (ASCII
24
code 10). Commands can be divided into two categories: “action commands” and “modifier commands”.
Action commands perform a function such as starting data transfer. Modifier commands are used to
specialize or modify the function performed by action commands that follow.
When a server receives a modifier command it responds with ASCII string “OK” followed by a
carriage return and a line feed to acknowledge that the command has been accepted. If the command
was not recognized by the server or has invalid parameters, then ASCII string “ERROR” followed by a
carriage return and a line feed, is sent as a response to the client. The client should not send any further
commands before it has received a response to the previous modifier command. If a network error or
timeout occurs the client should close the connection and start a new session.
Data transmission is started when the server receives DATA, FETCH, TIME or END command as
described in section 8.3. Once the data transfer has been started no more commands, except INFO,
should be sent to the server.
The flow diagram of handshaking in uni-station vs. multi-station mode is shown on figure 5.
STATION
[ SELECT ]
{ DATA | FETCH | TIME }
Uni−station handshaking
END
25
The data is transferred as a continuous stream without any error detections or flow control because
these functions are performed by the TCP protocol. This guarantees the highest data transfer rate that is
possible with the particular hardware and TCP/IP implementation.
Obviously, the average data transfer rate must be greater than the rate at which new data becomes
ready to send at the server. If this is the case, sooner or later the server has sent all data available to the
client. When this happens, depending on the SeedLink mode, the server sends new data as soon as it
arrives or appends ASCII string “END” to the last packet and waits for the client to close connection.
The latter mode is called “dial-up mode” because it is normally used in conjunction with dial-up lines
to open the connection periodically for a short time and download all data available. A SeedLink packet
can never start with “END” thus no ambiguity arises.
8.3 Commands
HELLO
responds with a two-line message (both lines terminated with CR+LF). The first line contains the
version number of the SeedLink daemon, the second line contains station or data center description
specified in the configuration. HELLO is used mainly for testing a SeedLink server with “telnet”.
It is also used by libslink to determine the server version.
CAT
shows the station list. Used mainly for testing a SeedLink server with “telnet”.
BYE
closes the connection. Used mainly for testing a SeedLink server with “telnet”.
END
end of handshaking in multi-station mode. This is an action command, because it starts data
transfer. No explicit response is sent.
SELECT [pattern]
when used without pattern, cancels all selectors. Otherwise, if pattern is a positive selector,
without leading “!”, broadens the selection of Mini-SEED streams; if pattern is a negative selector,
with leading “!”, narrows the selection of Mini-SEED streams. Only one selector can be used in
single SELECT request. A SeedLink packet is sent to client if it matches any positive selector and
doesn’t match any negative selectors.
General format of selectors is LLCCC.T where LL is location, CCC is channel, and T is type
(one of DECOTL for data, event, calibration, blockette, timing, and log records). “LL”, “.T”, and
“LLCCC.” can be omitted, meaning “any”. It is also possible to use “?” in place of L and S. Some
examples can be found in table 1.
26
Selectors used Mini-SEED streams transferred
BH? BHZ, BHN, BHE (all record types)
BH?.D BHZ, BHN, BHE (data records)
00BH?.D BHZ, BHN, BHE with location code ’00’ (data records)
BH? !E BHZ, BHN, BHE (excluding detection records)
BH? E BHZ, BHN, BHE plus detection records of all
channels
!LCQ !LEP all except LCQ and LEP channels
!L !T all except log and timing records
SELECT is a modifier command (it modifies the function of subsequent DATA, FETCH or TIME
commands) so it responds with “OK” on success, “ERROR” otherwise.
INFO level
requests an INFO packet containing XML data embedded in a Mini-SEED log record. level should
be one of the following: ID, CAPABILITIES, STATIONS, STREAMS, GAPS, CONNECTIONS,
ALL. The XML document conforms to the DTD shown in section B.2. The amount of info
available depends on the configuration of the SeedLink server.
9 Troubleshooting
If SeisComP is not functioning correctly, it is recommended to first check the log files in the “logs”
directory, /var/log/messages and /var/log/seedlink. In order to find the error quickly, it is neccesary to
understand that the data goes through the following major components of the system:
• plugin,
27
• SeedLink’s StreamProcessor,
• SeedLink’s StreamMonitor,
Often the malfunction of data acquisition is caused by generic operating system errors such as disk
corruption, therefore it is very important to check /var/log/messages if the system behaves strangely.
In the following, we will take a look at errors that can happen in each of the components.
9.1 Plugin
A plugin is just a normal program that sends data to file descriptor 63 (opened by SeedLink before it
executes the plugin). Have a look at a plugin definition in seedlink.ini; it is similar to the following:
Using the command line shown, you can run the plugin standalone as follows (note that the plugin
name is appended to the command line):
(before you do it, shut down the aquisition to make sure no other plugin instances are running). Here
we asked the shell to pre-open the file descriptor 63 and re-direct it to file data.dat (this syntax does not
work with C-shell).
If the plugin works, then data (in SeedLink’s internal format) should appear in the file data.dat. Log
messages are sent to standard output. If no data arrives, check if baudrate and other settings are correct in
plugins.ini. It is usually possible to increase verbosity by -v flag or by editing plugins.ini. Some plugins
print a help message if --help flag is used.
∗
If “dynamic stations=enabled” is set in seedlink.ini, new stations are added automatically, however, such stations are not
supported by the StreamProcessor, so only Mini-SEED data is accepted from a plugin.
28
9.3 SeedLink’s StreamProcessor
While Mini-SEED streams go straight to the I/O System, raw streams pass the StreamProcessor module,
which is probably the most problematic part of SeedLink for inexperienced users.
The StreamProcessor is enabled by pointing the parameters “streams” and “filters” in seedlink.ini to
respective configuration files. If StreamProcessor is not enabled, then raw datastreams are ignored and
you can see warning in seedlink log file that looks like this:
The next possible error is mismatch between names or sample rates of raw channels and stream
processing scheme used. When you look at a station definition in seedlink.ini, you can see something
similar to the following:
The “proc” attribute selects the stream processing scheme. If this attribute is missing, raw data is not
accepted and you will get the error shown above.
The stream processing schemes are defined in the file streams.xml. The scheme “edata 100” is in
fact based on two other schemes defined in this file:
<proc name="edata_100">
<using proc="generic_6x100"/>
<using proc="edata_aux"/>
</proc>
<proc name="generic_6x100">
<tree>
<input name="Z" channel="Z" location="" rate="100"/>
<input name="N" channel="N" location="" rate="100"/>
<input name="E" channel="E" location="" rate="100"/>
29
<node filter="VLP" stream="VH"/>
</node>
</node>
</node>
</tree>
<tree>
<input name="Z1" channel="Z" location="" rate="100"/>
<input name="N1" channel="N" location="" rate="100"/>
<input name="E1" channel="E" location="" rate="100"/>
This scheme tells the StreamProcessor how to create 12 streams (BHZ, BHN, BHE, LHZ, LHN,
LHE, VHZ, VNH, VHE, SNZ, SNN, SNE) from 6 raw input channels (Z, N, E, Z1, N1, E1). Each raw
data packet sent by a plugin is labeled with channel ID in addition to station ID, so the StreamProcessor
knows which packet belongs to which channel.
Sometimes the channel ID’s are hardcoded within a plugin, but often they can be defined by a user.
For example, in case of serial plugin the following can be found in plugins.ini:
channel Z source_id=0
channel E source_id=1
channel N source_id=2
channel S0 source_id=16
channel S1 source_id=17
channel S2 source_id=18
channel S3 source_id=19
channel S4 source_id=20
channel S5 source_id=21
channel S6 source_id=22
channel S7 source_id=23
channel S8 source_id=24
If a plugin uses channel ID, which is not defined in the stream processing scheme, a warning similar
30
to the following is shown:
It is also important that the actual sample rate of raw channels is the same as defined in the scheme,
otherwise the time calculation is wrong and there will be apparent gaps in data:
Jun 26 02:26:18 st27 seedlink: AMZI : Z time gap -8.15 seconds (detected)
31
9.6 Clients
If the SeedLink server seems to work correctly and data appears in the SeedLink’s disk buffer, but nothing
is saved in the “archive” directory, most probably the “slarchive” client is not running properly.
The clients acquire data from the SeedLink server only via TCP/IP, even if they are running on the
local machine. When a client starts, the SeedLink commands it sends are listed in the SeedLink log file.
Using slinktool, you can check which clients are connected, what is the status of connections (eg.,
if there are many packets in the Queue, the client may be hanging or there may be network errors that
prevent it from getting data). If the StreamMonitor is enabled, slinktool can also show the timespans
of streams in the buffer.
You can also telnet to the SeedLink server and use the commands listed in section 8.3 directly:
Network connections can be also tested with slinktool. The following command will request
station APE from the GEOFON server and print verbose information about every packet received:
32
A SeisComP Data Structure (SDS) definition
Aug. 13, 2003
Purpose:
Define a simple directory and file structure for data files. The SDS
provides a basic level of standardization and portability when
adapting data servers (AutoDRM, NetDC, etc.), analysis packages
(Seismic Handler, SNAP, etc.) and other classes of software that need
direct access to data files.
<SDSdir>/Year/NET/STA/CHAN.TYPE/NET.STA.LOC.CHAN.TYPE.YEAR.DAY
Definitions of fields:
The dots, ’.’, in the file names must always be present regardless if
neighboring fields are empty.
Additional data type flags may be used for extended structure definition.
B XML DTDs
B.1 streams.dtd
<!ELEMENT streams (proc+)>
<!ELEMENT proc (using+ | (using+, tree+) | tree+)>
<!ATTLIST proc
name CDATA #REQUIRED>
<!ELEMENT using EMPTY>
<!ATTLIST using
proc CDATA #REQUIRED>
<!ELEMENT tree (input+, node+)>
<!ELEMENT input EMPTY>
<!ATTLIST input
name CDATA #REQUIRED
channel CDATA #REQUIRED
location CDATA #REQUIRED
rate CDATA #REQUIRED>
<!ELEMENT node (node*)>
33
<!ATTLIST node
filter CDATA #IMPLIED
stream CDATA #IMPLIED>
B.2 seedlink.dtd
<!ELEMENT seedlink (capability*, station*)>
<!ATTLIST seedlink
software CDATA #REQUIRED
organization CDATA #REQUIRED
started CDATA #REQUIRED>
<!ELEMENT capability EMPTY>
<!ATTLIST capability
name CDATA #REQUIRED>
<!ELEMENT station (stream*, connection*)>
<!ATTLIST station
name CDATA #REQUIRED
network CDATA #REQUIRED
description CDATA #REQUIRED
begin_seq CDATA #REQUIRED
end_seq CDATA #REQUIRED
stream_check (enabled | disabled) #REQUIRED>
<!ELEMENT stream (gap*)>
<!ATTLIST stream
location CDATA #REQUIRED
seedname CDATA #REQUIRED
type CDATA #REQUIRED
begin_time CDATA #REQUIRED
end_time CDATA #REQUIRED
begin_recno CDATA #REQUIRED
end_recno CDATA #REQUIRED
gap_check (enabled | disabled) #REQUIRED
gap_treshold CDATA #REQUIRED>
<!ELEMENT gap EMPTY>
<!ATTLIST gap
begin_time CDATA #REQUIRED
end_time CDATA #REQUIRED>
<!ELEMENT connection (window?, selector*)>
<!ATTLIST connection
host CDATA #REQUIRED
port CDATA #REQUIRED
ctime CDATA #REQUIRED
begin_seq CDATA #REQUIRED
current_seq CDATA #REQUIRED
sequence_gaps CDATA #REQUIRED
txcount CDATA #REQUIRED
begin_seq_valid (yes | no) #REQUIRED
realtime (yes | no) #REQUIRED
end_of_data (yes | no) #REQUIRED>
<!ELEMENT window EMPTY>
<!ATTLIST window
begin_time CDATA #REQUIRED
end_time CDATA #REQUIRED>
<!ELEMENT selector EMPTY>
<!ATTLIST selector
pattern CDATA #REQUIRED>
B.3 chain.dtd
<!ELEMENT chain (extension*, group+)>
<!ATTLIST chain
34
verbosity CDATA #IMPLIED
timetable_loader CDATA #IMPLIED
overlap_removal (none | initial | full) #IMPLIED
multistation (yes | no) #IMPLIED
netto CDATA #IMPLIED
netdly CDATA #IMPLIED
keepalive CDATA #IMPLIED
standby CDATA #IMPLIED
seqsave CDATA #IMPLIED>
<!ELEMENT extension EMPTY>
<!ATTLIST extension
name CDATA #REQUIRED
cmd CDATA #REQUIRED
filter CDATA #IMPLIED
recv_timeout CDATA #IMPLIED
send_timeout CDATA #IMPLIED
start_retry CDATA #IMPLIED
shutdown_wait CDATA #IMPLIED>
<!ELEMENT group (station+)>
<!ATTLIST group
address CDATA #REQUIRED
overlap_removal (none | initial | full) #IMPLIED
multistation CDATA #IMPLIED
netto CDATA #IMPLIED
netdly CDATA #IMPLIED
keepalive CDATA #IMPLIED
uptime CDATA #IMPLIED
standby CDATA #IMPLIED
seqsave CDATA #IMPLIED
seqfile CDATA #IMPLIED
ifup CDATA #IMPLIED
ifdown CDATA #IMPLIED
schedule CDATA #IMPLIED
lockfile CDATA #IMPLIED>
<!ELEMENT station (rename*, trigger*, unpack*)>
<!ATTLIST station
id CDATA #IMPLIED
name CDATA #REQUIRED
network CDATA #REQUIRED
out_name CDATA #IMPLIED
out_network CDATA #IMPLIED
selectors CDATA #IMPLIED
overlap_removal (none | initial | full) #IMPLIED
default_timing_quality CDATA #IMPLIED>
<!ELEMENT rename EMPTY>
<!ATTLIST rename
from CDATA #REQUIRED
to CDATA #REQUIRED>
<!ELEMENT trigger EMPTY>
<!ATTLIST trigger
src CDATA #REQUIRED
buffer_length CDATA #IMPLIED
pre_seconds CDATA #IMPLIED
post_seconds CDATA #IMPLIED>
<!ELEMENT unpack EMPTY>
<!ATTLIST unpack
src CDATA #REQUIRED
dest CDATA #REQUIRED
double_rate (yes | no) #IMPLIED>
35