Changeset 190 in tmcsimulator for trunk/src/atmsdriver
- Timestamp:
- 10/29/2017 10:51:53 PM (9 years ago)
- Location:
- trunk/src/atmsdriver
- Files:
-
- 5 edited
-
ATMSDriver.java (modified) (1 diff)
-
model/FEPLine.java (modified) (4 diffs)
-
model/Highways.java (modified) (5 diffs)
-
model/LoopDetector.java (modified) (8 diffs)
-
model/Station.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/ATMSDriver.java
r186 r190 116 116 Integer.parseInt(ATMSDriverProperties.getProperty( 117 117 PROPERTIES.FEP_WRITER_PORT.name))); 118 System.out.println(highways.toCondensedFormat(false));119 118 // create the exchange reader 120 119 exchangeReader = new ExchangeReader(); -
trunk/src/atmsdriver/model/FEPLine.java
r186 r190 19 19 { 20 20 /* Static FEPLine meta data */ 21 final public int line Num;21 final public int lineID; 22 22 final public List<Station> stations; 23 23 final private int count; … … 30 30 * @param count 31 31 */ 32 FEPLine(int line Num, ArrayList<Station> stations, int count)32 FEPLine(int lineID, ArrayList<Station> stations, int count) 33 33 { 34 this.line Num = lineNum;34 this.lineID = lineID; 35 35 this.stations = stations; 36 36 this.count = count; … … 55 55 { 56 56 StringBuilder build = new StringBuilder(); 57 build.append(Integer.toString(this.line Num));57 build.append(Integer.toString(this.lineID)); 58 58 build.append(" "); 59 59 build.append(Integer.toString(this.count)); … … 81 81 82 82 Element lineNumElement = theDoc.createElement(XML_TAGS.LINE_NUM.tag); 83 lineNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.line Num)));83 lineNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.lineID))); 84 84 lineElement.appendChild(lineNumElement); 85 85 -
trunk/src/atmsdriver/model/Highways.java
r186 r190 61 61 // configure and load highways 62 62 this.highways = configureHighways(); 63 63 64 64 // write to FEP host and port number 65 65 this.FEPHostName = FEPHostName; … … 278 278 279 279 int loopID = scline.nextInt(); 280 int laneNum = scline.nextInt(); 281 String loopLoc = getLoopLoc(line); // NEED GET LOOPLOC 280 String loopLoc = getLoopLoc(line); 282 281 scline.close(); 283 return new LoopDetector(loopID, loopLoc , laneNum);282 return new LoopDetector(loopID, loopLoc); 284 283 } 285 284 … … 293 292 { 294 293 Scanner sc = new Scanner(line); 295 sc.nextInt();296 294 sc.nextInt(); 297 295 … … 343 341 344 342 // Write the highways data over the socket 345 out.println(this.to XML());343 out.println(this.toCondensedFormat(false)); 346 344 347 345 // close the socket … … 369 367 * @param MetaDataOnly Whether you want meta data, or a full dump for FEPSim 370 368 * @return String, highways data in condensed format 369 * 370 * Example toCondensedFormat(MetaDataOnly = false) output: 371 * 372 * 43 // "number of lines" 373 * 32 0 13 // "line id" "count num" "number of stations" 374 * 1210831 1 5 S 0.9 8 // "station id" "drop num" "route num"... 375 * // ..."direction" "postmile" "number of loops" 376 * 1210832 0.0 0 // "loop id" "occ" "vol" 377 * 1210833 0.0 0 // .. 378 * 1210834 0.0 0 // .. 379 * 1210835 0.0 0 // .. 380 * 1210836 0.0 0 // .. 381 * 1210837 0.0 0 // .. 382 * 1210838 0.0 0 // .. 383 * 1210839 0.0 0 // .. 384 * ... 385 * 386 * Example toCondensedFormat(MetaDataOnly = true) output: 387 * 388 * 43 // "number of lines" 389 * 32 0 13 // "line id" "count num" "number of stations" 390 * 1210831 1 5 S 0.9 8 CALAFIA // "station id" "drop num" "route num"... 391 * // ..."direction" "postmile"... 392 * // ..."number of loops" "string location" 393 * 1210832 ML_1 // "loop id" "loop location" 394 * 1210833 ML_2 // " " 395 * 1210834 ML_3 // " " 396 * 1210835 ML_4 // " " 397 * 1210836 PASSAGE // " " 398 * 1210837 DEMAND // " " 399 * 1210838 QUEUE // " " 400 * 1210839 RAMP_OFF // " " 401 * ... 371 402 */ 372 403 public String toCondensedFormat(boolean MetaDataOnly) -
trunk/src/atmsdriver/model/LoopDetector.java
r186 r190 20 20 final public int loopID; 21 21 final public String loopLocation; 22 final public int laneNum;23 22 24 23 /* dynamic data */ 25 24 public int vol; 26 25 public float occ; 27 private int spd;28 26 29 27 /** … … 34 32 * @param laneNum 35 33 */ 36 public LoopDetector(int loopID, String loopLocation , int laneNum)34 public LoopDetector(int loopID, String loopLocation) 37 35 { 38 36 /* Set static data */ 39 37 this.loopID = loopID; 40 38 this.loopLocation = loopLocation; 41 this.laneNum = laneNum;42 39 43 40 /* Init dynamic data */ 44 41 this.vol = 0; 45 this.spd = 0;46 42 this.occ = 0; 47 43 } … … 54 50 LOOP_ID("Loop_ID"), 55 51 LOOP_LOCATION("Loop_Location"), 56 LANE_NUM("Lane_Num"),57 52 VOL("Vol"), 58 SPD("Spd"),59 53 OCC("Occ"), 60 54 LOOP("Loop"); … … 88 82 build.append(Integer.toString(this.loopID)); 89 83 build.append(" "); 90 build.append(Integer.toString(this.laneNum));91 build.append(" ");92 84 if(!MetaDataOnly) 93 85 { … … 96 88 build.append(" "); 97 89 build.append(this.vol); 98 build.append(" ");99 build.append(this.spd);100 90 } 101 91 else … … 113 103 * @param spd speed 114 104 */ 115 public void updateLoop(int vol, float occ , int spd)105 public void updateLoop(int vol, float occ) 116 106 { 117 107 this.vol = vol; 118 108 this.occ = occ; 119 this.spd = spd;120 109 } 121 110 … … 140 129 loopElement.appendChild(loopLocElement); 141 130 142 Element laneNumElement = theDoc.createElement(XML_TAGS.LANE_NUM.tag);143 laneNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.laneNum)));144 loopElement.appendChild(laneNumElement);145 146 131 Element volElement = theDoc.createElement(XML_TAGS.VOL.tag); 147 132 volElement.appendChild(theDoc.createTextNode(String.valueOf(this.vol))); … … 151 136 occElement.appendChild(theDoc.createTextNode(String.valueOf(this.occ))); 152 137 loopElement.appendChild(occElement); 153 154 Element spdElement = theDoc.createElement(XML_TAGS.SPD.tag);155 spdElement.appendChild(theDoc.createTextNode(String.valueOf(this.spd)));156 loopElement.appendChild(spdElement);157 138 } 158 139 -
trunk/src/atmsdriver/model/Station.java
r186 r190 22 22 23 23 /* Static Station meta data */ 24 final public int line Num;24 final public int lineID; 25 25 final public int ldsID; // double check 26 26 final public int drop; … … 36 36 37 37 /* Constructor */ 38 public Station(int line Num, int ldsID, int drop,38 public Station(int lineID, int ldsID, int drop, 39 39 String location, List<LoopDetector> loops, int hwy, 40 40 DIRECTION direction, double postmile) 41 41 { 42 this.line Num = lineNum;42 this.lineID = lineID; 43 43 this.ldsID = ldsID; 44 44 this.drop = drop; … … 186 186 { 187 187 // UPDATE LOOP WITH VALUES 188 int speed = 0; 189 loop.updateLoop(dotColor.volume(), dotColor.occupancy(), speed); 188 loop.updateLoop(dotColor.volume(), dotColor.occupancy()); 190 189 } 191 190 } … … 253 252 254 253 Element lineNumElement = theDoc.createElement(XML_TAGS.LINE_NUM.tag); 255 lineNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.line Num)));254 lineNumElement.appendChild(theDoc.createTextNode(String.valueOf(this.lineID))); 256 255 stationElement.appendChild(lineNumElement); 257 256
Note: See TracChangeset
for help on using the changeset viewer.
