Main Page Class Hierarchy Compound List File List Compound Members File Members

# rw_strongmotion.h

Go to the documentation of this file.

    00001
    00002 /*
    00003  *   THIS FILE IS UNDER RCS - DO NOT MODIFY UNLESS YOU HAVE
    00004  *   CHECKED IT OUT USING THE COMMAND CHECKOUT.
    00005  *
    00006  *    $Id: rw__strongmotion_8h-source.html 2161 2006-05-19 16:55:03Z paulf $
    00007  *
    00008  *    Revision history:
    00009  *     $Log$
    00009  *     Revision 1.1  2006/05/19 16:55:02  paulf
    00009  *     first inclusion
    00009  *
    00010  *     Revision 1.3  2001/02/06 18:31:40  dietz
    00011  *     added definition of GRAVITY_CGS
    00012  *
    00013  *     Revision 1.2  2000/11/03 18:16:01  dietz
    00014  *     Changed SM_MAX_CHAN from 6 to 18 (to accommodate K2 data)
    00015  *
    00016  *     Revision 1.1  2000/02/14 20:05:54  lucky
    00017  *     Initial revision
    00018  *
    00019  *
    00020  */
    00021
    00022 /* rw_strongmotion.h
    00023  *
    00024  * Header file for the functions in rw_strongmotion.c that
    00025  * convert from a TYPE_STRONGMOTION message to a structure
    00026  * and visa versa.
    00027  *
    00028  * Each TYPE_STRONGMOTION message is intended to contain information
    00029  * from all the channels of one physical field unit.
    00030  * Timestamps are in seconds since 1970/01/01 00:00:00.00 UTC.
    00031  * Data are in units of cgs.
    00032  *
    00033  * written by Lynn Dietz   October, 1999
    00034  */
    00035
    00036 #ifndef RW_STRONGMOTION_H
    00037 #define RW_STRONGMOTION_H
    00038
    00039 /* Usefult constants
    00040  *******************/
    00041 #define GRAVITY_CGS 978.03    /* Gravity in cm/sec/sec */
    00042
    00043 /* Define maximum lengths for strings/arrays
    00044    in and Earthworm TYPE_STRONGMOTION message
    00045  ********************************************/
    00046 #define SM_VENDOR_LEN 49
    00047 #define SM_STA_LEN     6
    00048 #define SM_COMP_LEN    8
    00049 #define SM_NET_LEN     8
    00050 #define SM_LOC_LEN     5
    00051 #define SM_MAX_CHAN   18         /* max # channels in a TYPE_SM message       */
    00052 #define SM_MAX_RSA    25         /* max # spectral values for a given channel */
    00053 #define SM_NULL       -1         /* null value for freq & RSA                 */
    00054
    00055 /* Sources for the alternate time in the SM_DATA structure
    00056  *********************************************************/
    00057 #define SM_ALTCODE_NONE                0
    00058 #define SM_ALTCODE_RECEIVING_MODULE    1
    00059 #define SM_ALTCODE_DATABASE            2
    00060 #define SM_ALTCODE_AUTOMATED_REVIEWER  3
    00061 #define SM_ALTCODE_HUMAN_REVIEWER      4
    00062
    00063 /* Structure to contain strongmotion data from one channel
    00064    In the comments below, NTS = Null Terminated String
    00065  *********************************************************/
    00066 typedef struct _SM_CHAN {
    00067    char    sta[SM_STA_LEN+1];    /* NTS: Site code as per IRIS SEED                */
    00068    char    comp[SM_COMP_LEN+1];  /* NTS: Component code as per IRIS SEED           */
    00069    char    net[SM_NET_LEN+1];    /* NTS: Network code as per IRIS SEED             */
    00070    char    loc[SM_LOC_LEN+1];    /* NTS: Location code as per IRIS SEED            */
    00071    double  acc;                  /* peak acceleration (cm/sec/sec)                 */
    00072    double  vel;                  /* peak velocity (cm/sec)                         */
    00073    double  disp;                 /* peak displacement (cm)                         */
    00074    int     nRSA;                 /* # pts describing response spectrum accel (RSA) */
    00075    double  freq[SM_MAX_RSA];     /* frequencies at which RSA values are given      */
    00076    double  RSA[SM_MAX_RSA];      /* RSA value for this channel at given frequency  */
    00077 } SM_CHAN;
    00078
    00079 /* Structure to contain all strongmotion data from one instrument
    00080    In the comments below, NTS = Null Terminated String,
    00081    OPTIONAL marks a field that need not be entered for data to
    00082    be considered valid (these fields may be filled in later in DBMS).
    00083  ********************************************************************/
    00084 typedef struct _SM_DATA {
    00085    char    vendor[SM_VENDOR_LEN+1]; /* NTS: Name of company producing this device */
    00086    char    sn[SM_VENDOR_LEN+1];     /* NTS: identifying (serial?) number of box   */
    00087    double  tfield;                  /* field time, reported by SM box (seconds    */
    00088                                     /*   since 1970/01/01 00:00:00.00)            */
    00089    double  talt;                    /* OPTIONAL: alternate time, reported by      */
    00090                                     /*   nobody, acq. software, analyst, etc.     */
    00091    int     altcode;                 /* OPTIONAL: code specifying the source of    */
    00092                                     /*   the alternate time field                 */
    00093    double  tload;                   /* OPTIONAL: time data was loaded into DBMS   */
    00094    int     nch;                     /* # channels contained in this structure     */
    00095    SM_CHAN ch[SM_MAX_CHAN];         /* actual data for each channel in this box   */
    00096 } SM_DATA;
    00097
    00098 /* Function Prototypes
    00099  *********************/
    00100 int  rd_strongmotion( char *msg, int msglen, SM_DATA *sm );
    00101 int  wr_strongmotion( SM_DATA *sm, char *buf, int buflen );
    00102 void log_strongmotion( SM_DATA *sm );
    00103
    00104 #endif