Changeset 199 in tmcsimulator for branches/FEPSimulator
- Timestamp:
- 10/30/2017 04:05:39 PM (9 years ago)
- File:
-
- 1 edited
-
branches/FEPSimulator/HighwaysParser.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/FEPSimulator/HighwaysParser.cpp
r195 r199 7 7 8 8 #include "HighwaysParser.h" 9 9 /* 43 // "number of lines" 10 * 32 0 13 // "line id" "count num" "number of stations" 11 * 1210831 1 5 S 0.9 8 // "station id" "drop num" "route num"... 12 * // ..."direction" "postmile" "number of loops" 13 * 1210832 0.0 0 // "loop id" "occ" "vol" 14 * 1210833 0.0 0 // .. 15 * 1210834 0.0 0 // .. 16 * 1210835 0.0 0 // .. 17 * 1210836 0.0 0 // .. 18 * 1210837 0.0 0 // .. 19 * 1210838 0.0 0 // .. 20 * 1210839 0.0 0 // .. 21 * */ 10 22 HighwaysParser::HighwaysParser(char * hwyData) { 11 23 string highwaysData = hwyData; … … 24 36 25 37 } 26 // FEP line: Represents a serial communication line from field stations to the 27 // An FEP Line has several Loop Detector Stations (Stations) connected) 28 typedef struct fep_line FEP_LINE; 29 struct fep_line 38 39 // Loop Detector: A single sensor that detects the volume, occupancy, and speed 40 // in a single highway lane 41 typedef struct loop LOOP; 42 struct loop 30 43 { 31 int lineNum; 32 vector<long> lds; 33 vector<long> ldsIndex; // location in ldsMap 34 35 short count; // actual count from caltrans 36 int schedule; 37 int lineInfo; 38 long systemKey; 39 long globalSeq; 40 long schedleSeq; 44 // meta data 45 long loopID; 46 char *loop_loc; 47 48 // dynamic data 49 int vol; 50 float occ; 51 double spd; 41 52 }; 42 53 void HighwaysParser::parseLines(istringstream highwaysData) … … 56 67 long globalSeq = 0; 57 68 long schedleSeq = 0; 69 short dropNum = 0; 70 int routeNum = 0; 71 char * direction = ""; 72 float postmile = 0; 73 long loopID = 0; 74 float occ = 0; 75 int vol = 0; 58 76 59 77 for(int lineIndex = 0; lineIndex < numLines; lineIndex++) 60 78 { 79 FEP_LINE * newLine = new FEP_LINE; 80 61 81 getline(highwaysData, currLine); 62 82 int numStations = 0; 63 83 sscanf(currLine, "%d %d %d", &lineNum, &count, &numStations); 84 85 newLine->lineNum = lineNum; 86 newLine->count = count; 87 newLine->schedule = schedule; 88 newLine->lineInfo = lineInfo; 89 newLine->systemKey = systemKey; 90 newLine->globalSeq = globalSeq; 91 newLine->schedleSeq = schedleSeq; 92 64 93 for(int stationIndex = 0; stationIndex < numStations; stationIndex++) 65 94 { 95 STATION * newStation = new STATION; 96 97 int numLoops = 0; 66 98 getline(highwaysData, currLine); 67 sscanf(currLine, "%d %d %d %d %d %d", &lds, ) 99 sscanf(currLine, "%ld %d %d %s %d %d", &lds, &dropNum,&routeNum, 100 direction, postmile, &numLoops); 68 101 102 newLine->lds.push_back(lds); 103 newLine->ldsIndex.push_back(ldsIndex++); 104 105 for(int loopIndex = 0; loopIndex < numLoops; loopIndex++) 106 { 107 getline(highwaysData, currLine); 108 sscanf(currLine, "%ld %f %d", &loopID, &occ, &vol); 109 } 69 110 } 111 112 this->lines.push_back(newLine); 70 113 } 71 getline(highwaysData, currLine);72 114 } 73 115
Note: See TracChangeset
for help on using the changeset viewer.
