@Override
  public void handleEvent(final VehicleDepartsAtFacilityEvent event) {
    Id vehId = event.getVehicleId();
    Id facId = event.getFacilityId();

    // -----------------------occupancy--------------------------------
    this.vehStops.remove(vehId);
    int[] occupancyAtStop = this.occupancies.get(facId);
    if (occupancyAtStop == null) { // no previous departure from this stop, therefore no occupancy
      // record yet. Create this:
      occupancyAtStop = new int[this.maxSlotIndex + 1];
      this.occupancies.put(facId, occupancyAtStop);
    }

    Integer noPassengersInVeh = this.vehPassengers.get(vehId);

    if (noPassengersInVeh != null) {
      occupancyAtStop[this.getTimeSlotIndex(event.getTime())] += noPassengersInVeh;
      this.occupancyRecord.append(event.getTime());
      this.occupancyRecord.append("\t");
      this.occupancyRecord.append(vehId);
      this.occupancyRecord.append("\t");
      this.occupancyRecord.append(facId);
      this.occupancyRecord.append("\t");
      this.occupancyRecord.append(noPassengersInVeh);
      this.occupancyRecord.append("\n");
    }
  }
Esempio n. 2
0
 public void handleEvent(final VehicleDepartsAtFacilityEvent event) {
   List<Tuple<Id, Double>> list = this.positions.get(event.getVehicleId());
   if (list == null) {
     list = new ArrayList<Tuple<Id, Double>>();
     this.positions.put(event.getVehicleId(), list);
   }
   list.add(new Tuple<Id, Double>(event.getFacilityId(), Double.valueOf(event.getTime())));
 }
Esempio n. 3
0
    @Override
    public void handleEvent(VehicleDepartsAtFacilityEvent event) {

      if (event.getTime() >= this.startTime && event.getTime() < this.endTime) {
        // It is for me
        this.posDepartureDelay.addEntry(event.getDelay());
        this.positiveDepartureCounter++;
      } else {
        // Not for me
      }
    }
Esempio n. 4
0
  public void handleEvent(VehicleDepartsAtFacilityEvent event) {
    if (event.getFacilityId().toString().equals("812550.1")) {
      System.out.println("facility Id:\t" + event.getFacilityId().toString());
      Id vehId = event.getVehicleId();
      double time = event.getTime();

      List<Tuple<Double, Integer>> enterVehTimeList = enterVehTimes.remove(vehId);
      if (enterVehTimeList != null) {
        int size = enterVehTimeList.size();
        int tmpTimeBin = -1;
        for (Tuple<Double, Integer> enterTimeBinTuple : enterVehTimeList) {
          int timeBin = enterTimeBinTuple.getSecond();
          double waitTimeInBus = time - enterTimeBinTuple.getFirst();

          if (tmpTimeBin != timeBin) {
            Map<Integer, Double> tmpWtobSums = WtobSumsOfVeh.get(vehId);
            Map<Integer, Integer> tmpWtobCounts = WtobCountsOfVeh.get(vehId);

            Double wtobSum = wtobSums.get(timeBin);
            if (wtobSum == null) wtobSum = 0.0;
            wtobSums.put(timeBin, tmpWtobSums.remove(timeBin) + wtobSum);

            Integer wtobCount = wtobCounts.get(timeBin);
            if (wtobCount == null) wtobCount = 0;
            wtobCounts.put(timeBin, tmpWtobCounts.remove(timeBin) + wtobCount);
          }

          Double wibSum = wibSums.get(timeBin);
          if (wibSum == null) wibSum = 0.0;

          Integer wibCount = wibCounts.get(timeBin);
          if (wibCount == null) wibCount = 0;

          wibSums.put(timeBin, wibSum + waitTimeInBus);
          // System.out.println(">>>>>wibSums put\ttimeBin\t" +
          // timeBin
          // + "\twibSums\t" + (wibSum + waitTimeInBus));

          wibCounts.put(timeBin, ++wibCount);
          // System.out.println(">>>>>wibCounts put\ttimeBin\t"
          // + timeBin + "\twibCount\t" + wibCount);
          tmpTimeBin = timeBin;
        }

        // double sumOfWaitInBus = size * time -
        // getSum(enterVehTimeList);
        // int timeBin = vehIdTimeBins.get(vehId);
      }
      WtobSumsOfVeh.remove(vehId);
      WtobCountsOfVeh.remove(vehId);
    }
  }
Esempio n. 5
0
 @Override
 public void handleEvent(final VehicleDepartsAtFacilityEvent event) {
   handleEvent(eventsPerVehicle, event.getVehicleId(), event);
 }