Changeset 407 in tmcsimulator for trunk/src/tmcsim


Ignore:
Timestamp:
05/16/2019 01:02:37 PM (7 years ago)
Author:
jdalbey
Message:

Fix for #155 to make simulation time filename configurable.

Location:
trunk/src/tmcsim
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/application.properties

    r398 r407  
    1 #Thu, 25 Apr 2019 16:57:59 -0700 
     1#Thu, 16 May 2019 14:30:48 -0700 
    22 
    3 Application.revision=397 
     3Application.revision=406 
    44 
    5 Application.buildnumber=137 
     5Application.buildnumber=138 
  • trunk/src/tmcsim/cadsimulator/CADServer.java

    r382 r407  
    129129         * Class name of desired user interface. 
    130130         */ 
    131         USER_INTERFACE("UserInterface"); 
     131        USER_INTERFACE("UserInterface"), 
     132        /** 
     133         *  Filepath to which is written the simulation time. 
     134         */ 
     135        ELAPSED_TIME_FILE("ElapsedTimeFile"); 
     136         
    132137        public String name; 
    133138 
     
    240245            theModel = new CADSimulatorState(); 
    241246            theModel.addObserver(theViewer); 
    242  
    243             theCoordinator = new Coordinator(theModel); 
     247            /** Load the simulation time filename from properties */ 
     248            String simTimeFilename = 
     249                    cadServerProperties.getProperty( 
     250                    CAD_PROPERTIES.ELAPSED_TIME_FILE.name); 
     251            if (simTimeFilename == null) 
     252            { 
     253                cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     254                        propertiesFile + " missing property for " + CAD_PROPERTIES.ELAPSED_TIME_FILE.name); 
     255                throw new SimulationException(SimulationException.PROPERTY_MISSING_ERROR); 
     256            } 
     257            theCoordinator = new Coordinator(theModel, simTimeFilename); 
    244258 
    245259            startRegistry(Integer.parseInt( 
  • trunk/src/tmcsim/cadsimulator/Coordinator.java

    r376 r407  
    3131import tmcsim.cadsimulator.managers.ParamicsSimulationManager; 
    3232import tmcsim.cadsimulator.managers.SimulationClockManager; 
     33import tmcsim.cadsimulator.managers.TrafficModelManager; 
     34import static tmcsim.cadsimulator.managers.TrafficModelManager.loadProperties; 
    3335import tmcsim.cadsimulator.viewer.model.CADSimulatorState; 
    3436import tmcsim.client.cadclientgui.CardfileReader; 
     
    9698     * The name of the file where the simulation clock time is written 
    9799     */ 
    98     public static final String kSimClockFilename = "webapps" +  
     100    private String kSimClockFilename = "webapps" +  
    99101            System.getProperty("file.separator") + "dynamicdata" +  
    100             System.getProperty("file.separator") + "sim_elapsedtime.json"; 
     102            System.getProperty("file.separator") + "sim_elapsedtime.json";         
    101103    /** 
    102104     * Error logger. 
     
    119121    private static CardfileData cardfileData; 
    120122    private CADSimulatorState cadModel; 
    121  
     123     
    122124    /** 
    123125     * Constructor. Call UnicastRemoteObject constructor and call 
     
    126128     * @throws RemoteException 
    127129     */ 
    128     public Coordinator(CADSimulatorState model) throws RemoteException 
     130    public Coordinator(CADSimulatorState model, String simTimeFilename) throws RemoteException 
    129131    { 
    130132        super(); 
    131133        cadModel = model; 
     134        kSimClockFilename = simTimeFilename; 
    132135        clientList = new LinkedList<CADClientInterface>(); 
    133136        cadData = new CADData(); 
  • trunk/src/tmcsim/cadsimulator/managers/TrafficModelManager.java

    r345 r407  
    6464        EVENTS_FILE("Events_File"), 
    6565        OUTPUT_DEST("Output_Destination"), 
    66         JSON_PATH("Json_Path"); 
     66        HIGHWAY_STATUS_FILE("Highway_Status_File"); 
    6767         
    6868        public String name; 
     
    123123        { 
    124124            props = loadProperties(propertiesFile); 
    125             jsonPath = props.getProperty(PROPERTIES.JSON_PATH.name); 
     125            jsonPath = props.getProperty(PROPERTIES.HIGHWAY_STATUS_FILE.name); 
    126126            //logger.logp(Level.INFO, "Traffic Manager", "Constructor",  
    127127            //        "Highway network json output: " + jsonPath); 
Note: See TracChangeset for help on using the changeset viewer.