Changeset 137 in tmcsimulator for branches/FEPSimulator


Ignore:
Timestamp:
10/18/2017 12:33:30 AM (9 years ago)
Author:
jtorres
Message:

branches/FEPSimulator/DataPacker.cpp: Signaled unknowns with the phrase (Need to check:) in the comments in code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/FEPSimulator/DataPacker.cpp

    r117 r137  
    66unsigned char * DataPacker::packData(STATION *station) { 
    77    int pos = 26; 
     8     
    89    DataPacker packer; 
     10    // static meta data pack 
    911    msg = packer.staticDataPack(station); 
     12     
     13    // dynamic data pack 
    1014    pos = packer.dynamicDataPack(station, 5, pos);     
    1115    pos = packer.dynamicDataPack(station, 6, pos); 
     
    3135            packer.chksum(msg, station->length - 1 - 1); 
    3236     
     37    /* hex dump of full datapack message - for debugging purposes 
    3338    for (int j = 0; j < station->length; j++) { 
    3439        printf("%02X", msg[j]); 
    3540    } 
    3641    printf("\n"); 
    37  
     42    */ 
     43     
    3844    return msg;  
    3945} 
    4046 
    4147int DataPacker::dynamicDataPack(STATION *station, int packNo, int pos) { 
     48     
    4249    int i, j, vol, occ, haveData; 
     50     
    4351    //used for data byte 23 and 24 
     52    // Need to check: should we do this here? or is this already set? 
    4453    station->MlTotVol = 0; 
    4554    station->OppTotVol = 0; 
    4655 
    4756    for (j = 1; j <= 8; j++) { 
    48          
    4957        if (DataAvail(msg[packNo - 1], j)) { 
    5058            // loop at bit j has data 
     
    5260                // what's the corresponding loop of bit j 
    5361                char * currLoopLoc = station->loops.at(lane)->loop_loc; 
     62                 
     63                // check loop location type and see if there is data for this 
     64                // loop in the station 
    5465                if (packNo == 5) 
    5566                    haveData = strcmp(currLoopLoc, dp5[j - 1]); 
     
    6273                else 
    6374                    return -1; 
    64  
     75                 
     76                // if there is NO data for this loop in the station 
     77                // Need to check: is this if clause doing the correct thing? 
    6578                if (haveData == 0) { 
    6679                    LOOP *currLoop = station->loops.at(lane); 
     
    7386                    pos++; 
    7487                    msg[pos - 1] = packedVOLOCC.low; 
    75  
     88                     
     89                    // Need to check: same. should this be in this if clause? 
    7690                    if (packNo == 5) { 
    7791                        station->MlTotVol += vol; 
     
    146160        } 
    147161    } 
     162    // Need to check: if there is a demand loop, we set bit 14 to 0x0B (No metering) 
     163    // is this correct? 
    148164    if (found) { 
     165        // Need to check: what does this flag represent?? 
    149166        // BYTE 14: mostly 07, some are 05, 03, 00 
    150167        dataPack[14 - 1] = 0x07; 
     
    163180        // Local Responsive Rate. DON'T UNDERSTAND YET 
    164181        dataPack[21 - 1] = 0x00; 
    165         // TOD Rate: need to query RAMP plugin! 
     182        // TOD Rate: need to query RAMP plugin! Need to check, might be important? 
    166183        dataPack[22 - 1] = 0x00; 
    167184    }// LDS: NO Metering 
     
    179196 
    180197    // dataPack 23-24: sum of mainline/Opp traffic data; need to be updated every 30 sec 
     198    // Need to check, is this in sync with the notes in dynamicDataPack? why 
     199    // are we setting it to 0 here, might not need to... 
    181200    station->MlTotVol = 0; 
    182201    station->OppTotVol = 0; 
     
    185204 
    186205    // dataPack 25-26: BYTE 25 is fixed, i.e. 03; BYTE 26 is either 0xA2 or 0x84 
     206    // Need to check: what is byte 26? what are 0xA2 and 0x84 
    187207    dataPack[25 - 1] = 0x03; 
    188208    dataPack[26 - 1] = 0x84; 
Note: See TracChangeset for help on using the changeset viewer.