source: EEW/trunk/mcast2eew/EEW.h @ 3716

Revision 3716, 1.9 KB checked in by solanki, 5 years ago (diff)

Merged MiniSEED and uncompressed packet processing.
Multiprocess Model.
UDP Communication.

Line 
1#ifndef __EEW_h
2#define __EEW_h
3
4#include <sys/time.h>
5#include "GCBRTSPModule.h"
6#include "PPickerTSPModule.h"
7#include "ButhpinFilterTSPModule.h"
8#include "Channel.h"
9#include "DataTypes.h"
10#include <queue>
11#include <map>
12
13using namespace std;
14
15const int MAXQ = 10000;
16const double PI = 3.1415926;
17
18typedef map<TimeStamp,float> GCBRMap;
19typedef deque< pair<TimeStamp,float> > GCBRQueue;
20typedef deque< pair<TimeStamp,struct vd> > VDQueue;
21
22class EEW{
23 private:
24  Channel chanZ,chanE,chanN;
25  int samplerate;
26  static unsigned int serverip;
27  static bool udpsetup;
28
29  GCBRTSPModule *gcbrZ;
30  GCBRTSPModule *gcbrN;
31  GCBRTSPModule *gcbrE;
32
33  PPickerTSPModule *picker;
34  ButhpinFilterTSPModule *buthfilter;
35
36  float* buf;
37  float* pickbuf;
38  struct vd* vdbuf;
39  GCBRQueue zq,eq,nq;
40  GCBRMap   zmap,emap,nmap;
41  VDQueue   vdq;
42  bool trigger;
43  TimeStamp trigtime;
44  TimeStamp lasttimeE,lasttimeN,lasttimeZ;
45  bool firsttimeE,firsttimeN,firsttimeZ;
46
47
48  //TauC/PD Calculation Vars
49  TimeStamp clipbegin;
50  double TC;
51  double Pd3;
52  double Q,mag,pgv;
53  int clipped;
54
55  void maintainGCBRData(GCBRQueue&,GCBRMap&,timeval stime,int size);
56  void maintainVDQueue(VDQueue&,timeval stime,int size);
57  void calcTCPD();
58  double calTauC(struct vd* data,unsigned int size);
59  double calPd3(struct vd* data,unsigned int size);
60  bool isClipping(struct vd* data, unsigned int size);
61  int tauc_pd_trigger(double tau_c,double pd);
62
63  void generateRandomTrigger(TimeStamp stime);//for testing
64  void checkgap(TimeStamp firstsamptime,TimeStamp& lastsamptime,int nsamps,bool& firsttime);
65  void reset();
66  float findSample(GCBRQueue& q,TimeStamp timestamp);
67  void sendToServer();
68  const char* gethostnametoip(const char* hostname);
69 public:
70
71  EEW(Channel Z,Channel E,Channel N);
72  void init();
73  void process(Channel ch,timeval stime,int*,int size);
74  void clear();
75  void setTriggerOn(TimeStamp timestamp);
76};
77
78#endif
79
Note: See TracBrowser for help on using the repository browser.