# sr2ew Configuration File Commands

(last revised 15 July, 2018)
Page Index:
1. Functional command listing
2. Alphabetic command listing & description
3. Sample Configuration File

On startup, sr2ew reads the configuration file named on the command line. Commands in this file set all the parameters used for configuring the Earthworm sr2ew module. In the control file, lines may begin with a valid sr2ew command (listed below) or with one of 2 special characters:

>     #  marks the line as a comment (example: # This is a comment).

>     @  allows control files to be nested; one control file can be
>        accessed from another with the command "@" followed by
>        a string representing the path name of the next control file
>        (example: @model.d).

Command names must be typed in the control file exactly as shown in this document (upper/lower case matters!). Blank lines are also permitted in the control file.

## 1. FUNCTIONAL COMMAND LISTING

Below are the commands recognized by sr2ew, grouped by the function they influence. Some of the commands are required, as noted. They may be specified in any order in the control file.

       Earthworm system setup:
                    ModuleId                required
                    RingName                required
                    HeartbeatInt             required
                    OutputMsgType           optional
                    LogSwitch               required
                    Verbosity               optional

       Channel SCNL parameters:
                    ChannelX           required

       Summary logging parameters:
                    SummaryInterval         optional

## 2. ALPHABETIC COMMAND LISTING & DESCRIPTION

In the following section, all configuration file commands are listed in alphabetical order. Listed along with the command (bold-type) are its arguments (in red), the name of the subroutine that processes the command, and the function within the module that the command influences. A detailed description of the command and is also given. Default values and example commands are listed after each command description.

    command arg1                                       function

    ChannelX n sta comp net loc            Channel Configuration

> There should be one ChannelX command for each USBxCH channel, including special channels like the digital and GPS PPS channels. The X should be replaced with the appropriate channel number from 0 to 15. This information is used to provide the full station, component, network and location names (SCNL) number as headers for the earthworm trace buffer messages. X indicates the USBxCH channel number while sta comp net loc give the earthworm SCNL values.

>     Default:  The channels have station SRHQ with component xxx, net SR and
>               location CH where H indicates the hex digit of the channel
>               number.  For example Channel0 has location C0 while channel
>               15 has location CF. The pin number is set equal to the
>               decimal USBxCH channel number.  The SCNL info must be in
>               quotes so it can be processed as a single token.
>     Example:  Channel0   "SRHQ HNZ SR C0"
>               Channel10  "SRHQ DIG SR CA"

    HeartbeatInt nsec                          Earthworm Setup

> Defines the number of seconds, nsec, between TYPE_HEARTBEAT messages issued by sr2ew.

>     Default:  none
>     Example:  HeartbeatInt 60

    LogSwitch n                                       Earthworm Setup

> Controls where logging info is sent. If n is 0, no log file will be written. If n is 1, logging will go to daily log file(s) in the EW_LOG directory (environment variable) called nnnnn_yyyymmdd.log where nnnnn is the name of the configuration file (with the suffix '.d' removed) and yyyymmdd is the current UTC date (ex: 20040123) on the system clock. If n is 2, logging will go to the SrRpt-sr2ew.rpt file in the YMDHMS directory below the EW_DATA directory. And if n is 3, logging info will be written to both the EW and SR logs.

>     Default:  none
>     Example:  LogSwitch 3

    ModuleId mod_id                                 Earthworm setup

> Sets the module id for labeling all outgoing trigger, heartbeat, and error messages. mod_id is a character string (valid strings are listed in earthworm.d) that relates to a unique single-byte number. In general, a different module ID is needed for each instance of sr2ew.

>     Default:  none
>     Example:  MyModuleId MOD_SRUSB2EW

    OutputMsgType trace_format                      Earthworm setup

> Tells sr2ew whether to send waveform messages in the the old or new style tracebuf format. trace_format is a case sensitive character string and must be either TYPE_TRACEBUF or TYPE_TRACEBUF2. For Earthworm v7.0 and later, TYPE_TRACEBUF2 is the default.

>     Default:  TYPE_TRACEBUF2 (for v7.0 and greater, TYPE_TRACEBUF otherwise)
>     Example:  OutputMsgType TYPE_TRACEBUF2

    RingName ring                                   Earthworm setup

> Tells sr2ew which shared memory region to use for output. ring is a character string (valid strings are listed in earthworm.d) that relates to a unique number for the key to the shared memory region.

>     Default:  none
>     Example:  RingName WAVE_RING

    SummaryInterval nsec                            Summary Logging

> A summary of the analog, GPS PPS, and GPS serial info read is written to the log file every nsec seconds if the log file is turned on (LogFile 1) and a medium log output level is selected (Debug >= 1). Set nsec to 0 if no summary lines are desired.

>     Default:  0
>     Example:  SummaryInterval 1200

    Verbosity n                                         Earthworm setup

> Sets the log output level for sr2ew. Errors and warnings are always logged. Level 0 adds startup info. Level 1 adds more config details. Level 2 adds trace data message info every second. Level 3 adds function calls. Level 4 adds heartbeat calls and info on every data point. Levels 3 and 4 are mostly for code debugging.

>     Default:  0
>     Example:  Verbosity 1

##
3. Sample Configuration File

    # FILE: sr2ew.d                   Copyright (c), Symmetric Research, 2018
    #
    # This is a sample sr2ew parameter file for acquiring data with a Symmetric
    # Research USBxCH 24 bit A/D board and putting that data onto an Earthworm
    # ring.
    #

    #------------------------------------------------------------------------
    #
    # PARAMETER VALUES
    #
    #------------------------------------------------------------------------

    #
    # Simple parameters:
    #

    MyModuleId      MOD_SRUSB2EW     # module id for this instance of sr2ew
    RingName        WAVE_RING        # send acquired data to this shared EW memory ring
    HeartBeatInt    60               # seconds between heartbeats
    OutputMsgType   TYPE_TRACEBUF2   # use Station/Channel/Network/Location (SCNL)
    LogSwitch       3                # logging ( 0=NONE, 1=EW, 2=SR, 3=BOTH )
    Verbosity       0                # amount of debug info sent to log file, 0-4
    SummaryInterval 600              # seconds between summary info in log file

    #
    # Acquired data identification parameters:
    #

    #   A/D          4     3     2    2
    # Channel       Sta   Comp  Net  Loc
    # -------       ---   ----  ---  ---
    Channel0       "SRHQ  HNZ   SR   C0"
    Channel1       "SRHQ  HNZ   SR   C1"
    Channel2       "SRHQ  HNZ   SR   C2"
    Channel3       "SRHQ  HNZ   SR   C3"
    Channel4       "SRHQ  HNZ   SR   C4"
    Channel5       "SRHQ  HNZ   SR   C5"
    Channel6       "SRHQ  HNZ   SR   C6"
    Channel7       "SRHQ  HNZ   SR   C7"
    Channel8       "SRHQ  DIG   SR   C8"
    Channel9       "SRHQ  DIG   SR   C9"
    Channel10      "SRHQ  DIG   SR   CA"
    Channel11      "SRHQ  DIG   SR   CB"
    Channel12      "SRHQ  GPS   SR   CC"
    Channel13      "SRHQ  PWR   SR   CD"
    Channel14      "SRHQ  DEG   SR   CE"
    Channel15      "SRHQ  NUM   SR   CF"

    # NOTE: Special channels are GPS pulse per second, Power good flag,
    #       Temperature in Degrees, Number of satellites

Module Index | sr2ew Overview