Changeset 1089

Show
Ignore:
Timestamp:
06/11/10 23:31:59 (14 years ago)
Author:
ondrak
Message:

Added option to set simulation length in number of cycles

Location:
applications/doprava
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • applications/doprava/Zlicin.cfg

    r1075 r1089  
    6767        stop_time = "00:05:00"; 
    6868         
     69        // Simulation length in number of cycles (one cycle = 90 s) 
     70        // If present, overwrites stop_time. Ensures corrent termination of simulation 
     71        // Example: 1 hour = 40 cycles, 6 hours = 240 cycles, 24 hours = 960  
     72        stop_cycle=240; 
     73         
    6974}; 
    7075 
  • applications/doprava/Zlicingw.cfg

    r1081 r1089  
    5454        // simulation in our case starts always at 00:00:00. Default simulation 
    5555        // length is 24 hours (24:00:00). 
    56         stop_time = "00:15:00"; 
     56        stop_time = "00:05:00"; 
     57         
     58        // Simulation length in number of cycles (one cycle = 90 s) 
     59        // If present, overwrites stop_time. Ensures corrent termination of simulation 
     60        // Example: 1 hour = 40 cycles, 6 hours = 240 cycles, 24 hours = 960  
     61        stop_cycle=5; 
    5762         
    5863}; 
  • applications/doprava/aimsun_bdm/aimsun_ds.cpp

    r1032 r1089  
    136136        UI::get ( stopTime, cfg, "stop_time" ); 
    137137 
     138        /* Try to load number of stop cycle from configuration,  
     139           if the value is present, stopTime is overwritten */ 
     140        if (UI::get ( stopCycle, cfg, "stop_cycle" )) { 
     141                //TODO I don't know if I can read length of step somewhere, so hardwired now 
     142                int totalTime=stopCycle*90; 
     143                 
     144                int hours = totalTime / 3600; 
     145                int minutes = ( totalTime % 3600 )/ 60; 
     146                int seconds = totalTime % 60;  
     147                 
     148                stopTime=int_to_string(hours)+":"+int_to_string(minutes)+":"+int_to_string(seconds); 
     149        } 
     150        else { 
     151                stopCycle=960; 
     152        } 
     153 
    138154        /* Query the configuration file for the name of the file containsing 
    139155           vehicle entrances. */ 
     
    663679        vgs_get_last_stats ( &sections_stats ); 
    664680} 
     681 
     682string AimsunDS::int_to_string(int const i) 
     683{ 
     684        std::stringstream ss; 
     685        ss << i; 
     686        if (i<10) 
     687                return "0" + ss.str(); 
     688        else 
     689                return ss.str(); 
     690} 
     691 
  • applications/doprava/aimsun_bdm/aimsun_ds.h

    r1027 r1089  
    4545         
    4646        //! number of steps 
    47         int max_length() {return 960;} 
     47        int max_length() {return stopCycle;} 
     48 
     49        //! converts i to string, if i has only one digit, adds 0 before it 
     50        string int_to_string(int const i); 
    4851 
    4952        virtual void from_setting ( const Setting &cfg ); 
     
    5558        string entranceFileName; 
    5659         
    57         //! Stip time of the simulation 
     60        //! Stop time of the simulation 
    5861        string stopTime; 
     62 
     63        //! Number of cycles of the simulation 
     64        int stopCycle; 
    5965         
    6066        void AimsunDS::initVGS (