コード例 #1
0
  @Override
  public void handleAgentLeg(AgentWithParking aem) {
    Id personId = aem.getPerson().getId();

    boolean endOfLegReached = aem.endOfLegReached();

    if (endOfLegReached) {
      if (!parkingFound.contains(personId)) {
        parkingFound.add(personId);

        DebugLib.traceAgent(personId);

        Activity nextAct =
            (Activity)
                aem.getPerson()
                    .getSelectedPlan()
                    .getPlanElements()
                    .get(aem.getPlanElementIndex() + 3);

        Id parkingId =
            AgentWithParking.parkingManager.getFreePrivateParking(
                nextAct.getFacilityId(), nextAct.getType());

        if (isInvalidParking(aem, parkingId)) {
          parkingId =
              AgentWithParking.parkingManager.getClosestParkingFacilityNotOnLink(
                  nextAct.getCoord(), aem.getInvalidLinkForParking());
        }

        parkVehicleAndLogSearchTime(aem, personId, parkingId);
      }
    } else {
      super.handleAgentLeg(aem);
    }
  }
コード例 #2
0
ファイル: PublicParking.java プロジェクト: matsim-org/matsim
 @Override
 public void parkVehicle() {
   if (availableParking > 0) {
     availableParking--;
   } else {
     DebugLib.stopSystemAndReportInconsistency(
         "trying to park vehicle on full parking - parkingId:" + id + ";");
   }
 }
コード例 #3
0
ファイル: PublicParking.java プロジェクト: matsim-org/matsim
 @Override
 public void unparkVehicle() {
   if (availableParking < capacity) {
     availableParking++;
   } else {
     DebugLib.stopSystemAndReportInconsistency(
         "trying to unpark vehicle from empty parking - parkingId:" + id + "");
   }
 }
コード例 #4
0
  @Override
  public void handleEvent(PersonArrivalEvent event) {
    Id personId = event.getPersonId();

    PersonDriverAgentImpl agent = this.agents.get(personId);
    Plan executedPlan = agent.getCurrentPlan();
    int planElementIndex = ParallelSafePlanElementAccessLib.getCurrentExpectedLegIndex(agent);

    if (agentDoesNotDriveCarDuringWholeDay(personId)) {
      return;
    }

    if (!isPlanElementDuringDay(personId, planElementIndex)) {
      return;
    }

    if (firstParkingWalkTmp.get(personId) == null) {
      DebugLib.emptyFunctionForSettingBreakPoint();
    }

    double durationFirstWalk = 0;
    double durationSecondWalk = 0;

    // same start and end time causes wrong interval calculation (3600*24 seconds, instead of zero).
    if (firstParkingWalkTmp.get(personId) != null
        && firstParkingWalkTmp.get(personId) != event.getTime()) {
      durationFirstWalk =
          GeneralLib.getIntervalDuration(firstParkingWalkTmp.get(personId), event.getTime());
    }

    if (secondParkingWalkTmp.get(personId) != null
        && secondParkingWalkTmp.get(personId) != event.getTime()) {
      durationSecondWalk =
          GeneralLib.getIntervalDuration(secondParkingWalkTmp.get(personId), event.getTime());
    }

    updateWalkTimeTmpVariables(
        event.getLegMode(),
        personId,
        executedPlan,
        planElementIndex,
        durationFirstWalk,
        durationSecondWalk);
  }