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); }
/** * Loads the inLinks-array with the corresponding links. * Cannot be called in constructor, as the queueNetwork does not yet know * the queueLinks. Should be called by QueueNetwork, after creating all * QueueNodes and QueueLinks. */ @Override public void init() { int i = 0; for (Link l : this.node.getInLinks().values()) { QNetwork network = netsimEngine.getNetsimNetwork() ; this.inLinksArrayCache[i] = network.getNetsimLinks().get(l.getId()); i++; } /* As the order of links has an influence on the simulation results, * the nodes are sorted to avoid indeterministic simulations. dg[april08] */ Arrays.sort(this.inLinksArrayCache, new Comparator<NetsimLink>() { @Override public int compare(NetsimLink o1, NetsimLink o2) { return o1.getLink().getId().compareTo(o2.getLink().getId()); } }); }
@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(); } }
return AcceptTurn.ABORT; QLinkI nextQLink = qNetwork.getNetsimLinks().get(nextLinkId);
private static void dummify(QNetwork network) { NetElementActivationRegistry netElementActivator = new NetElementActivationRegistry() { @Override protected void registerNodeAsActive(QNodeImpl node) { } @Override int getNumberOfSimulatedNodes() { return 0; } @Override protected void registerLinkAsActive(QLinkI link) { } @Override int getNumberOfSimulatedLinks() { return 0; } }; for (QNodeI node : network.getNetsimNodes().values()) { if ( node instanceof QNodeImpl ) { ((QNodeImpl) node).setNetElementActivationRegistry(netElementActivator); } } for (QLinkI link : network.getNetsimLinks().values()) { if ( link instanceof QLinkImpl ) { ((QLinkImpl) link).setNetElementActivationRegistry(netElementActivator); } } }
QLinkI nextQueueLink = this.netsimEngine.getNetsimNetwork().getNetsimLinks().get(nextLinkId); QLaneI nextQueueLane = nextQueueLink.getAcceptingQLane() ; if (nextQueueLane.isAcceptingFromUpstream()) {