コード例 #1
0
  public static void runEventsProcessing(Properties properties) {
    boolean isTransit = false;
    MutableScenario scenario =
        (MutableScenario)
            ScenarioUtils.createScenario(
                ConfigUtils.loadConfig(properties.get("configFile").toString()));
    scenario.getConfig().transit().setUseTransit(true);
    if (!properties.get("transitScheduleFile").toString().equals("")) {
      new TransitScheduleReader(scenario)
          .readFile(properties.get("transitScheduleFile").toString());
      isTransit = true;
    }
    new MatsimNetworkReader(scenario).readFile(properties.get("networkFile").toString());

    EventsManager eventsManager = EventsUtils.createEventsManager();
    EventsToTravelDiaries test;
    // if(linkTrafficComponent.isSelected()){
    // test = new EventsToPlanElements(
    // scenario.getTransitSchedule(), scenario.getNetwork(),
    // scenario.getConfig(),new File(postgresPropertiesComponent.getText())
    // ,tableSuffixComponent.getText());
    // }else{
    if (isTransit) {
      test =
          new EventsToTravelDiaries(
              scenario.getTransitSchedule(), scenario.getNetwork(), scenario.getConfig());

    } else {
      test = new EventsToTravelDiaries(scenario);
    }
    // }
    eventsManager.addHandler(test);
    new MatsimEventsReader(eventsManager).readFile(properties.get("eventsFile").toString());

    try {

      test.writeSimulationResultsToTabSeparated(
          properties.get("outputPath").toString(), properties.get("tableSuffix").toString());

    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    System.out.println("Number of stuck vehicles/passengers: " + test.getStuck());
  }
コード例 #2
0
 public static void main(String[] args) throws IOException {
   Properties properties = new Properties();
   properties.load(new FileInputStream(new File(args[0])));
   EventsToTravelDiaries.runEventsProcessing(properties);
 }