Changeset 4203


Ignore:
Timestamp:
05/05/11 12:56:45 (10 years ago)
Author:
scott
Message:

Added activate_module & its message type; modified ewspectra to use it

Location:
trunk
Files:
2 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/ewdoc/WEB_DOC/cmd/ewspectra_cmd.html

    r4194 r4203  
    2828 
    2929# Produce spectra from a specific SCNL 
     30# If writing to a ring, second SCNL is needed to be used in messages written 
    3031PlainSpectraSCNL 5405 HNN NP GE 
    3132#PlainSpectraSCNL 5405 HNE NP GN 
  • trunk/ewdoc/WEB_DOC/modules.html

    r4198 r4203  
    343343    </tr> 
    344344    <tr> 
    345       <td align="center">compute_spectra </td> 
    346       <td>Posts a message for <a href="ovr/ewspectra_ovr.html">ewspectra</a> to begin processing</td> 
    347       <td style="text-align: center;"> <a href="ovr/compute_spectra_ovr.html">overview/setup</a></td> 
    348     </tr> 
    349     <tr> 
    350345      <td align="center">eqproc </td> 
    351346      <td>Initiates final event processing (head of mega-module).</td> 
     
    404399      </td> 
    405400      <td align="center"><a href="cmd/eqverify_assemble_cmd.html">commands</a> </td> 
    406     </tr> 
    407     <tr> 
    408       <td align="center">ewspectra </td> 
    409       <td>Takes data from one or more waveservers, computes and processes their spectra </td> 
    410       <td style="text-align: center;"><a href="ovr/ewspectra_ovr.html">overview</a> 
    411       </td> 
    412       <td align="center"><a href="cmd/ewspectra_cmd.html">commands</a> </td> 
    413     </tr> 
    414     <tr> 
    415       <td align="center">ewthresh </td> 
    416       <td>Monitors a ring for TRACEBUF2X messages and generates an alarm message when a  
    417 SCNL-specific threshold is exceeded.</td> 
    418       <td style="text-align: center;"><a href="ovr/ewthresh_ovr.html">overview</a> 
    419       </td> 
    420       <td align="center"><a href="cmd/ewthresh_cmd.html">commands</a> </td> 
    421401    </tr> 
    422402    <tr> 
     
    595575 href="cmd/ewintegrate_cmd.html">commands</a><br> 
    596576      </td> 
     577    </tr> 
     578    <tr> 
     579      <td align="center">ewspectra </td> 
     580      <td>Takes data from one or more waveservers, computes and processes their spectra </td> 
     581      <td style="text-align: center;"><a href="ovr/ewspectra_ovr.html">overview</a> 
     582      </td> 
     583      <td align="center"><a href="cmd/ewspectra_cmd.html">commands</a> </td> 
     584    </tr> 
     585    <tr> 
     586      <td align="center">compute_spectra </td> 
     587      <td>Posts a message for <a href="ovr/ewspectra_ovr.html">ewspectra</a> to begin processing.  
     588      (Deprecated 5/5/2011; use <a href="ovr/activate_module_ovr.html">activate_module</a> instead.)</td> 
     589      <td style="text-align: center;"> <a href="ovr/compute_spectra_ovr.html">overview</a></td> 
     590      <td align="center">none </td> 
     591    </tr> 
     592    <tr> 
     593      <td align="center">ewthresh </td> 
     594      <td>Monitors a ring for TRACEBUF2X messages and generates an alarm message when a  
     595SCNL-specific threshold is exceeded.</td> 
     596      <td style="text-align: center;"><a href="ovr/ewthresh_ovr.html">overview</a> 
     597      </td> 
     598      <td align="center"><a href="cmd/ewthresh_cmd.html">commands</a> </td> 
    597599    </tr> 
    598600  </tbody> 
     
    10761078prints information to screen or to a file</td> 
    10771079      <td style="text-align: center;"> <a href="ovr/sniffspectra_ovr.html">overview/setup</a></td> 
     1080      <td align="center">none </td> 
    10781081    </tr> 
    10791082    <tr> 
     
    11081111      <td align="center"> <a href="cmd/wsv_test_cmd.html">commands</a> 
    11091112      </td> 
     1113    </tr> 
     1114    <tr> 
     1115      <td align="center">activate_module </td> 
     1116      <td>Puts an ACTIVATE_MODULE message in the specified ring, the body of which  
     1117        starts with the module ID of the specified target module, followed by the  
     1118        remaining command-line arguments.</td> 
     1119      <td style="text-align: center;"> <a href="ovr/activate_module_ovr.html">overview</a></td> 
     1120      <td align="center">none </td> 
    11101121    </tr> 
    11111122  </tbody> 
  • trunk/ewdoc/WEB_DOC/ovr/compute_spectra_ovr.html

    r4194 r4203  
    66<BODY  bgcolor="#ffffff"> 
    77<CENTER><H1>Earthworm Module: <BR>Compute_spectra Overview</H1> 
    8 <I>(last revised 26 April, 2011)</I></CENTER> 
     8<I>(last revised 5 May, 2011)</I></CENTER> 
     9<P><B>Deprecated as on 5/5/2011; use <a href="activate_module_ovr.html">activate_module</a> instead,</B> 
     10using the same arguments as here but adding the module ID of your ewspectra module before the ring name. 
     11</P> 
    912<P> 
    1013The compute_spectra module write a message to the specified ring to signal 
  • trunk/params/earthworm_global.d

    r4194 r4203  
    267267 Message  TYPE_TD_AMP           34  # time-domain reduced-rate amplitude summary 
    268268                                    #   produced by CISN RAD software & ada2ring 
    269  Message  TYPE_COMPUTE_SPECTRA  50  # produced by compute_spectra & read by ewspectra 
     269# Message  TYPE_COMPUTE_SPECTRA  50  # produced by compute_spectra & read by ewspectra 
    270270                                    #   to initiate reading waveserver(s) to  
    271271                                    #   compute spectra 
     
    273273 Message  TYPE_SPECTRA_PEAKS    52  # peaks of spectra results produced by ewspectra 
    274274 Message  TYPE_THRESHALARM      53  # alarm message produced by ewthresh 
     275 Message  TYPE_ACTIVATE_MODULE  54  # general-purpose message to trigger a specified module 
    275276 
    276277 
  • trunk/release_notes.working

    r4202 r4203  
    5353compute_spectra 
    5454This module posts a message that, when read by ewspectra, begins processing data 
    55 starting at the specified date/time. 
     55starting at the specified date/time.  (Deprecated w/ the creation of 
     56activate_module) 
    5657Scott Hunter 04/26/2011 
    5758 
     
    6667when a SCNL-specific threshold is exceeded. 
    6768Scott Hunter 04/26/2011 
     69 
     70activate_module 
     71This module puts an ACTIVATE_MODULE message in the specified ring, the body of 
     72which starts with the module ID of the specified target module, followed by the 
     73remaining command-line arguments. 
     74Scott Hunter 05/05/2011 
    6875 
    6976MODIFICATIONS/BUG FIXES TO EXISTING MODULES: 
  • trunk/src/seismic_processing/ewspectra/ewspectra.c

    r4194 r4203  
    5858static  SHM_INFO  OutRegion;    /* shared memory region to use for output */ 
    5959 
    60 MSG_LOGO  GetLogo;                      /* requesting module,type,instid */ 
     60MSG_LOGO  GetLogo[1];                           /* requesting module,type,instid */ 
    6161pid_t MyPid;        /* Our own pid, sent with heartbeat for restart purposes */ 
    6262         
     
    853853   int       res; 
    854854   int       ret; 
    855    char      msg[100]; 
     855   char      date[100], *msgName; 
    856856   double    start, stop; 
     857   int modid, len, okMsg; 
    857858 
    858859   /* Tell the main thread we're ok 
     
    866867      /* Get a message from transport ring 
    867868      ************************************/ 
    868       res = tport_getmsg( &InRegion, &GetLogo, 1, 
     869      res = tport_getmsg( &InRegion, GetLogo, 1, 
    869870                          &reclogo, &recsize, MSrawmsg, MaxMsgSize-1 ); 
    870871 
     
    899900         } 
    900901      } 
     902       
     903      res = sscanf( MSrawmsg, "%d %s %d", &modid, date, &len ); 
     904      if ( modid != MyModId ) 
     905        continue; 
     906      msgName = "ACTIVATE_MODULE"; 
     907      okMsg = (res == 3); 
     908          if ( !okMsg ) { 
     909                        sprintf( errText, "malformed %s msg i%d m%d t%d in %s",msgName, 
     910                                        (int) reclogo.instid, 
     911                                        (int) reclogo.mod, (int)reclogo.type, inRing ); 
     912                        ewspectra_status( TypeError, ERR_BADMSG, errText ); 
     913                        continue; 
     914      } 
    901915 
    902916      /* Process retrieved msg (res==GET_OK,GET_MISS,GET_NOTRACK) 
    903917      ***********************************************************/ 
    904           strncpy( msg, MSrawmsg, recsize ); 
    905           msg[recsize] = 0; 
    906                 start = atof( msg ); 
    907                 if ( start < 0 ) {  
    908                         start += time(NULL); 
    909                 } else if ( EWSConvertTime (msg, &start) == EW_FAILURE ) { 
    910             sprintf( errText, "COMPUTE_SPECTRA message w/ bad time" ); 
    911             ewspectra_status( TypeError, ERR_BADMSG, errText ); 
    912                 } 
    913                 stop = start + atoi( msg+14 ); 
    914            
    915                 process_timespan( wsh, start, stop ); 
     918          start = atof( date ); 
     919          if ( start < 0 ) {  
     920                start += time(NULL); 
     921          } else if ( EWSConvertTime (date, &start) == EW_FAILURE ) { 
     922                sprintf( errText, "%s message w/ bad time (%s)", msgName, date ); 
     923                ewspectra_status( TypeError, ERR_BADMSG, errText ); 
     924          } 
     925          stop = start + len; 
     926   
     927          process_timespan( wsh, start, stop ); 
    916928 
    917929   } /* end of while */ 
     
    10291041        } 
    10301042        if ( find_triggers ) { 
    1031                 int geti = GetInst( "INST_WILDCARD", &(GetLogo.instid) ); 
    1032                 int getm = GetModId( "MOD_WILDCARD", &(GetLogo.mod) ); 
    1033                 int gett = GetType( "TYPE_COMPUTE_SPECTRA", &(GetLogo.type) ); 
     1043                int geti = GetInst( "INST_WILDCARD", &(GetLogo[0].instid) ); 
     1044                int getm = GetModId( "MOD_WILDCARD", &(GetLogo[0].mod) ); 
     1045                int gett = GetType( "TYPE_ACTIVATE_MODULE", &(GetLogo[0].type) ); 
    10341046                int getMsg = 0; 
    10351047                if ( ( MSrawmsg = (char *) malloc(MaxMsgSize) ) ==  NULL ) 
     
    10441056                        if ( getm ) 
    10451057                                logit( "e", "%s: MOD_WILDCARD unknown; exiting!\n", Argv0 ); 
    1046                         if ( geti ) 
    1047                                 logit( "e", "%s: TYPE_COMPUTE_SPECTRA unknown; exiting!\n", Argv0 ); 
     1058                        if ( gett ) 
     1059                                logit( "e", "%s: TYPE_ACTIVATE_MODULE unknown; exiting!\n", Argv0 ); 
    10481060                        ws2ts_purge( wsh, NULL, NULL ); 
    10491061                        exit(1); 
     
    10711083           do 
    10721084           { 
    1073                  res = tport_getmsg( &InRegion, &GetLogo, 1, 
     1085                 res = tport_getmsg( &InRegion, GetLogo, 1, 
    10741086                                                         &reclogo, &recsize, MSrawmsg, MaxMsgSize-1 ); 
    10751087           } while (res !=GET_NONE); 
  • trunk/src/seismic_processing/ewspectra/ewspectra.d

    r4194 r4203  
    1717 
    1818# Produce spectra from a specific SCNL 
     19# If writing to a ring, second SCNL is needed to be used in messages written 
    1920PlainSpectraSCNL 5405 HNN NP GE 
    2021#PlainSpectraSCNL 5405 HNE NP GN 
  • trunk/src/seismic_processing/ewspectra/makefile.nt

    r4195 r4203  
    99 
    1010APP = ewspectra 
    11 APPc = compute_spectra 
     11APPc = activate_module 
    1212APPs = sniffspectra 
    1313 
    1414OBJS = ewspectra.obj \ 
    1515       iir.obj 
    16 OBJSc = compute_spectra.obj 
     16OBJSc = activate_module.obj 
    1717OBJSs = sniffspectra.obj 
    1818 
  • trunk/src/seismic_processing/ewspectra/makefile.sol

    r4195 r4203  
    2323       iir.o 
    2424 
    25 OBJSc = compute_spectra.O 
     25OBJSc = activate_module.o 
    2626 
    2727OBJSs = sniffspectra.o 
     
    3131        $(CC) $(CFLAGS) -o $B/ewspectra $(OBJS) $(EW_LIBS) $(LIBS) 
    3232 
    33 compute_spectra: $(OBJS) $(EW_LIBS) 
    34         $(CC) $(CFLAGS) -o $B/compute_spectra $(OBJS) $(EW_LIBS) $(LIBS) 
     33activate_module: $(OBJS) $(EW_LIBS) 
     34        $(CC) $(CFLAGS) -o $B/activate_module $(OBJS) $(EW_LIBS) $(LIBS) 
    3535 
    3636sniffspectra: $(OBJS) $(EW_LIBS) 
     
    3838 
    3939lint: 
    40         lint ewspectra.c iir.c compute_spectra.c sniffspectra.c \ 
     40        lint ewspectra.c iir.c activate_module.c sniffspectra.c \ 
    4141                        $(GLOBALFLAGS) 
    4242 
     
    4646 
    4747clean_bin: 
    48         rm -f $B/ewspectra $B/compute_spectra $B/sniffspectra 
     48        rm -f $B/ewspectra $B/activate_module $B/sniffspectra 
    4949 
    5050 
  • trunk/src/seismic_processing/ewspectra/makefile.ux

    r4195 r4203  
    1010OBJS = $(SRCS:%.c=%.o) 
    1111 
    12 SRCSc = compute_spectra.c 
    13 OBJSc = $(SRCSc:%.c=%.o) 
     12SRCSa = activate_module.c 
     13OBJSa = $(SRCSa:%.c=%.o) 
    1414 
    1515SRCSs = sniffspectra.c 
     
    2525        $(CC) $(CFLAGS) -c $< -o $@ 
    2626 
    27 all: ewspectra compute_spectra sniffspectra 
     27all: ewspectra activate_module sniffspectra 
    2828 
    2929ewspectra: $(OBJS) 
     
    3131        cp ewspectra $(BINDIR) 
    3232 
    33 compute_spectra: $(OBJSc) 
    34         $(CC) $(GLOBALFLAGS) -o compute_spectra $(OBJSc) $(EW_LIBS) $(LDFLAGS) 
    35         cp compute_spectra $(BINDIR) 
     33activate_module: $(OBJSa) 
     34        $(CC) $(GLOBALFLAGS) -o activate_module $(OBJSa) $(EW_LIBS) $(LDFLAGS) 
     35        cp activate_module $(BINDIR) 
    3636 
    3737sniffspectra: $(OBJSs) 
     
    4141clean: 
    4242        rm *.o 
    43         rm ewspectra compute_spectra sniffspectra 
     43        rm ewspectra activate_module sniffspectra 
Note: See TracChangeset for help on using the changeset viewer.