Professional Documents
Culture Documents
2
Outline
• Prepare a Linux environment.
3
Before get into Earthworm…
• Run a Linux operating system.
4
Of Earthworm Platform…
• Developed by USGS since 1993.
• And the newest version is 7.10 (7.11 under alpha).
• An universal seismic processing system.
• Design goal:
• Modularity
• System independence
• Scalability
• Connectivity
• Robustness
5
6
Architecture
Internal Earthworm Architecture
pick hypo
palert2ew
other
WAVE_RING archive
acquisition
modules
other processing
modules
7
Architecture
8
Configuration
• Copy the four files inside env directory to
params directory:
• earthworm.d
• earthworm_global.d
• earthworm_commonvars.d
• ew_linux.bash
• Purge some settings inside earthworm.d.
• Modify the real path in the ew_linux.bash.
9
Compilation
• Source for ew_linux.bash
• Go to the /ew/earthworm_7.10/src
• Type “make clean_unix”
• Type “make unix”
• If there is not any ERROR, you get your own
Earthworm Platform!
10
Of startstop…
• The main entry of Earthworm Platform.
• Type “startstop”
11
Some modules & files…
• tankplayer
• sniffwave
• import/export
• slink2ew
• template
• trace_buf.h
12
Further testing…
• Put those tank files into you system.
• Add the tankplayer to earthworm.d
• Configure the tankplayer.d
• Configure the startstop.d
• Type “startstop”
• Open a new terminal, type “sniffwave
WAVE_RING”
• Now, you can see the trace inside the ring.
13
Let’s write a module!
14
Start from template…
• Main process
• Initialization
• Ring Attaching
• Processing loop
• Configuration reading func.
• Error & heartbeat message sending func.
• Environment reading func.
15
A simple module
• Read configuration that is inside .d file for
fetching specific SCNL.
16
Read the configuration…
• Call the function (template_config).
• Open the .d file.
• Search the keywords.
• Fetch the contents following.
• Save into the variables.
17
Fetch message from Ring.
• Loop for tport_getmsg.
• Get it!
18
Of the trace buffer ver. 2.0
• typedef struct {
• int pinno; /* Pin number */
• int nsamp; /* Number of samples in packet */
• double starttime; /* time of first sample in epoch seconds (seconds since midnight
1/1/1970) */
• double endtime; /* Time of last sample in epoch seconds */
• double samprate; /* Sample rate; nominal */
• char sta[TRACE2_STA_LEN]; /* Site name (NULL-terminated) */
• char net[TRACE2_NET_LEN]; /* Network name (NULL-terminated) */
• char chan[TRACE2_CHAN_LEN]; /* Component/channel code (NULL-terminated)*/
• char loc[TRACE2_LOC_LEN]; /* Location code (NULL-terminated) */
• char version[2]; /* version field */
• char datatype[3]; /* Data format code (NULL-terminated) */
• char quality[2]; /* Data-quality field */
• char pad[2]; /* padding */
• } TRACE2_HEADER;
19
Real Process for trace
• The detailed format of trace buffer.
• Read the data in count with pointer.
• Pick the peak value.
• Show it along with other information on the
terminal.
20
Compile it!
• Using Make
• Set the module name
• Set what kind of library you need here
• Set where to output the execute file
• Configure the startstop.d
• Type “startstop”
• Check the result.
21
After works…
• Log procedure
• Threading
• Networking
• Coding guidance
22
Q&A
23