    
    seismonitor v0.9.
    -----------------

    Copyright (C) 2002. Des Devlin (dtd@allshookup.org) and D.V.Rogers (dvr@allshookup.org)
    www.allshookup.org

    This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with this program; if not, write to the
    Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    This program is derived from other GPL software. The main program was adapted from skeleton C code kindly provided by 
    Curt Wuollet (cwuollet@ecenet.com) of Wide Open Technologies and the MAT LinuxPLC project (http.mat.sourceforge.net). 
    The program runs on top of the CIO-DIO48H driver written by Warren Jasper (wjasper@tx.ncsu.edu) at North Carolina State University. 

    
    PREAMBLE

    Seismonitor was written as part of a conceptual arts project using near-real-time seismic data to control a recommissioned 
    earthquake simulator. The original switch-relay system (Festo PLC) that drove the hydraulics and pneumatics of the machine 
    was replaced by a standard PC with a CIO-DIO48H digital I/O Isa board and a 48-channel solid-state relay rack. 
    The proprietary software that controlled the system stepped through a series of sequences within a closed environment. 
    This program was written to both move the system into an open (Linux) operating environment and introduce a near-real-time, 
    IP-based interactivity to the system.

    REQUIREMENTS

    Software

    Linux system with console display or Xterm
    Perl CPAN modules: libww-Perl, URI, MIME-Base64, HTML-Parser, libnet, Digest-MD5
    The CIO-DIO48H loadable linux module available from ftp://lx10.tx.ncsu.edu/pub/Linux/drivers. 
    (Full documentation is included in the driver package) Seismonitor uses version 1.1 for kernel versions 2.0.x-2.2.x. 
    
    Hardware
    
    A PC with an Isa bus
    A modem or network card if running in online mode
    CIO-DIO48H digital I/O board 
    48-channel solid state relay rack (optional)

    UNPACK AND BUILD

    tar zxvf seismonitor-0.9.tgz    
    cd seismonitor/
    make Makefile 

    QUICKSTART

    online.pl and the binary both print to stdout so are best evoked from separate consoles/xterms. 

    insmod dio48H

    ./online.pl [> /dev/tty1 2>&1 &] 

    ./seismonitor
    
    [./offline.pl]
    

    MANIFEST

    README - This file
    License- GNU General Public License 
    Makefile - A simple makefile to compile seismonitor
    main.c - The main source file
    fileio.c - File input-output source
    group_01.c - Run sequences source
    group_02.c - ""
    group_03.c - "" 
    group_04.c - State sequences 
    group_05.c - Run and misc sequences source
    group.h - Header file with defines, timings, I/O card mappings
    dio.h - Header file from CIO-DIO48H (copied or linked)
    seis.dat - Perl-generated data file
    online.pl - Perl script for use in online mode 
    offline.pl - Perl script for use in offline mode
    RESET.c - Return all outputs to 0 state
    /smio - Curt Wuollet's demo source

    DETAILS 

    seismonitor.
    The binary polls the data file 'seis.dat' for changes to the first, 6-digit (hhmmss) field. 
    If a change occurs, the second, 2-digit field - the magnitude value - is read in, multiplied by a factor of n 
    and passed to a set of usleep variables which controls the duration of the set, pause (usleep) and reset/clear 
    output signals to the I/O card.

    If no change occurs, the program continues in its default state, controlling two outputs which drive an air circuit.
    
    online.pl and offline.pl.
    These two scripts are the wrappers for seismonitor. The first polls a remote server for data.
    The second takes input from the perl prompt and was written primarily for testing but is currently used to shutdown the simulator.  

    online.pl
    This script assumes an Internet connection. It polls, retrieves and parses near-real-time data from the 
    Incorporated Research Institutions for Seismology (IRIS) Data Management Center (DMC) server at http://www.iris.washington.edu. 
    It first retrieves cgi output of all available recent seismic events and writes to a temporary file, '.seis.tmp'. 
    It then does a simple parse of the tmp file, extracting the most recent event time and magnitude which it writes to the 
    data file, seis.dat. The tmp file is deleted after processing. 

    offline.pl
    This script takes two options at the prompt: a lowercase 'q' to quit/shutdown seismonitor, and a single- or double-digit 
    number separated by a decimal point within a given range. This number represents a magnitude value.
    The script writes a single line of two fields to the data file, seis.dat. The first six-digit field must be unique 
    for seismonitor's file I/O logic to trigger an event sequence; the second is a two-digit value representing a magnitude, 
    taken from user input at the prompt. The magnitude value is multiplied by a factor of 10.  
    If 'q' is entered, the magnitude value is replaced with a value of -1, which triggers a shutdown sequence. 

    
    dtd@allshookup.org
    November 2001

