source: tmcsimulator/branches/FEPSimulator/network.h @ 219

Revision 219, 2.4 KB checked in by jtorres, 8 years ago (diff)

FEPSim.cpp: simplified line and station variable names in sendReplys() method

Line 
1#ifndef __NETWORK_H_INCLUDED__
2#define __NETWORK_H_INCLUDED__
3
4#include <stdlib.h>
5#include <math.h>
6#include <vector>
7
8using namespace std;
9
10/*** CONSTANTS ***/
11const int Fixed_Byte_To_Checksum = 25; // the first byte is not considered
12                                       //in the calculation of "BYTE 2"
13const int CONTROL_DATA_LEN = 27;
14
15// loop detector / lane type arrays
16char * const dp5[8] = { "ML_1", "ML_2", "ML_3", "ML_4", "ML_5",
17                                                "ML_6", "HOV_Lane", "FYW_Conn"};
18char * const dp6[8] = { "OS_1", "OS_2", "OS_3", "OS_4", "OS_5",
19                                                "OS_6", "COLL_DIST_2", "COLL_DIST_OFF"};
20char * const dp7[8] = { "DEMAND", "PASSAGE", "QUEUE", "RAMP_ON",
21                                                "RAMP_OFF", "RAMP_HOV", "COLL_DIST_1", "COLL_DIST_ON"};
22char * const dp8[8] = { "SD_1", "SD_2", "SD_3", "SD_4", "SD_5",
23                                                "SD_6", "Pass_Vol_Count", "X"};
24
25// FEP line: Represents a serial communication line from field stations to the
26// An FEP Line has several Loop Detector Stations (Stations) connected)
27typedef struct fep_line FEP_LINE;
28struct  fep_line
29{
30        int             lineNum;
31        vector<long>    lds;
32        vector<long>    ldsIndex;       // location in ldsMap
33
34        short   count;  // actual count from caltrans
35        int     schedule;
36        int     lineInfo;
37        long    systemKey;
38        long    globalSeq;
39        long    schedleSeq;
40};
41
42// Loop Detector: A single sensor that detects the volume, occupancy, and speed
43// in a single highway lane
44typedef struct loop LOOP;
45struct loop
46{
47    // meta data
48    long loopID;
49    char *loop_loc;
50   
51    // dynamic data
52    int vol;
53    float occ;
54    double spd;
55};
56
57// Loop detector station: A single field station that contains multiple loops at
58// a location
59typedef struct Station STATION;
60struct  Station
61{
62        // Each lds has its own line_num and drop (Caltrans use)
63        long    lds;
64        short   line_num;
65        short   drop;
66       
67        vector<LOOP*> loops;
68
69        // LDS data
70        unsigned char   *dataPack;
71        int             length;         // total length of data (max: 87)
72        int             pos;            // pointer for data preparation
73        int             MlTotVol;       // each 30 sec, the following will be updated
74        int             OppTotVol;      // each 30 sec, the following will be updated
75};
76
77// A helper structure used to pack the volume and occupancy at a loop into
78// a two byte message
79typedef struct volOcc VOLOCC;
80struct  volOcc
81{
82   char high;
83   char low;
84};
85
86#endif
Note: See TracBrowser for help on using the repository browser.