Changeset 128 in tmcsimulator
- Timestamp:
- 10/17/2017 09:11:22 AM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 4 edited
-
atmsdriver/ATMSDriver.java (modified) (2 diffs)
-
atmsdriver/ConsoleDriver.java (modified) (2 diffs)
-
atmsdriver/model/Highways.java (modified) (3 diffs)
-
tmcsim/client/ATMSBatchDriver.java (modified) (5 diffs)
-
tmcsim/client/ATMSBatchViewer.form (added)
-
tmcsim/client/ATMSBatchViewer.java (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/ATMSDriver.java
r103 r128 6 6 import java.util.logging.Level; 7 7 import java.util.logging.Logger; 8 import tmcsim.common.SimulationException; 8 9 9 10 /** … … 73 74 .getProperty(PROPERTIES.EXCHANGE_FILE_NAME.name)); 74 75 75 highways.writeToFEP(); 76 try { 77 highways.writeToFEP(); 78 } catch (SimulationException ex) { 79 System.out.println("Skipping writeToFEP..."); 80 } 76 81 // Update if exchangeInfo is recieved 77 82 if (exInfo != null) { -
trunk/src/atmsdriver/ConsoleDriver.java
r127 r128 13 13 import java.util.logging.Level; 14 14 import java.util.logging.Logger; 15 import tmcsim.common.SimulationException; 15 16 16 17 /** … … 198 199 } 199 200 System.out.println(""); 200 highways.writeToFEP(); 201 try { 202 highways.writeToFEP(); 203 } catch (SimulationException ex) { 204 System.out.println("Skipping writeToFEP..."); 205 } 201 206 } 202 207 -
trunk/src/atmsdriver/model/Highways.java
r127 r128 27 27 import org.w3c.dom.Document; 28 28 import org.w3c.dom.Element; 29 import tmcsim.common.SimulationException; 29 30 30 31 /** The Highways class aggregates all Highway instances within a geographic … … 209 210 */ 210 211 211 public void writeToFEP() {212 public void writeToFEP() throws SimulationException { 212 213 try { 213 214 Socket sock = new Socket(FEPHostName /*"192.168.251.130"*/, 8080); … … 218 219 Logger.getLogger(Highways.class.getName()).log(Level.SEVERE, null, ex); 219 220 System.out.println("Highway Model failed writing to FEPSim."); 221 throw new SimulationException(SimulationException.BINDING); 220 222 } 221 223 } -
trunk/src/tmcsim/client/ATMSBatchDriver.java
r127 r128 114 114 /** Instance of ConsoleDriver that contains the highway model */ 115 115 private ConsoleDriver console; 116 116 117 /** GUI for this driver */ 118 private ATMSBatchViewer theView; 119 117 120 /** 118 121 * Constructor. Initialize data from parsed properties file. Create a socket … … 142 145 // READ THE BATCH FILE OF COMMANDS and put in a queue 143 146 readBatchFile(); 147 // Launch the display 148 theView = new ATMSBatchViewer(); 149 theView.setVisible(true); 150 theView.update("0:00", eventQueue); 144 151 // Create a timer that fetches the simulation time every second. 145 152 Timer timer = new Timer(ONE_SECOND, new ActionListener() … … 162 169 System.exit(-1); 163 170 } 164 System.out.println("Current clock: " + currentClock);171 //System.out.println("Current clock: " + currentClock); 165 172 } catch (RemoteException ex) 166 173 { … … 181 188 eventQueue.remove(); 182 189 } 183 System.out.println("Next event will be launched at: " + formatter.format(eventTime)); 190 //System.out.println("Next event will be launched at: " + formatter.format(eventTime)); 191 theView.update(currentClock, eventQueue); 184 192 // Check the queue of events to see if the first 185 193 // item should be launched. IF so, … … 381 389 while (true) 382 390 { 383 // Write the highway network status to the FEP Simulator 384 highways.writeToFEP(); 391 try { 392 // Write the highway network status to the FEP Simulator 393 highways.writeToFEP(); 394 } catch (SimulationException ex) 395 { 396 System.out.println("Skipping writeToFEP..."); 397 } 385 398 386 399 // Wait for FEP Sim to process the data we just sent
Note: See TracChangeset
for help on using the changeset viewer.
