Changeset 193 in tmcsimulator


Ignore:
Timestamp:
10/30/2017 02:10:10 PM (9 years ago)
Author:
jdalbey
Message:

TrafficModelManager?: Added extra config property to allow for specifying output destination (console or FEP).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/cadsimulator/managers/TrafficModelManager.java

    r188 r193  
    7171         * 
    7272         */ 
    73         EVENTS_FILE("Events_File"); 
    74  
     73        EVENTS_FILE("Events_File"), 
     74        OUTPUT_DEST("Output_Destination"); 
     75         
    7576        public String name; 
    7677 
     
    198199        timer.start(); 
    199200 
    200         // Start the FEP thread (to update ATMS every 30 sec). (See class def below) 
    201         Thread wtfep = new WriteToFEPThread(); 
    202         wtfep.start(); 
     201        if (atmsProperties.getProperty(PROPERTIES.OUTPUT_DEST.name).equals("FEP")) 
     202        { 
     203            // Start the FEP thread (to update ATMS every 30 sec). (See class def below) 
     204            Thread wtfep = new WriteToFEPThread(); 
     205            wtfep.start(); 
     206        } 
     207        else 
     208        { 
     209            Thread wtConsole = new WriteToConsoleThread(); 
     210            wtConsole.start(); 
     211        } 
    203212         
    204213    } 
     
    239248        if (atmsProperties.getProperty(PROPERTIES.HIGHWAYS_MAP_FILE.name) == null 
    240249                || atmsProperties.getProperty(PROPERTIES.FEPSIM_IP_ADDR.name) == null 
    241                 || atmsProperties.getProperty(PROPERTIES.EVENTS_FILE.name) == null) 
     250                || atmsProperties.getProperty(PROPERTIES.EVENTS_FILE.name) == null 
     251                || atmsProperties.getProperty(PROPERTIES.OUTPUT_DEST.name) == null) 
    242252        { 
    243253            atmsLogger.logp(Level.SEVERE, "TrafficModelManager", 
     
    388398 
    389399    } 
     400    class WriteToConsoleThread extends Thread 
     401    { 
     402 
     403        public void run() 
     404        { 
     405            System.out.println("WriteToConsole Thread starting."); 
     406            // Run indefinitely 
     407            while (true) 
     408            { 
     409                 // Write the highway network status to the FEP Simulator 
     410                 System.out.println(highways.toString()); 
     411 
     412                // Wait for FEP Sim to process the data we just sent 
     413                try 
     414                { 
     415                    Thread.sleep(1000); 
     416                } 
     417                catch (InterruptedException ie) 
     418                { 
     419                    ie.printStackTrace(); 
     420                } 
     421            } 
     422 
     423        } 
     424    } 
     425     
    390426    class WriteToFEPThread extends Thread 
    391427    { 
Note: See TracChangeset for help on using the changeset viewer.