Changeset 137 in tmcsimulator for branches/FEPSimulator
- Timestamp:
- 10/18/2017 12:33:30 AM (9 years ago)
- File:
-
- 1 edited
-
branches/FEPSimulator/DataPacker.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/FEPSimulator/DataPacker.cpp
r117 r137 6 6 unsigned char * DataPacker::packData(STATION *station) { 7 7 int pos = 26; 8 8 9 DataPacker packer; 10 // static meta data pack 9 11 msg = packer.staticDataPack(station); 12 13 // dynamic data pack 10 14 pos = packer.dynamicDataPack(station, 5, pos); 11 15 pos = packer.dynamicDataPack(station, 6, pos); … … 31 35 packer.chksum(msg, station->length - 1 - 1); 32 36 37 /* hex dump of full datapack message - for debugging purposes 33 38 for (int j = 0; j < station->length; j++) { 34 39 printf("%02X", msg[j]); 35 40 } 36 41 printf("\n"); 37 42 */ 43 38 44 return msg; 39 45 } 40 46 41 47 int DataPacker::dynamicDataPack(STATION *station, int packNo, int pos) { 48 42 49 int i, j, vol, occ, haveData; 50 43 51 //used for data byte 23 and 24 52 // Need to check: should we do this here? or is this already set? 44 53 station->MlTotVol = 0; 45 54 station->OppTotVol = 0; 46 55 47 56 for (j = 1; j <= 8; j++) { 48 49 57 if (DataAvail(msg[packNo - 1], j)) { 50 58 // loop at bit j has data … … 52 60 // what's the corresponding loop of bit j 53 61 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 54 65 if (packNo == 5) 55 66 haveData = strcmp(currLoopLoc, dp5[j - 1]); … … 62 73 else 63 74 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? 65 78 if (haveData == 0) { 66 79 LOOP *currLoop = station->loops.at(lane); … … 73 86 pos++; 74 87 msg[pos - 1] = packedVOLOCC.low; 75 88 89 // Need to check: same. should this be in this if clause? 76 90 if (packNo == 5) { 77 91 station->MlTotVol += vol; … … 146 160 } 147 161 } 162 // Need to check: if there is a demand loop, we set bit 14 to 0x0B (No metering) 163 // is this correct? 148 164 if (found) { 165 // Need to check: what does this flag represent?? 149 166 // BYTE 14: mostly 07, some are 05, 03, 00 150 167 dataPack[14 - 1] = 0x07; … … 163 180 // Local Responsive Rate. DON'T UNDERSTAND YET 164 181 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? 166 183 dataPack[22 - 1] = 0x00; 167 184 }// LDS: NO Metering … … 179 196 180 197 // 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... 181 200 station->MlTotVol = 0; 182 201 station->OppTotVol = 0; … … 185 204 186 205 // 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 187 207 dataPack[25 - 1] = 0x03; 188 208 dataPack[26 - 1] = 0x84;
Note: See TracChangeset
for help on using the changeset viewer.
