- Timestamp:
- 03/23/2019 05:40:52 PM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
-
atmsdriver/model/Highway.java (modified) (3 diffs)
-
atmsdriver/model/Highways.java (modified) (6 diffs)
-
atmsdriver/model/LoopDetector.java (modified) (1 diff)
-
atmsdriver/model/Station.java (modified) (7 diffs)
-
atmsdriver/trafficeventseditor/TrafficEventsEditor.java (modified) (2 diffs)
-
tmcsim/application.properties (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Highway.java
r237 r343 3 3 import atmsdriver.model.Station.DIRECTION; 4 4 import java.util.ArrayList; 5 import java.util.HashSet; 5 6 import java.util.List; 7 import java.util.Set; 8 import java.util.SortedSet; 9 import java.util.TreeSet; 6 10 7 11 /** … … 18 22 /** The ordered list of stations (lane detector stations) on this highway */ 19 23 public final List<Station> stations; 20 24 /** The directions for this highway, either N/S or E/W */ 25 public final Set<DIRECTION> availDirs = new TreeSet<DIRECTION>(); 26 21 27 /** Construct a highway 22 28 * … … 28 34 this.routeNumber = routeNumber; 29 35 this.stations = stations; 30 } 31 32 /** 33 * 34 */ 35 public List<DIRECTION> getDirections() 36 { 37 // Get available directions for route 38 ArrayList<DIRECTION> availDirs = new ArrayList<>(); 36 // Get available directions for route 37 if (stations != null) 38 { 39 39 for(Station stn : stations) 40 40 { 41 if(!availDirs.contains(stn.direction)) 42 { 43 availDirs.add(stn.direction); 44 } 41 availDirs.add(stn.direction); 45 42 } 46 return availDirs;43 } 47 44 } 48 45 -
trunk/src/atmsdriver/model/Highways.java
r306 r343 43 43 * FEP Simulator. 44 44 * 45 * Currently, there is no driving logic within the highways class. It is only46 * done through an instance of the ConsoleDriver.java class. Eventually, it will47 * receive incident data (from exchange.xml or better yet, directly from the48 * TMCSimulator itself) and drive the highways using resident logic.49 45 * 50 46 * @author John A. Torres … … 124 120 } 125 121 122 /** Search for a station with the given attributes 123 * 124 * @param routeNumber 125 * @param direction 126 * @param postmile 127 * @return the desired station, or null if not found. 128 */ 129 public Station findStation(Integer routeNumber, Station.DIRECTION direction, 130 Double postmile) 131 { 132 // Get the highway by route number 133 Highway highway = getHighwayByRouteNumber(routeNumber); 134 if (highway == null) 135 { 136 Logger.getLogger(Highways.class.getName()).log(Level.SEVERE, 137 "Highway "+routeNumber+" not found in findStation()", ""); 138 return null; 139 } 140 //Search the stations on this highway for a match 141 for (Station station : highway.stations) 142 { 143 if (station.matches(direction, postmile)) 144 { 145 return station; 146 } 147 } 148 return null; 149 } 126 150 /** 127 151 * Applies specified color to the specified highway stretch. Route number … … 158 182 // postmiles increase from s to n and w to e 159 183 // if the direction is south or west 160 if (direction.equals(Station.DIRECTION. SOUTH) || direction.equals(Station.DIRECTION.WEST))184 if (direction.equals(Station.DIRECTION.NORTH) || direction.equals(Station.DIRECTION.EAST)) 161 185 { 162 186 // add range value to startPost to get … … 440 464 /** 441 465 * Returns the Highways model data in XML format. 442 * 466 * Probably obsolete, since we aren't using exchange.xml any longer. 443 467 * @return highways data in XML format 444 468 */ … … 507 531 { 508 532 // Consider each route direction 509 for (DIRECTION dir: DIRECTION.values())533 for (DIRECTION dir: hwy.availDirs) 510 534 { 511 535 String rowLabel = ""+String.format("%3s ",hwy.routeNumber)+dir.getLetter()+' '; … … 514 538 for (Station stat: hwy.stations) 515 539 { 540 if (stat.direction.equals(dir)) 541 { 516 542 //lineout.append("" + dir.getLetter() + stat.postmile); 517 543 lineout.append(stat.getColor()); 518 544 //lineout.append(" "); 545 } 546 else 547 { 548 lineout.append("."); 549 } 519 550 } 520 551 // See if there were stations for this direction -
trunk/src/atmsdriver/model/LoopDetector.java
r242 r343 94 94 { 95 95 build.append(this.loopLocationID); 96 build.append(" "); 96 97 } 97 98 build.append(this.loopLocation); -
trunk/src/atmsdriver/model/Station.java
r285 r343 8 8 9 9 /** 10 * A Station ( LDS or LoopDetector Station) represents a group of lane detectors11 * across all lanes at a particular point on a highway. A station is identified10 * A Station (VDS or Vehicle Detector Station) represents a group of lane detectors 11 * across all lanes in one direction at a particular point on a highway. A station is identified 12 12 * by its highway number and postmile. A station has an associated direction 13 13 * used to establish which direction is Main and which is Opposite. The MLTotVol 14 14 * and OppTotVol for a station can be dynamically updated. A station has other 15 * attributes: lineNum, ldsID, drop, and location which are used by the FEP. A15 * attributes: lineNum, vdsID, drop, and location which are used by the FEP. A 16 16 * station can be compared to other stations by its postmile. 17 17 * 18 * @author John A. Torres 19 * @version 9/10/2017 18 * @author John A. Torres, jdalbey 19 * @version 9/10/2017, 3/22/2019 20 20 */ 21 public class Station implements Comparable21 public final class Station implements Comparable 22 22 { 23 23 24 24 /* Static Station meta data */ 25 25 final public int lineID; 26 final public int ldsID; // double check26 final public int vdsID; // double check 27 27 final public int drop; 28 28 final public String location; … … 37 37 38 38 /* Constructor */ 39 public Station(int lineID, int ldsID, int drop,39 public Station(int lineID, int vdsID, int drop, 40 40 String location, List<LoopDetector> loops, int hwy, 41 41 DIRECTION direction, double postmile) 42 42 { 43 43 this.lineID = lineID; 44 this. ldsID = ldsID;44 this.vdsID = vdsID; 45 45 this.drop = drop; 46 46 this.loops = loops; … … 109 109 { 110 110 StringBuilder build = new StringBuilder(); 111 build.append(Integer.toString(this. ldsID));111 build.append(Integer.toString(this.vdsID)); 112 112 build.append(" "); 113 113 build.append(Integer.toString(this.drop)); … … 170 170 171 171 /** 172 * See if this station matches the specified attributes. 173 * @param dir 174 * @param postmile 175 * @return true if this station's attributes match the given ones. 176 */ 177 public boolean matches(DIRECTION dir, double postmile) 178 { 179 double val = this.postmile - postmile; 180 return (Math.abs(val) < 0.01) && this.direction.equals(dir); 181 } 182 /** 172 183 * Determine which lane fields to update based on given direction and update 173 184 * all the loop detectors with the given color. … … 178 189 public void updateByDirection(DIRECTION direction, DOTCOLOR dotColor) 179 190 { 180 String laneDir = "OS";191 // Is this station going in the desired direction? 181 192 if (direction.equals(this.direction)) 182 193 { 183 laneDir = "ML"; 184 } 185 outputUpdateMessage(dotColor, laneDir); 186 187 for (LoopDetector loop : loops) 188 { 189 // THIS DECISION ISN'T NEEDED after JD's BuildHighwayFile pgm 190 // creates a highway map based on VDS instead of Controller (LDS). 191 // if (loop.loopLocation.startsWith(laneDir)) 192 // { 193 // UPDATE LOOP WITH VALUES 194 loop.updateLoop(dotColor.volume(), dotColor.occupancy()); 195 // } 196 } 197 198 this.MLTotVol = getMLTotVol(); 199 this.OppTotVol = getOPPTotVol(); 200 } 201 194 outputUpdateMessage(dotColor, direction.toString()); 195 196 for (LoopDetector loop : loops) 197 { 198 // THIS DECISION ISN'T NEEDED after JD's BuildHighwayFile pgm 199 // creates a highway map based on VDS instead of Controller (LDS). 200 // if (loop.loopLocation.startsWith(laneDir)) 201 // { 202 // UPDATE LOOP WITH VALUES 203 loop.updateLoop(dotColor.volume(), dotColor.occupancy()); 204 // } 205 } 206 207 this.MLTotVol = getMLTotVol(); 208 this.OppTotVol = getOPPTotVol(); 209 } 210 } 202 211 /** 203 212 * Return the color for the lanes in a given direction. … … 316 325 317 326 Element ldsIDElement = theDoc.createElement(XML_TAGS.LDS_ID.tag); 318 ldsIDElement.appendChild(theDoc.createTextNode(String.valueOf(this. ldsID)));327 ldsIDElement.appendChild(theDoc.createTextNode(String.valueOf(this.vdsID))); 319 328 stationElement.appendChild(ldsIDElement); 320 329 … … 422 431 public String toString() 423 432 { 424 return Integer.toString(this. ldsID);433 return Integer.toString(this.vdsID)+this.getColor(); 425 434 } 426 435 } -
trunk/src/atmsdriver/trafficeventseditor/TrafficEventsEditor.java
r257 r343 90 90 TrafficLaneEvent currEvent = currFrame.events.get(i); 91 91 data[i][0] = Integer.toString(currEvent.routeNum); 92 data[i][1] = Integer.toString(currEvent.station. ldsID);92 data[i][1] = Integer.toString(currEvent.station.vdsID); 93 93 data[i][2] = Double.toString(currEvent.station.postmile); 94 94 data[i][3] = Integer.toString(currEvent.loopDetector.loopID); … … 285 285 for(int i = 0; i < rows; i++) 286 286 { 287 data[i][0] = Integer.toString(hwy.stations.get(i). ldsID);287 data[i][0] = Integer.toString(hwy.stations.get(i).vdsID); 288 288 data[i][1] = hwy.stations.get(i).direction.getLetter(); 289 289 data[i][2] = Double.toString(hwy.stations.get(i).postmile); -
trunk/src/tmcsim/application.properties
r340 r343 1 #Sat, 23 Mar 2019 09:47:19-07001 #Sat, 23 Mar 2019 19:09:36 -0700 2 2 3 Application.revision=3 393 Application.revision=342 4 4 5 5 Application.buildnumber=108
Note: See TracChangeset
for help on using the changeset viewer.
