@Override public void notifyMobsimAfterSimStep(MobsimAfterSimStepEvent event) { access.release(); localTime = (int) event.getSimulationTime(); // yy I am not so sure about the "int". kai, nov'17 stepDone.arriveAndAwaitAdvance(); } @Override
/** * Creates the event and notifies all listeners * * @param simTime the current time in the simulation */ public void fireQueueSimulationAfterSimStepEvent(final double simTime) { MobsimAfterSimStepEvent<Mobsim> event = new MobsimAfterSimStepEvent<>(sim, simTime); MobsimAfterSimStepListener[] listener = this.listenerList.getListeners(MobsimAfterSimStepListener.class); for (MobsimAfterSimStepListener aListener : listener) { aListener.notifyMobsimAfterSimStep(event); } }
@Override public void notifyMobsimAfterSimStep(MobsimAfterSimStepEvent e) { double time = e.getSimulationTime(); if (time >= this.snapshotTime) { this.snapshotTime += this.snapshotPeriod; doSnapshot(time, (VisMobsim) e.getQueueSimulation()); } }
@Override public void notifyMobsimAfterSimStep(MobsimAfterSimStepEvent e) { checkTime(e.getSimulationTime()); }
while( !changedLinksByTime.isEmpty() && changedLinksByTime.firstKey() <= e.getSimulationTime() ) { Map<Link, Double> map = changedLinksByTime.pollFirstEntry().getValue(); for ( Map.Entry<Link,Double> link2speed : map.entrySet() ) { Link link = link2speed.getKey() ; double freeSpeedTravelTime = link.getLength() / link2speed.getValue() ; if ( e.getSimulationTime() > ((QSim)e.getQueueSimulation()).getSimTimer().getSimStartTime() ) { log.debug("time=" + e.getSimulationTime() + "; network change event for link=" + link.getId() + "; new ttime="+ freeSpeedTravelTime );
@Override public void notifyMobsimAfterSimStep(@SuppressWarnings("rawtypes") MobsimAfterSimStepEvent e) { while (isReadyForSubmission(requests.peek(), e.getSimulationTime())) { optimizer.requestSubmitted(requests.poll()); } }
@Override public void notifyMobsimAfterSimStep(MobsimAfterSimStepEvent e) { checkLinkTravelTimes(e.getSimulationTime()); }
@Override public void notifyMobsimAfterSimStep(MobsimAfterSimStepEvent e) { double now = e.getSimulationTime(); for (MobsimAgent mobsimAgent : startingAgents.values()) { double departureTime = mobsimAgent.getActivityEndTime(); /* * If it is the last scheduled Activity the departureTime is -infinity. * Otherwise we select the agent for a replanning. */ if (departureTime >= now) { this.activityEndTimes.put(mobsimAgent.getId(), departureTime); int bin = this.getTimeBin(mobsimAgent.getActivityEndTime()); Map<Id<Person>, MobsimAgent> map = getMapForTimeBin(bin); map.put(mobsimAgent.getId(), mobsimAgent); } else { log.warn("Departure time is in the past - ignoring activity!"); } } this.startingAgents.clear(); /* * Remove current time bin from activityPerformingAgents map. They have been handled * in the current time step. */ this.activityPerformingAgents.remove(this.getTimeBin(now)); }
@Override public void notifyMobsimAfterSimStep(MobsimAfterSimStepEvent e) { if (e.getSimulationTime() <= networkChangeEventTime) { Assert.assertEquals("Wrong travel time at time step " + e.getSimulationTime() + ". Should be the freespeed travel time.", Math.ceil(link.getLength()/link.getFreespeed()), Math.ceil(travelTime.getLinkTravelTime(link, e.getSimulationTime(), null, null)), testUtils.EPSILON); case1 = true; } else { Assert.assertEquals("Wrong travel time at time step " + e.getSimulationTime() + ". Should be the travel time resulting from the network change event (reduced freespeed).", Math.ceil(link.getLength() / reducedFreespeed), Math.ceil(travelTime.getLinkTravelTime(link, e.getSimulationTime(), null, null)), testUtils.EPSILON); case2 = true; } }
@Override public void notifyMobsimAfterSimStep(final MobsimAfterSimStepEvent e) { if (e.getSimulationTime() == t1) { assertEquals(1, this.lrp.getLegPerformingAgents().size()); // one agent performs a Leg assertEquals(1, this.lrp.getReplanningAgents(e.getSimulationTime()).size()); // one agent has just departed but cannot do a replanning if (e.getSimulationTime() == t1 + 1) { assertEquals(1, this.lrp.getUnrestrictedReplanningAgents(e.getSimulationTime()).size()); assertEquals(0, this.lrp.getRestrictedReplanningAgents(e.getSimulationTime()).size()); if (e.getSimulationTime() == t1 + linkTravelTime) { assertEquals(1, this.lrp.getReplanningAgents(e.getSimulationTime()).size()); // one agent could leave the second link in its route and should be identified as to be replanned if (e.getSimulationTime() == t2) { assertEquals(2, this.lrp.getLegPerformingAgents().size()); // two agents perform a Leg assertEquals(1, this.lrp.getReplanningAgents(e.getSimulationTime()).size()); // one agent has just departed but cannot do a replanning if (e.getSimulationTime() == t2 + linkTravelTime) { assertEquals(1, this.lrp.getReplanningAgents(e.getSimulationTime()).size()); // one agent could leave the second link in its route and should be identified as to be replanned if (e.getSimulationTime() == t3) { assertEquals(3, this.lrp.getLegPerformingAgents().size()); // three agents perform a Leg assertEquals(1, this.lrp.getReplanningAgents(e.getSimulationTime()).size()); // one agent has just departed and might do a replanning if (e.getSimulationTime() == t4) { assertEquals(100, this.lrp.getLegPerformingAgents().size()); // all agents perform a Leg assertEquals(97, this.lrp.getReplanningAgents(e.getSimulationTime()).size()); // 97 agents have just departed but cannot do a replanning if (e.getSimulationTime() == t4 + linkTravelTime) { assertEquals(97, this.lrp.getReplanningAgents(e.getSimulationTime()).size()); // 97 agents could leave the second link in its route and should be identified as to be replanned
@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 } } }