Changeset 128 in tmcsimulator for trunk/src/tmcsim/client/ATMSBatchDriver.java


Ignore:
Timestamp:
10/17/2017 09:11:22 AM (9 years ago)
Author:
jdalbey
Message:

ATMSBatchDriver.java Added a GUI to display event queue. Highways.java modified to throw an exception when writeToFEP can't connect to FEP_Sim.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/client/ATMSBatchDriver.java

    r127 r128  
    114114    /** Instance of ConsoleDriver that contains the highway model */ 
    115115    private ConsoleDriver console; 
    116  
     116     
     117    /** GUI for this driver */ 
     118    private ATMSBatchViewer theView; 
     119     
    117120    /** 
    118121     * Constructor. Initialize data from parsed properties file. Create a socket 
     
    142145        // READ THE BATCH FILE OF COMMANDS and put in a queue 
    143146        readBatchFile(); 
     147        // Launch the display 
     148        theView = new ATMSBatchViewer(); 
     149        theView.setVisible(true); 
     150        theView.update("0:00", eventQueue);         
    144151        // Create a timer that fetches the simulation time every second. 
    145152        Timer timer = new Timer(ONE_SECOND, new ActionListener() 
     
    162169                        System.exit(-1); 
    163170                    }                     
    164                     System.out.println("Current clock: " + currentClock); 
     171                    //System.out.println("Current clock: " + currentClock); 
    165172                } catch (RemoteException ex) 
    166173                { 
     
    181188                        eventQueue.remove(); 
    182189                    } 
    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); 
    184192                    // Check the queue of events to see if the first 
    185193                    // item should be launched.  IF so,  
     
    381389            while (true) 
    382390            { 
    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                } 
    385398 
    386399                // Wait for FEP Sim to process the data we just sent 
Note: See TracChangeset for help on using the changeset viewer.