Installing EarthWorm on Raspberry Pi

Original EarthWorm installation guide: http://love.isti.com/trac/ew/wiki/Linux#EarthwormInstallationProcedure:Linux

Sometimes you could find useful have a local seismic data acquisiton system (such EarthWorm).
Off course you could run it on desktop or notebook/netbook PC, but you could choose a low-cost and low-power Linux system such Raspberry Pi (or if you like DIY devices, Acqua A5 or Arietta G25 based boards).

 

First you have to install required software for compiling (on official guide it's reported you should also install g++-multilib packet, but this isn't available for Debian Wheezy):

 
pi@raspberrypi ~ $ sudo apt-get install g++
pi@raspberrypi ~ $ sudo apt-get install subversion

 

Then let's create folder for EarthWorm on your system (usually "ew" on home directory):

 
pi@raspberrypi ~ $ mkdir ew

 

EarthWorm also need further directories to correctly work:

 

Then let's create folder for EarthWorm on your system (usually "ew" on home directory):

 
pi@raspberrypi ~ $ cd ew
pi@raspberrypi ~/ew $ mkdir run
pi@raspberrypi ~/ew/run $ cd run
pi@raspberrypi ~/ew/run $ mkdir log
pi@raspberrypi ~/ew/run $ mkdir params
pi@raspberrypi ~/ew/run $ mkdir tanks

 

When created folders you could download EarthWorm source files:

 
pi@raspberrypi ~ $ cd ew
pi@raspberrypi ~/ew $ wget http://folkworm.ceri.memphis.edu/ew-dist/v7.7.1/earthworm_7.7.1-src.tar.gz
pi@raspberrypi ~/ew $ tar -xzvf earthworm_7.7.1-src.tar.gz

so you'll find earthworm_7.7 new folder.

 

Now you have to corretly set EarthWorm paths on file ew_linux.bash:

 
pi@raspberrypi ~ $ nano ew/earthworm_7.7/environment/ew_linux.bash
...

 

set paths as follows (or as you need) upon folders previously created:

...
export EW_HOME="${EW_INSTALL_HOME:-/home/pi/ew}"
export EW_VERSION="${EW_INSTALL_VERSION:-earthworm_7.7}"
EW_RUN_DIR="${EW_RUN_DIR:-$EW_HOME/run}"
...

 

on same file you have to correctly set compilation flags (on ARM architecture of Raspberry Pi or Aria/Acqua isn't provided selection between 32 or 64 bits):

...
# comment following line
#export GLOBALFLAGS="-m32 -Dlinux -D__i386 -D_LINUX -D_INTEL -D_USE_SCHED -D_USE_PTHREADS -D_USE_TERMIOS
-I${EW_HOME}/${EW_VERSION}/include"
 
# add following line
export GLOBALFLAGS="-fno-stack-protector -Dlinux -D__i386 -D_LINUX -D_INTEL -D_USE_SCHED -D_USE_PTHREADS -D_USE_TERMIOS
-I${EW_HOME}/${EW_VERSION}/include"
...

 

Edit your .bashrc file:

 
pi@raspberrypi ~ $ nano ~/.bashrc
...
 
 
# add following line to the bottom of file
source /home/pi/ew/earthworm_7.7/environment/ew_linux.bash

 

Then copy ew_linux.bash file and source:

 
pi@raspberrypi ~/ew $ cp earthworm_7.7/environment/ew_linux.bash run/params
pi@raspberrypi ~/ew $ cd run/params
pi@raspberrypi ~/ew $ source ew_linux.bash
pi@raspberrypi ~/ew $ source ~/.bashrc

 

Ok. now you could start compilation (it will take a while):

 
pi@raspberrypi ~/ew $ cd earthworm_7.7/src
pi@raspberrypi ~/ew/earthworm_7.7/src $ make unix
...

 

Once compilation finished you could copy desired EarthWorm modules to params folder, or simply copy all modules (you will enable desired modules later):

 
pi@raspberrypi ~/ew $ cd earthworm_7.7/params
pi@raspberrypi ~/ew/earthworm_7.7/params $ cp * ../../run/params/
...

then copy other system files:

 
pi@raspberrypi ~/ew $ cd earthworm_7.7/environment
pi@raspberrypi ~/ew/earthworm_7.7/environment $ cp earthworm.d ../../run/params/
pi@raspberrypi ~/ew/earthworm_7.7/environment $ cp earthworm_global.d ../../run/params/
pi@raspberrypi ~/ew/earthworm_7.7/environment $ cp earthworm_commonvars.d ../../run/params/

 

Now let's make basic configuration, let's suppose we will get data from following station through SeedLink server interface:

Station network: EI
Station code: AEGI
Channels: HHZ, HHN, HHE
SeedLink server: 192.168.100.22 port 18000

 

Edit wave_serverV.d file:

 
pi@raspberrypi ~/ew/run/params $ nano wave_serverV.d
...

basic configuration for wave_serverV.d

 
...
RingName WAVE_RING # name of transport ring to get data from
...
ServerIPAdr 127.0.0.1 # IP address of machine running wave_server (localhost)
...
 
TankStructFile /home/pi/ew/run/tanks/p1000-1.str
...
TankStructFile2 /home/pi/ew/run/tanks/p1000-2.str
...

pay attention of declaration of SCNL table (you need one line for every channel you want acquire):

 
#      SCNL            Record  Logo                      File Size    Index Size     File Name New
#      names 	         size   (TYPE_TRACEBUF2 only)     (megabytes)  (max breaks)   (full path) Tank
Tank   AEGI HHZ EI --  2048    INST_UNKNOWN MOD_WILDCARD  1            10000          /home/pi/ew/run/tanks/AEGI.hhz.tnk
Tank   AEGI HHN EI --  2048    INST_UNKNOWN MOD_WILDCARD  1            10000          /home/pi/ew/run/tanks/AEGI.hhn.tnk
Tank   AEGI HHE EI --  2048    INST_UNKNOWN MOD_WILDCARD  1            10000          /home/pi/ew/run/tanks/AEGI.hhe.tnk

 

Now let's edit statmgr.d file for configuration.
For every module we need to use, if available .desc file, have to be inserted in statmgr.d file.
...
RingName WAVE_RING
...
CheckAllRings 1
...
 
# list of basic modules
Descriptor statmgr.desc
Descriptor startstop.desc
Descriptor wave_serverV.desc

# list of other modules depending of application

Descriptor slink2ew_AEGI.desc

 

Let's configure startstop_unix.d:

...
nRing 3 # here you have to set number of ring buffers used (in this case only WAVE_RING)
# here you have to set ring buffers name and size
Ring WAVE_RING 1024
Ring PICK_RING 1024
Ring HYPO_RING 1024
...
# list of modules used
 
#
Process "copystatus WAVE_RING HYPO_RING"
Class/Priority OTHER 0
#
#
Process "copystatus PICK_RING HYPO_RING"
Class/Priority OTHER 0
#
#
Process "statmgr statmgr.d"
Class/Priority OTHER 0
#
#
Process "wave_serverV wave_serverV.d"
Class/Priority OTHER 0
#
#
Process "slink2ew slink2ew_AEGI.d"
Class/Priority OTHER 0
#

 

In these examples we are collecting data from station AEGI, running a SeedLink server, and so we've declared the module to collect data (slink2ew) on startstop_unix.d and statmgr.d.

If you use several modules of same type you have to use one module for each station; let's suppose you'll collect data from 2 stations through SeedLink server interface, so you'll need

 

For every module we need to use, if present .desc file for that module, we have to be insert it in statmgr.d file.
 
Descriptor slink2ew_AEGI.desc
Descriptor slink2ew_ARMI.desc

The same for startstop_unix.d:

...

#
Process "slink2ew slink2ew_AEGI.d"
Class/Priority OTHER 0
#
#
Process "slink2ew slnk2ew_ARMI.d"
Class/Priority OTHER 0
#

 

Take care there have to be UNIQUE module identifier in file earthworm.d for every module used: taking as example slink2ew module we can find generic module identifier in file earthworm.d

 

...

Module MOD_SLINK2EW 148
...
...so when using several modules of same type (in this case slink2ew) we need to add several module identifiers in file earthworm.d:

 

...

Module MOD_SLINK2EW_AEGI 154

Module MOD_SLINK2EW_ARMI 155
...
Obviously we also need to correct module ID inside files .d and .desc (if present).

 


# file slink2ew_AEGI.d

MyModuleId MOD_SLINK2EW_AEGI
...

# file slink2ew_AEGI.desc

modName slink2ew

modId MOD_SLINK2EW_AEGI
...

 

Now, all should be ready to start EarthWorm:

 

 
pi@raspberrypi ~/ew $ startstop
...

 

EarthWorm status should look like this, with all modules status "Alive" (in following screenshot there are more modules used, don't worry):


                    EARTHWORM SYSTEM STATUS

        Hostname-OS:            raspberrypi - Linux 3.12.28+
        Start time (UTC):       Mon Feb 23 11:28:39 2015
        Current time (UTC):     Mon Feb 23 11:51:28 2015
        Disk space avail:       85044 kb
        Ring  1 name/key/size:  WAVE_RING / 1000 / 1024 kb
        Ring  2 name/key/size:  PICK_RING / 1005 / 1024 kb
        Ring  3 name/key/size:  HYPO_RING / 1015 / 1024 kb
        Startstop's Log Dir:    /home/pi/ew/run/log/
        Startstop's Params Dir: /home/pi/ew/run/params/
        Startstop's Bin Dir:    /home/pi/ew/earthworm_7.7/bin
        Startstop Version:      v7.7 2012-08-13

         Process  Process           Class/    CPU
          Name      Id     Status  Priority   Used  Argument
         -------  -------  ------  --------   ----  --------
       startstop    3566   Alive      ??/ 0 00:00:00  -
         statmgr    3569   Alive      ??/ 0 00:00:02  statmgr.d
      copystatus    3570   Alive      ??/ 0 00:00:00  WAVE_RING HYPO_RING
    wave_serverV    3571   Alive      ??/ 0 00:00:03  wave_serverV.d
      copystatus    3572   Alive      ??/ 0 00:00:00  PICK_RING HYPO_RING
        k2ew_tty   26127   Alive      ??/ 0 00:00:00  k2ew_tty.d
      ringserver    3574   Alive      ??/ 0 00:00:02  <ew/run/params/ringserver>
   ew2ringserver    3575   Alive      ??/ 0 00:00:01  ew2ringserver.d
     carlstatrig    3576   Alive      ??/ 0 00:00:00  carlstatrig.d
     carlsubtrig    3581   Alive      ??/ 0 00:00:00  carlsubtrig.d
       trig2disk    3582   Alive      ??/ 0 00:00:00  trig2disk.d

 

If you want to verify data being collected you could use getmenu command to see what wave_server is receiving (you have to specify IP address of server and port):

 

pi@raspberrypi ~/ew $ getmenu 127.0.0.1:16022
GETMENU: nothing in server

In this case EarthWorm is not collecting data: you should read log files on log folder to understand what's wrong.

If correctly working:


 pi@raspberrypi ~/ew $ getmenu 127.0.0.1:16022

Tank contents for 127.0.0.1:16022
ws: 127.0.0.1:16022  pin: 1003   4381.HNZ.NI.--  Start: 20150223_1200_20.00  End: 20150223_1202_51.70
ws: 127.0.0.1:16022  pin: 1002   4381.HNY.NI.--  Start: 20150223_1200_20.00  End: 20150223_1202_51.70
ws: 127.0.0.1:16022  pin: 1001   4381.HNX.NI.--  Start: 20150223_1200_20.00  End: 20150223_1202_51.70
pi@raspberrypi ~/ew $ getmenu 127.0.0.1:16022

Tank contents for 127.0.0.1:16022
ws: 127.0.0.1:16022  pin: 1003   4381.HNZ.NI.--  Start: 20150223_1200_20.00  End: 20150223_1202_54.70
ws: 127.0.0.1:16022  pin: 1002   4381.HNY.NI.--  Start: 20150223_1200_20.00  End: 20150223_1202_54.70
ws: 127.0.0.1:16022  pin: 1001   4381.HNX.NI.--  Start: 20150223_1200_20.00  End: 20150223_1202_55.70
pi@raspberrypi ~/ew $

You can verify correct working if in two following requests the end time has increased.

 

 

 

 

 

Last update 19 Jan 2018.