Changeset 205 in tmcsimulator


Ignore:
Timestamp:
11/01/2017 03:53:59 AM (9 years ago)
Author:
jtorres
Message:

LoadHighwaysTest?.java: now passing. HighwaysParser?.cpp: added a bunch of debugging output to stdout, bug still not found. FEPSim.h: changed buffer size. FEPSim.cpp: some local debugging outputs/config.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/FEPSimulator/FEPSim.cpp

    r202 r205  
    2626    vector<STATION*> ldsMap = highwaysParser.stations; 
    2727 
     28     
    2829    // Send one reply for every FEPLine 
    2930    for (int i = 0; i < lines.size(); i++) { 
     
    7475            fsa.msg.message[3 + aa] = 0xff; 
    7576             
    76             for(int l = 0; l < fsa.msg.message_len + 2; l++) 
     77            /*for(int l = 0; l < fsa.msg.message_len + 2; l++) 
    7778            { 
    7879                printf("%02X", (unsigned char) fsa.msg.message[l]); 
    7980            } 
    80             printf("\n"); 
     81            printf("\n");*/ 
    8182             
    8283            // info 
     
    8990            fepReply.answers.fep_answer_list_u.shortp.answers[0] = fsa; 
    9091            // 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); 
    9293            // Make RPC Call and handle response 
    9394            // printf("Handling ATMS response...\n"); 
     
    178179        // zero out buffer 
    179180        bzero(buffer, BUFF_SIZE); 
    180  
     181         
    181182        // read XML from socket 
    182183        int totBytes = 0; 
     
    184185            totBytes += n; 
    185186        } 
     187        HighwaysParser highwaysParser = HighwaysParser(buffer); 
     188 
    186189 
    187190        if (n < 0) { 
  • branches/FEPSimulator/FEPSim.h

    r195 r205  
    4343#include <unistd.h> 
    4444 
    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 :)  
     45const int BUFF_SIZE = 1266341; // where it is now :)  
    4846 
    4947class FEPSim { 
  • branches/FEPSimulator/HighwaysParser.cpp

    r202 r205  
    7676            int numLoops = 0; 
    7777            getline(highwaysStream, currLine); 
    78             cout << currLine << endl; 
    7978            char direction; 
    8079            sscanf(currLine.c_str(), "%ld %hd %d %c %f %d", &lds, &dropNum, &routeNum, &direction, 
    8180                    &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; 
    8781            newLine->lds.push_back(lds); 
    8882            newLine->ldsIndex.push_back(ldsIndex++); 
     
    10195                cout << currLine << endl; 
    10296                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; 
    10797                newLoop->loopID = loopID; 
    10898                newLoop->occ = occ; 
    10999                newLoop->vol = vol; 
     100                newLoop->spd = 0; 
    110101                newLoop->loop_loc = loopLoc; 
    111                  
     102                cout << "Adding " << newLoop->loopID << " to " << newStation->lds << endl; 
    112103                newStation->loops.push_back(newLoop); 
    113104            } 
    114105            newStation->length = newStation->loops.size() * 2 + CONTROL_DATA_LEN; 
    115106            newStation->dataPack = DataPacker::packData(newStation); 
     107            for(int byte = 0; byte < newStation->length; byte++) 
     108            { 
     109                printf("%02X", (unsigned char) newStation->dataPack[byte]); 
     110            } 
    116111             
    117             cout << "NUMBER OF LOOPS: " << newStation->loops.size() << endl; 
    118              
     112            cout << "Adding " << newStation->lds << " to ldsMap " << " at index " << ldsIndex << endl; 
    119113            this->stations.push_back(newStation); 
    120114        } 
    121          
     115        cout << "Adding " << newLine->lineNum << " to lines" << endl; 
    122116        this->lines.push_back(newLine); 
    123117    } 
  • branches/FEPSimulator/nbproject/private/private.xml

    r195 r205  
    1111            <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/HighwaysParser.h</file> 
    1212            <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/DataPacker.h</file> 
     13            <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/DataPacker.cpp</file> 
    1314            <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/FEPSim.cpp</file> 
     15            <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/Main.cpp</file> 
    1416            <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/fep.h</file> 
    1517            <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 -0700 
     1#Wed, 01 Nov 2017 05:01:19 -0700 
    22 
    3 Application.revision=195 
     3Application.revision=202 
    44 
    55Application.buildnumber=68 
  • trunk/test/atmsdriver/model/HighwaysTest.java

    r191 r205  
    5656    } 
    5757    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"; 
    6969 
    7070    /** 
  • trunk/test/atmsdriver/model/LoadHighwaysTest.java

    r185 r205  
    2626            writer = new PrintWriter(new FileWriter("test/atmsdriver/model/lds_loadhighways_sample.txt")); 
    2727             
    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"); 
    4464            writer.close(); 
    4565        } catch (Exception e) { 
     
    6181        System.out.println("toXML"); 
    6282        Highways highways = new Highways( 
    63                 "config/vds_data/highways_fullmap.txt", 
     83                "test/atmsdriver/model/lds_loadhighways_sample.txt", 
    6484                "localhost", 8080); 
    6585         
    6686        // Test for correct number of highways 
    6787        ArrayList<Highway> result = highways.highways; 
    68         assertEquals(2, result.size()); 
     88        assertEquals(1, result.size()); 
    6989         
    70         // Test 55 N was loaded 
    71         Highway fiftyfiveN = result.get(0); 
    72         assertEquals(new Integer(55), fiftyfiveN.routeNumber); 
     90        // Test 5 was loaded 
     91        Highway fiveS = result.get(0); 
     92        assertEquals(new Integer(5), fiveS.routeNumber); 
    7393         
    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; 
    7699        ArrayList<Double> stationsPostmiles = new ArrayList<>(); 
    77100        for(Station station : stations) 
     
    82105        // Create expected station postmile list (sorted) 
    83106        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 
    113111        for(int i = 0; i < 3; i++) 
    114112        { 
  • trunk/test/atmsdriver/model/LoadSadDotsTest.java

    r186 r205  
    4848        System.out.println("toXML"); 
    4949        Highways highways = new Highways( 
    50                 "config/vds_data/highways_fullmap.txt", 
     50                "test/atmsdriver/model/lds_loadhighways_sample.txt", 
    5151                "localhost", 8080); 
    5252         
Note: See TracChangeset for help on using the changeset viewer.