| 1 | #ifndef __NETWORK_H_INCLUDED__ |
|---|
| 2 | #define __NETWORK_H_INCLUDED__ |
|---|
| 3 | |
|---|
| 4 | #include <stdlib.h> |
|---|
| 5 | #include <math.h> |
|---|
| 6 | #include <vector> |
|---|
| 7 | |
|---|
| 8 | using namespace std; |
|---|
| 9 | |
|---|
| 10 | /*** CONSTANTS ***/ |
|---|
| 11 | const int Fixed_Byte_To_Checksum = 25; // the first byte is not considered in the calculation of "BYTE 2" |
|---|
| 12 | const int CONTROL_DATA_LEN = 27; |
|---|
| 13 | char * const dp5[8] = { "ML_1", "ML_2", "ML_3", "ML_4", "ML_5", |
|---|
| 14 | "ML_6", "HOV_Lane", "FYW_Conn"}; |
|---|
| 15 | char * const dp6[8] = { "OS_1", "OS_2", "OS_3", "OS_4", "OS_5", |
|---|
| 16 | "OS_6", "COLL_DIST_2", "COLL_DIST_OFF"}; |
|---|
| 17 | char * const dp7[8] = { "DEMAND", "PASSAGE", "QUEUE", "RAMP_ON", |
|---|
| 18 | "RAMP_OFF", "RAMP_HOV", "COLL_DIST_1", "COLL_DIST_ON"}; |
|---|
| 19 | char * const dp8[8] = { "SD_1", "SD_2", "SD_3", "SD_4", "SD_5", |
|---|
| 20 | "SD_6", "Pass_Vol_Count", "X"}; |
|---|
| 21 | |
|---|
| 22 | /*** NETWORK STRUCTS ***/ |
|---|
| 23 | typedef struct loopagg LOOPAGG; |
|---|
| 24 | struct loopagg |
|---|
| 25 | { |
|---|
| 26 | int index; |
|---|
| 27 | char lane; // how namy lanes at the detector station |
|---|
| 28 | long time; |
|---|
| 29 | int interval; |
|---|
| 30 | int g_vol; |
|---|
| 31 | float g_occ; |
|---|
| 32 | double g_spd; |
|---|
| 33 | int *vol; |
|---|
| 34 | float *occ; |
|---|
| 35 | double *spd; |
|---|
| 36 | }; |
|---|
| 37 | |
|---|
| 38 | // FEP line: has several lds |
|---|
| 39 | typedef struct fep_line FEP_LINE; |
|---|
| 40 | struct fep_line |
|---|
| 41 | { |
|---|
| 42 | int lineNum; |
|---|
| 43 | vector<long> lds; |
|---|
| 44 | vector<long> ldsIndex; // location in ldsMap |
|---|
| 45 | short ldsNum; // actual number of lds on the line |
|---|
| 46 | |
|---|
| 47 | short count; // actual count from caltrans |
|---|
| 48 | int schedule; |
|---|
| 49 | int lineInfo; |
|---|
| 50 | long systemKey; |
|---|
| 51 | long globalSeq; |
|---|
| 52 | long schedleSeq; |
|---|
| 53 | }; |
|---|
| 54 | |
|---|
| 55 | // Loop detector station: has several loops |
|---|
| 56 | typedef struct Lds_loop LDS_LOOP; |
|---|
| 57 | struct Lds_loop |
|---|
| 58 | { |
|---|
| 59 | // Each lds has its own line_num and drop (Caltrans use) |
|---|
| 60 | long lds; |
|---|
| 61 | short line_num; |
|---|
| 62 | short drop; |
|---|
| 63 | |
|---|
| 64 | int num; // number of loops |
|---|
| 65 | long *loopID; |
|---|
| 66 | char **loop_loc; |
|---|
| 67 | |
|---|
| 68 | // LDS data |
|---|
| 69 | unsigned char *dataPack; |
|---|
| 70 | int length; // total length of data (max: 87) |
|---|
| 71 | int pos; // pointer for data preparation |
|---|
| 72 | int MlTotVol; // each 30 sec, the following will be updated |
|---|
| 73 | int OppTotVol; // each 30 sec, the following will be updated |
|---|
| 74 | }; |
|---|
| 75 | |
|---|
| 76 | #endif |
|---|