public boolean isAcceptingFromUpstream() { return this.ql.getAcceptingQLane().isAcceptingFromUpstream(); }
public Link getLink() { return this.ql.getLink(); }
public void addParkedVehicle(MobsimVehicle veh, Id<Link> startLinkId) { if (this.vehicles.put(veh.getId(), (QVehicle) veh) != null) { if (wrnCnt < 1) { wrnCnt++ ; log.warn("existing vehicle in mobsim was just overwritten by other vehicle with same ID. Not clear what this means. Continuing anyways ...") ; log.warn(Gbl.ONLYONCE); } } QLinkI qlink = network.getNetsimLinks().get(startLinkId); if (qlink == null) { throw new RuntimeException("requested link with id=" + startLinkId + " does not exist in network. Possible vehicles " + "or activities or facilities are registered to a different network.") ; } qlink.addParkedVehicle(veh); }
Link currentLink = fromLink.getLink() ; QLaneI nextQueueLane = nextQueueLink.getAcceptingQLane() ; if (nextQueueLane.isAcceptingFromUpstream()) { moveVehicleFromInlinkToOutlink(veh, currentLink.getId(), fromLane, nextLinkId, nextQueueLane);
if (!link.isNotOfferingVehicle()) { this.tempLinks[inLinksCounter] = link; inLinksCounter++; inLinksCapSum += link.getLink().getCapacity(now); QLinkI link = this.tempLinks[i]; if (link != null) { selCap += link.getLink().getCapacity(now); if (selCap >= rndNum) { inLinksCapSum -= link.getLink().getCapacity(now); this.tempLinks[i] = null; this.moveLink(link, now);
QVehicle vehicle = qlink.removeParkedVehicle(vehicleId); if (vehicle == null) { if (vehicleBehavior == VehicleBehavior.teleport) { agent.setVehicle(vehicle) ; qlink.letVehicleDepart(vehicle); qlink.registerDriverAgentWaitingForCar(agent); } else { throw new RuntimeException("vehicle " + vehicleId + " not available for agent " + agent.getId() + " on link " + linkId + " at time "+ now); vehicle.setDriver(agent); agent.setVehicle(vehicle) ; qlink.letVehicleDepart(vehicle);
private void moveLink(final QLinkI link, final double now){ for (QLaneI lane : link.getOfferingQLanes()) { while (! lane.isNotOfferingVehicle()) { QVehicle veh = lane.getFirstVehicle(); if (! moveVehicleOverNode(veh, link, lane, now )) { break; } } } }
private void moveLinks() { boolean remainsActive; lockLinks = true; QLinkI link; ListIterator<QLinkI> simLinks = this.linksList.listIterator(); while (simLinks.hasNext()) { link = simLinks.next(); remainsActive = link.doSimStep(); if (!remainsActive) simLinks.remove(); } lockLinks = false; }
public final void registerAdditionalAgentOnLink(final MobsimAgent planAgent) { Id<Link> linkId = planAgent.getCurrentLinkId(); if (linkId != null) { // may be bushwacking QLinkI qLink = this.network.getNetsimLink(linkId); if ( qLink==null ) { throw new RuntimeException("netsim link lookup failed; agentId=" + planAgent.getId() + "; linkId=" + linkId ) ; } qLink.registerAdditionalAgentOnLink(planAgent); } }
@Override public void afterSim() { /* * Calling the afterSim Method of the QSimEngineThreads * will set their simulationRunning flag to false. */ for (QNetsimEngineRunner engine : this.engines) { engine.afterSim(); } if (this.usingThreadpool) { this.pool.shutdown(); } else { /* * Triggering the startBarrier of the QSimEngineThreads. * They will check whether the Simulation is still running. * It is not, so the Threads will stop running. */ this.startBarrier.arriveAndAwaitAdvance(); } /* Reset vehicles on ALL links. We cannot iterate only over the active links * (this.simLinksArray), because there may be links that have vehicles only * in the buffer (such links are *not* active, as the buffer gets emptied * when handling the nodes. */ for (QLinkI link : network.getNetsimLinks().values()) { link.clearVehicles(); } }
QLinkI rightOfWayLink = qNetwork.getNetsimLink(rightOfWayDir.getFromLink()); for (QLaneI rightOfWayQLane : rightOfWayLink.getOfferingQLanes()) {
public void addFromUpstream(QVehicle veh) { this.ql.getAcceptingQLane().addFromUpstream(veh); } }