コード例 #1
0
 @Override
 public void notifyMobsimAfterSimStep(@SuppressWarnings("rawtypes") MobsimAfterSimStepEvent e) {
   if ((e.getSimulationTime() + 1) % chargeTimeStep == 0) {
     for (Charger c : chargers) {
       c.getLogic().chargeVehicles(chargeTimeStep, e.getSimulationTime());
     }
   }
 }
コード例 #2
0
  @Override
  public void notifyMobsimAfterSimStep(MobsimAfterSimStepEvent e) {
    double time = e.getSimulationTime();
    double tt1, tt2 = 0.0;
    if (this.vehOn1 > 0.0) {
      tt1 = this.vehOn1 / (this.link4.getCapacity() / 3600.0);
    } else {
      tt1 = this.ttFs1;
    }

    if (this.vehOn2 > 0.0) {
      tt2 = this.vehOn2 / (this.link5.getCapacity() / 3600.0);
    } else {
      tt2 = this.ttFs2;
    }

    String line = time + "\t" + this.vehOn1 + "\t" + this.vehOn2 + "\t" + tt1 + "\t" + tt2 + "\t";
    //		log.error("tt1: "+tt1 + " tt2: " + tt2);
    if (tt1 <= tt2) {
      //			log.error("  guidance 1");
      this.guidance = id2;
      line = line.concat("1");
    } else {
      //			log.error("  guidance 2");
      this.guidance = id3;
      line = line.concat("2");
    }
    try {
      this.writer.append(line);
      this.writer.newLine();
    } catch (IOException e1) {
      e1.printStackTrace();
    }
  }
コード例 #3
0
    @Override
    public void notifyMobsimAfterSimStep(final MobsimAfterSimStepEvent e) {
      if (e.getSimulationTime() == t1) {
        assertEquals(
            99,
            this.arp
                .getActivityPerformingAgents()
                .size()); // 99 agents perform an activity after the time step
        assertEquals(
            0,
            this.arp
                .getActivityEndingAgents(e.getSimulationTime())
                .size()); // no agent ends an activity
      }

      if (e.getSimulationTime() == t2) {
        assertEquals(
            98,
            this.arp
                .getActivityPerformingAgents()
                .size()); // 98 agents perform an activity after the time step
        assertEquals(
            0,
            this.arp
                .getActivityEndingAgents(e.getSimulationTime())
                .size()); // no agent ends an activity
      }

      if (e.getSimulationTime() == t3) {
        assertEquals(
            97,
            this.arp
                .getActivityPerformingAgents()
                .size()); // 97 agents perform an activity after the time step
        assertEquals(
            0,
            this.arp
                .getActivityEndingAgents(e.getSimulationTime())
                .size()); // no agent ends an activity
      }

      if (e.getSimulationTime() == t4) {
        assertEquals(
            1,
            this.arp
                .getActivityPerformingAgents()
                .size()); // one agents perform an activity after the time step
        assertEquals(
            0,
            this.arp
                .getActivityEndingAgents(e.getSimulationTime())
                .size()); // no agent ends an activity
      }

      if (e.getSimulationTime() == t5) {
        assertEquals(
            1,
            this.arp
                .getActivityPerformingAgents()
                .size()); // one agents perform an activity after the time step
        assertEquals(
            0,
            this.arp
                .getActivityEndingAgents(e.getSimulationTime())
                .size()); // no agent ends an activity
      }

      if (e.getSimulationTime() == t6) {
        assertEquals(
            0,
            this.arp
                .getActivityPerformingAgents()
                .size()); // no agents perform an activity after the time step
        assertEquals(
            0,
            this.arp
                .getActivityEndingAgents(e.getSimulationTime())
                .size()); // no agent ends an activity
      }
    }