Changeset 205 in tmcsimulator
- Timestamp:
- 11/01/2017 03:53:59 AM (9 years ago)
- Files:
-
- 8 edited
-
branches/FEPSimulator/FEPSim.cpp (modified) (5 diffs)
-
branches/FEPSimulator/FEPSim.h (modified) (1 diff)
-
branches/FEPSimulator/HighwaysParser.cpp (modified) (2 diffs)
-
branches/FEPSimulator/nbproject/private/private.xml (modified) (1 diff)
-
trunk/src/tmcsim/application.properties (modified) (1 diff)
-
trunk/test/atmsdriver/model/HighwaysTest.java (modified) (1 diff)
-
trunk/test/atmsdriver/model/LoadHighwaysTest.java (modified) (3 diffs)
-
trunk/test/atmsdriver/model/LoadSadDotsTest.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/FEPSimulator/FEPSim.cpp
r202 r205 26 26 vector<STATION*> ldsMap = highwaysParser.stations; 27 27 28 28 29 // Send one reply for every FEPLine 29 30 for (int i = 0; i < lines.size(); i++) { … … 74 75 fsa.msg.message[3 + aa] = 0xff; 75 76 76 for(int l = 0; l < fsa.msg.message_len + 2; l++)77 /*for(int l = 0; l < fsa.msg.message_len + 2; l++) 77 78 { 78 79 printf("%02X", (unsigned char) fsa.msg.message[l]); 79 80 } 80 printf("\n"); 81 printf("\n");*/ 81 82 82 83 // info … … 89 90 fepReply.answers.fep_answer_list_u.shortp.answers[0] = fsa; 90 91 // send out data 91 printf("Transferring line=%d, lds_drop_no=%d...\n", lines.at(i)->lineNum, (int)ldsMap.at(index)->drop);92 //printf("Transferring line=%d, lds_drop_no=%d...\n", lines.at(i)->lineNum, (int)ldsMap.at(index)->drop); 92 93 // Make RPC Call and handle response 93 94 // printf("Handling ATMS response...\n"); … … 178 179 // zero out buffer 179 180 bzero(buffer, BUFF_SIZE); 180 181 181 182 // read XML from socket 182 183 int totBytes = 0; … … 184 185 totBytes += n; 185 186 } 187 HighwaysParser highwaysParser = HighwaysParser(buffer); 188 186 189 187 190 if (n < 0) { -
branches/FEPSimulator/FEPSim.h
r195 r205 43 43 #include <unistd.h> 44 44 45 // const int BUFF_SIZE = 5500000; // where it was 46 // const int BUFF_SIZE = 11522291; // what it couldnt be :) 47 const int BUFF_SIZE = 950401; // where it is now :) 45 const int BUFF_SIZE = 1266341; // where it is now :) 48 46 49 47 class FEPSim { -
branches/FEPSimulator/HighwaysParser.cpp
r202 r205 76 76 int numLoops = 0; 77 77 getline(highwaysStream, currLine); 78 cout << currLine << endl;79 78 char direction; 80 79 sscanf(currLine.c_str(), "%ld %hd %d %c %f %d", &lds, &dropNum, &routeNum, &direction, 81 80 &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;87 81 newLine->lds.push_back(lds); 88 82 newLine->ldsIndex.push_back(ldsIndex++); … … 101 95 cout << currLine << endl; 102 96 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 97 newLoop->loopID = loopID; 108 98 newLoop->occ = occ; 109 99 newLoop->vol = vol; 100 newLoop->spd = 0; 110 101 newLoop->loop_loc = loopLoc; 111 102 cout << "Adding " << newLoop->loopID << " to " << newStation->lds << endl; 112 103 newStation->loops.push_back(newLoop); 113 104 } 114 105 newStation->length = newStation->loops.size() * 2 + CONTROL_DATA_LEN; 115 106 newStation->dataPack = DataPacker::packData(newStation); 107 for(int byte = 0; byte < newStation->length; byte++) 108 { 109 printf("%02X", (unsigned char) newStation->dataPack[byte]); 110 } 116 111 117 cout << "NUMBER OF LOOPS: " << newStation->loops.size() << endl; 118 112 cout << "Adding " << newStation->lds << " to ldsMap " << " at index " << ldsIndex << endl; 119 113 this->stations.push_back(newStation); 120 114 } 121 115 cout << "Adding " << newLine->lineNum << " to lines" << endl; 122 116 this->lines.push_back(newLine); 123 117 } -
branches/FEPSimulator/nbproject/private/private.xml
r195 r205 11 11 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/HighwaysParser.h</file> 12 12 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/DataPacker.h</file> 13 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/DataPacker.cpp</file> 13 14 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/FEPSim.cpp</file> 15 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/Main.cpp</file> 14 16 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/fep.h</file> 15 17 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/FEPSim.h</file> -
trunk/src/tmcsim/application.properties
r202 r205 1 # Mon, 30 Oct 2017 19:17:39 -07001 #Wed, 01 Nov 2017 05:01:19 -0700 2 2 3 Application.revision= 1953 Application.revision=202 4 4 5 5 Application.buildnumber=68 -
trunk/test/atmsdriver/model/HighwaysTest.java
r191 r205 56 56 } 57 57 String expString = 58 "241 ------------------------------------------------------------\n"59 +" 5 @-------------------------------------------------------------------------------------------------------------------------------------------\n"60 +"405 --------------------------------------------------------------------------------\n"61 +"133 ----------------\n"62 +"261 -----------------\n"63 +" 22 ----------------------------------\n"64 +" 55 ------------------------------------------\n"65 +" 73 -----------------------------------------------------\n"66 +" 57 ------------------------------------------\n"67 +" 91 --------------------------------------------------------------\n"68 +"605 ---\n";58 "241 ------------------------------------------------------------\n" 59 +" 5 @-------------------------------------------------------------------------------------------------------------------------------------------\n" 60 +"405 --------------------------------------------------------------------------------\n" 61 +"133 ----------------\n" 62 +"261 -----------------\n" 63 +" 22 ----------------------------------\n" 64 +" 55 ------------------------------------------\n" 65 +" 73 -----------------------------------------------------\n" 66 +" 57 ------------------------------------------\n" 67 +" 91 --------------------------------------------------------------\n" 68 +"605 ---\n"; 69 69 70 70 /** -
trunk/test/atmsdriver/model/LoadHighwaysTest.java
r185 r205 26 26 writer = new PrintWriter(new FileWriter("test/atmsdriver/model/lds_loadhighways_sample.txt")); 27 27 28 writer.println("lds_id line drop sch lineinfo system_key sch_seq glo_seq count freeway Dir ca_pm lds_name"); 29 writer.println("1203081 6 17 2 2 1123005691 26491 1357639 19 55 N 4.58 BRISTOL"); 30 writer.println("1210163 6 20 2 2 1123005691 26491 1357639 19 55 N 5.51 PAULARINO 1"); 31 writer.println("1203244 50 4 13 13 1123005873 24148 1357650 19 55 N 10 MCFADDEN"); 32 writer.println("1203211 50 5 13 13 1123005873 24148 1357650 19 55 N 9.41 EDINGER 2"); 33 34 writer.println("1203261 23 14 23 21 1123005995 26479 1357626 18 55 S 10.4 S OF 5"); 35 writer.println("1203083 6 18 2 2 1123005691 26491 1357639 19 55 S 4.7 BAKER 1"); 36 writer.println("1210174 6 19 2 2 1123005691 26491 1357639 19 55 S 5.06 BAKER 2"); 37 writer.println("1203270 23 15 23 21 1123005995 26479 1357626 18 55 S 10.5 N OF 5"); 38 39 writer.println("1205238 22 16 4 4 1123005726 26490 1357624 19 5 S 32.25 17TH 1"); 40 writer.println("1205208 22 17 4 4 1123005726 26490 1357624 19 5 S 31.6 GRAND 1"); 41 writer.println("1205270 5 19 1 1 1123005673 26492 1357648 20 5 S 33 MAIN 1 "); 42 43 28 writer.println("2"); 29 writer.println("32 0 2"); 30 writer.println("1210831 1 5 S 0.9 8 CALAFIA"); 31 writer.println("1210832 ML_1"); 32 writer.println("1210833 ML_2"); 33 writer.println("1210834 ML_3"); 34 writer.println("1210835 ML_4"); 35 writer.println("1210836 PASSAGE"); 36 writer.println("1210837 DEMAND"); 37 writer.println("1210838 QUEUE"); 38 writer.println("1210839 RAMP_OFF"); 39 writer.println("1210845 2 5 S 1.49 9 EL CAMINO REAL"); 40 writer.println("1210846 ML_1"); 41 writer.println("1210847 ML_2"); 42 writer.println("1210848 ML_3"); 43 writer.println("1210849 ML_4"); 44 writer.println("1210850 RAMP_ON"); 45 writer.println("1210851 PASSAGE"); 46 writer.println("1210853 DEMAND"); 47 writer.println("1210854 QUEUE"); 48 writer.println("1210855 RAMP_OFF"); 49 writer.println("74 0 1"); 50 writer.println("1204203 2 5 N 1.26 13 MAGDALENA"); 51 writer.println("1204205 RAMP_ON"); 52 writer.println("1204206 QUEUE"); 53 writer.println("1204207 DEMAND"); 54 writer.println("1204208 PASSAGE"); 55 writer.println("1204210 RAMP_OFF"); 56 writer.println("1204212 ML_1"); 57 writer.println("1204213 ML_2"); 58 writer.println("1204214 ML_3"); 59 writer.println("1204215 ML_4"); 60 writer.println("1204217 OS_1"); 61 writer.println("1204218 OS_2"); 62 writer.println("1204219 OS_3"); 63 writer.println("1204220 OS_4"); 44 64 writer.close(); 45 65 } catch (Exception e) { … … 61 81 System.out.println("toXML"); 62 82 Highways highways = new Highways( 63 " config/vds_data/highways_fullmap.txt",83 "test/atmsdriver/model/lds_loadhighways_sample.txt", 64 84 "localhost", 8080); 65 85 66 86 // Test for correct number of highways 67 87 ArrayList<Highway> result = highways.highways; 68 assertEquals( 2, result.size());88 assertEquals(1, result.size()); 69 89 70 // Test 5 5 Nwas loaded71 Highway fi ftyfiveN= result.get(0);72 assertEquals(new Integer(5 5), fiftyfiveN.routeNumber);90 // Test 5 was loaded 91 Highway fiveS = result.get(0); 92 assertEquals(new Integer(5), fiveS.routeNumber); 73 93 74 // Test 55 N stations are sorted by postmile 75 ArrayList<Station> stations = fiftyfiveN.stations; 94 // Test for correct number of stations 95 assertEquals(new Integer(3), new Integer(fiveS.stations.size())); 96 97 // Test 5 stations are sorted by postmile 98 ArrayList<Station> stations = fiveS.stations; 76 99 ArrayList<Double> stationsPostmiles = new ArrayList<>(); 77 100 for(Station station : stations) … … 82 105 // Create expected station postmile list (sorted) 83 106 ArrayList<Double> expectedStationsPostmiles = new ArrayList<>(); 84 expectedStationsPostmiles.add(new Double(4.58)); 85 expectedStationsPostmiles.add(new Double(4.7)); 86 expectedStationsPostmiles.add(new Double(5.06)); 87 expectedStationsPostmiles.add(new Double(5.51)); 88 expectedStationsPostmiles.add(new Double(9.41)); 89 expectedStationsPostmiles.add(new Double(10)); 90 expectedStationsPostmiles.add(new Double(10.4)); 91 expectedStationsPostmiles.add(new Double(10.5)); 92 for(int i = 0; i < 8; i++) 93 { 94 assertEquals(expectedStationsPostmiles.get(i), 95 stationsPostmiles.get(i)); 96 } 97 98 // Test 55 S was loaded 99 Highway fiftyfiveS = result.get(1); 100 assertEquals(new Integer(5), fiftyfiveS.routeNumber); 101 102 // Test 55 S stations are sorted by postmile 103 stations = fiftyfiveS.stations; 104 stationsPostmiles.clear(); 105 for(Station station : stations) 106 { 107 stationsPostmiles.add(station.postmile); 108 } 109 expectedStationsPostmiles.clear(); 110 expectedStationsPostmiles.add(new Double(31.6)); 111 expectedStationsPostmiles.add(new Double(32.25)); 112 expectedStationsPostmiles.add(new Double(33)); 107 expectedStationsPostmiles.add(new Double(0.9)); 108 expectedStationsPostmiles.add(new Double(1.26)); 109 expectedStationsPostmiles.add(new Double(1.49)); 110 113 111 for(int i = 0; i < 3; i++) 114 112 { -
trunk/test/atmsdriver/model/LoadSadDotsTest.java
r186 r205 48 48 System.out.println("toXML"); 49 49 Highways highways = new Highways( 50 " config/vds_data/highways_fullmap.txt",50 "test/atmsdriver/model/lds_loadhighways_sample.txt", 51 51 "localhost", 8080); 52 52
Note: See TracChangeset
for help on using the changeset viewer.
