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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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