- Timestamp:
- 02/25/2019 04:36:04 PM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
-
atmsdriver/model/Highways.java (modified) (10 diffs)
-
atmsdriver/model/PostmileCoords.java (modified) (1 diff)
-
atmsdriver/model/Station.java (modified) (2 diffs)
-
tmcsim/application.properties (modified) (1 diff)
-
tmcsim/utilities/BuildHighwayFile.java (modified) (3 diffs)
-
tmcsim/utilities/VehicleDetectionStation.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Highways.java
r266 r274 63 63 // load FEP Lines 64 64 lines = loadLines(highwaysMapFileName); 65 // configure and load highways66 this.highways = configureHighways();65 // build highways data structure 66 this.highways = buildHighways(); 67 67 68 68 // write to FEP host and port number … … 71 71 } 72 72 73 private ArrayList<Highway> configureHighways()74 { 75 System.out.println(" Loading highways...");73 private ArrayList<Highway> buildHighways() 74 { 75 System.out.println("Building highways..."); 76 76 // The list of highways to return 77 77 ArrayList<Highway> highways = new ArrayList<Highway>(); … … 89 89 { 90 90 Integer hwyNum = station.routeNumber; 91 92 91 // if the map does not contain an entry for the highway, create 93 92 // a new entry (key/value pair) for the highway and instantiate … … 116 115 ArrayList<Station> hwyStations = highwayMap.get(hwyKey); 117 116 Collections.sort(hwyStations); 118 System.out.println("Loaded highway " + hwyKey + "..."); 117 System.out.println("Loaded highway " + hwyKey + " with " + 118 hwyStations.size() + " stations."); 119 119 highways.add(new Highway(hwyKey, 120 120 hwyStations)); … … 159 159 startPost = postmile; 160 160 endPost = postmile + range; 161 161 //TODO: Catch NPE exception for situation when the events file 162 // specifies a highway that doesn't exist in the network. 163 // Also the case where a desired postmile to color isn't in 164 // the network. 162 165 // iterate through the stations, if within the specified highway 163 166 // stretch, update the station by direction and apply dot color … … 222 225 223 226 /** 224 * Load sa single FEP Line from the highways map file.227 * Load all the stations for a single FEP Line from the highways map file. 225 228 * 226 229 * @param sc scanner at the current FEPLine line … … 348 351 // Print the number of bytes the highways data message contains 349 352 System.out.println("Highways sending " + this.toCondensedFormat(false).toCharArray().length + 1 + "bytes to FEPSIM."); 350 353 String outMsg = this.toCondensedFormat(false); 351 354 // Write the highways data over the socket 352 out.println( this.toCondensedFormat(false));355 out.println(outMsg); 353 356 354 357 // close the socket … … 371 374 * and does include the string location names. If MetaDataOnly is false, 372 375 * dynamic loop values are included, and unnecessary information like string 373 * location values are included.376 * location values are not included. 374 377 * 375 378 * The FEPSimulator takes in the toCondensedFormat() output, with a MetaDataOnly … … 526 529 public String toJson() 527 530 { 531 // TODO: move loading this file to init method so it doesn't get 532 // called every time. 528 533 PostmileCoords pmList = new PostmileCoords(); 529 534 FileInputStream fis = null; … … 545 550 for (Highway hwy: highways) 546 551 { 547 // For json output we don't care about listing all the stations548 // in order by direction because we are just outputting points not lines.552 // Consider each route direction 553 for (DIRECTION dir: DIRECTION.values()) 549 554 { 550 555 // Examine every station on this highway and direction -
trunk/src/atmsdriver/model/PostmileCoords.java
r269 r274 119 119 public boolean nameEquals(String target) 120 120 { 121 // remove .0 for comparing strings 122 if (target.endsWith(".0")) 123 { 124 String truncTarget = target.substring(0,target.length()-2); 125 return this.name.equals(truncTarget); 126 } 121 127 return this.name.equals(target); 122 128 } -
trunk/src/atmsdriver/model/Station.java
r237 r274 208 208 { 209 209 /* For now just use the color of the first lane. 210 * TODO: Average the color in allthe lanes for the given direction */210 * TODO: Average the color in ALL the lanes for the given direction */ 211 211 212 212 String laneDir = ""; … … 219 219 laneDir = "OS"; 220 220 } 221 // Examine all the lanes in a givendirection221 // Search lanes to find specified direction 222 222 for (LoopDetector loop : loops) 223 223 { 224 224 if (loop.loopLocation.substring(0,2).equals(laneDir)) 225 225 { 226 // Return color according to loop volume 226 // Return color according to loop volume of first matching lane 227 227 if (loop.vol == 1) 228 228 { -
trunk/src/tmcsim/application.properties
r269 r274 1 # Thu, 21 Feb 2019 15:22:00-08001 #Mon, 25 Feb 2019 17:13:55 -0800 2 2 3 Application.revision=2 683 Application.revision=273 4 4 5 Application.buildnumber=9 55 Application.buildnumber=97 -
trunk/src/tmcsim/utilities/BuildHighwayFile.java
r272 r274 1 /*2 * To change this license header, choose License Headers in Project Properties.3 * To change this template file, choose Tools | Templates4 * and open the template in the editor.5 */6 1 package tmcsim.utilities; 7 2 … … 30 25 * 3. LDS file that has the fep line number for each LDS. 31 26 * Output: 1. The highway map file that lists VDS info and the lanes it governs. 32 * 2. A slightly reformatted loop file. 27 * 2. A slightly reformatted loop file. (Not sure what this is for.) 33 28 * @author jdalbey, jtorres 34 29 */ … … 157 152 else 158 153 { 159 if (shortLoc.equals("ML") && !missingVDS.contains(vdsID)) 154 boolean desiredType = shortLoc.equals("ML") || shortLoc.equals("OS"); 155 if (desiredType && !missingVDS.contains(vdsID)) 160 156 { 161 157 System.out.println("createLaneLookup(): vdsID: "+vdsID+ 162 " of type MLnot found. "+ String.format("%3s %s %5s",fwy,dir,postmile));158 " of type "+shortLoc+" not found. "+ String.format("%3s %s %5s",fwy,dir,postmile)); 163 159 missingVDS.add(vdsID); 164 160 } -
trunk/src/tmcsim/utilities/VehicleDetectionStation.java
r272 r274 8 8 9 9 /** 10 * Represent a single VDS. 10 * Represent a single VDS, "a logical grouping of detectors" at a particular 11 * location in one direction. 11 12 * @author jdalbey 12 13 */ … … 33 34 lineScanner.next(); // skip City 34 35 String raw_pm = lineScanner.next().trim(); 35 if (raw_pm.startsWith("R")) 36 // remove any postmile prefix, if it exists. 37 if (Character.isAlphabetic(raw_pm.charAt(0))) 36 38 { 37 39 raw_pm = raw_pm.substring(1);
Note: See TracChangeset
for help on using the changeset viewer.
