Changeset 202 in tmcsimulator
- Timestamp:
- 10/30/2017 06:35:42 PM (9 years ago)
- Files:
-
- 6 edited
-
branches/FEPSimulator/DataPacker.cpp (modified) (1 diff)
-
branches/FEPSimulator/FEPSim.cpp (modified) (2 diffs)
-
branches/FEPSimulator/HighwaysParser.cpp (modified) (5 diffs)
-
branches/FEPSimulator/HighwaysParser.h (modified) (2 diffs)
-
trunk/src/atmsdriver/model/LoopDetector.java (modified) (1 diff)
-
trunk/src/tmcsim/application.properties (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/FEPSimulator/DataPacker.cpp
r159 r202 127 127 // dataPack2 (2 bytes per loop) 128 128 dataPack[2 - 1] = station->loops.size() * 2 + Fixed_Byte_To_Checksum; 129 130 129 // dataPacket 3 (lowbyte: # of mainline loops, highbyte: # of opposite loops) 131 130 int low = 0, high = 0; -
branches/FEPSimulator/FEPSim.cpp
r177 r202 23 23 void FEPSim::sendReplys(char * buffer) { 24 24 HighwaysParser highwaysParser = HighwaysParser(buffer); 25 vector<FEP_LINE*> lines = highwaysParser. getLines();26 vector<STATION*> ldsMap = highwaysParser. getStations();25 vector<FEP_LINE*> lines = highwaysParser.lines; 26 vector<STATION*> ldsMap = highwaysParser.stations; 27 27 28 28 // Send one reply for every FEPLine … … 94 94 // Transfer the station data to ATMS and listen for response 95 95 handleCallResponse(fep_reply_xfer_32(&fepReply, clnt)); 96 unsigned int sleepseconds = /* 100 * */1000; 97 usleep(sleepseconds); 96 98 } 97 99 } -
branches/FEPSimulator/HighwaysParser.cpp
r199 r202 21 21 * */ 22 22 HighwaysParser::HighwaysParser(char * hwyData) { 23 string highwaysData = hwyData; 24 istringstream stream(highwaysData); 25 parseLines(highwaysData); 23 parseLines(hwyData); 26 24 } 27 25 … … 29 27 } 30 28 31 vector<FEP_LINE *> HighwaysParser::getLines() { 32 33 } 34 35 vector<STATION *> HighwaysParser::getStations() { 36 37 } 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 29 void HighwaysParser::parseLines(char * hwyData) 43 30 { 44 // meta data 45 long loopID; 46 char *loop_loc; 47 48 // dynamic data 49 int vol; 50 float occ; 51 double spd; 52 }; 53 void HighwaysParser::parseLines(istringstream highwaysData) 54 { 31 string highwaysData = hwyData; 32 istringstream highwaysStream(highwaysData); 55 33 string currLine; 56 getline(highways Data, currLine);34 getline(highwaysStream, currLine); 57 35 int numLines; 58 sscanf( highwaysData, "%d", &numLines);59 36 sscanf(currLine.c_str(), "%d", &numLines); 37 cout << currLine << endl; 60 38 int lineNum = 0; 61 39 long lds = 0; … … 69 47 short dropNum = 0; 70 48 int routeNum = 0; 71 char * direction = "";72 49 float postmile = 0; 73 50 long loopID = 0; 74 51 float occ = 0; 75 52 int vol = 0; 76 53 char loopLoc[25]; 77 54 for(int lineIndex = 0; lineIndex < numLines; lineIndex++) 78 55 { 79 56 FEP_LINE * newLine = new FEP_LINE; 80 57 81 getline(highways Data, currLine);58 getline(highwaysStream, currLine); 82 59 int numStations = 0; 83 sscanf(currLine, "%d %d %d", &lineNum, &count, &numStations); 84 60 sscanf(currLine.c_str(), "%d %hd %d", &lineNum, &count, &numStations); 61 cout << "Line num: " << lineNum << endl; 62 cout << "Count: " << count << endl; 63 cout << "numStations: " << numStations << endl; 85 64 newLine->lineNum = lineNum; 86 65 newLine->count = count; … … 94 73 { 95 74 STATION * newStation = new STATION; 96 75 97 76 int numLoops = 0; 98 getline(highwaysData, currLine); 99 sscanf(currLine, "%ld %d %d %s %d %d", &lds, &dropNum,&routeNum, 100 direction, postmile, &numLoops); 101 77 getline(highwaysStream, currLine); 78 cout << currLine << endl; 79 char direction; 80 sscanf(currLine.c_str(), "%ld %hd %d %c %f %d", &lds, &dropNum, &routeNum, &direction, 81 &postmile, &numLoops); 82 cout << "NumberLoops: " << numLoops << endl; 83 cout << "DropNum: " << dropNum << endl; 84 cout << "LDS: " << lds << endl; 85 cout << "LDSIndex: " << ldsIndex << endl; 86 cout << "postmile: " << postmile << endl; 102 87 newLine->lds.push_back(lds); 103 88 newLine->ldsIndex.push_back(ldsIndex++); 89 newStation->lds = lds; 90 newStation->line_num = lineNum; 91 newStation->drop = dropNum; 92 newStation->pos = 0; 93 newStation->MlTotVol = 0; 94 newStation->OppTotVol = 0; 104 95 105 96 for(int loopIndex = 0; loopIndex < numLoops; loopIndex++) 106 97 { 107 getline(highwaysData, currLine); 108 sscanf(currLine, "%ld %f %d", &loopID, &occ, &vol); 98 LOOP * newLoop = new LOOP; 99 100 getline(highwaysStream, currLine); 101 cout << currLine << endl; 102 sscanf(currLine.c_str(), "%ld %f %d %s", &loopID, &occ, &vol, loopLoc); 103 cout << "LOOP ID: " << loopID << endl; 104 cout << "OCC: " << occ << endl; 105 cout << "VOL: " << vol << endl; 106 cout << "LOOPLOC: " << loopLoc << endl; 107 newLoop->loopID = loopID; 108 newLoop->occ = occ; 109 newLoop->vol = vol; 110 newLoop->loop_loc = loopLoc; 111 112 newStation->loops.push_back(newLoop); 109 113 } 114 newStation->length = newStation->loops.size() * 2 + CONTROL_DATA_LEN; 115 newStation->dataPack = DataPacker::packData(newStation); 116 117 cout << "NUMBER OF LOOPS: " << newStation->loops.size() << endl; 118 119 this->stations.push_back(newStation); 110 120 } 111 121 … … 113 123 } 114 124 } 115 116 FEP_LINE * HighwaysParser::parseLine(istringstream highwaysData)117 {118 119 }120 121 STATION * HighwaysParser::parseStation(istringstream highwaysData)122 {123 124 }125 126 LOOP * HighwaysParser::parseLoop(istringstream highwaysData)127 {128 129 } -
branches/FEPSimulator/HighwaysParser.h
r198 r202 13 13 #include <iostream> 14 14 #include <sstream> 15 #include <stdio.h> 16 #include "DataPacker.h" 15 17 16 18 class HighwaysParser { … … 18 20 HighwaysParser(char * highwaysData); 19 21 20 vector<FEP_LINE*> getLines(); 21 vector<STATION*> getStations(); 22 22 vector<FEP_LINE*> lines; 23 vector<STATION*> stations; 23 24 virtual ~HighwaysParser(); 24 25 private: 25 vector<FEP_LINE*> lines; 26 vector<STATION*> stations; 27 28 FEP_LINE * parseLine(istringstream highwaysData); 29 STATION * parseStation(istringstream highwaysData); 30 LOOP * parseLoop(istringstream highwaysData); 31 void parseLines(istringstream highwaysData); 26 void parseLines(char * highwaysData); 32 27 }; 33 28 -
trunk/src/atmsdriver/model/LoopDetector.java
r190 r202 88 88 build.append(" "); 89 89 build.append(this.vol); 90 build.append(" "); 90 91 } 91 else 92 { 93 build.append(this.loopLocation); 94 } 92 build.append(this.loopLocation); 95 93 build.append("\n"); 96 94 return build.toString(); -
trunk/src/tmcsim/application.properties
r195 r202 1 #Mon, 30 Oct 2017 00:56:17-07001 #Mon, 30 Oct 2017 19:17:39 -0700 2 2 3 Application.revision=19 03 Application.revision=195 4 4 5 Application.buildnumber=6 75 Application.buildnumber=68
Note: See TracChangeset
for help on using the changeset viewer.
