public QNodeImpl build( Node n ) { return new QNodeImpl( n, context, netsimEngine, turnAcceptanceLogic ) ; } }
private void moveNodes() { boolean remainsActive; this.lockNodes = true; QNodeImpl node; Iterator<QNodeImpl> simNodes = this.nodesQueue.iterator(); while (simNodes.hasNext()) { node = simNodes.next(); remainsActive = node.doSimStep(time); if (!remainsActive) simNodes.remove(); } this.lockNodes = false; } private void moveLinks() {
moveVehicleFromInlinkToAbort( veh, fromLane, now, currentLink.getId() ) ; return true ; } else if ( turn.equals(AcceptTurn.WAIT) ) { QLaneI nextQueueLane = nextQueueLink.getAcceptingQLane() ; if (nextQueueLane.isAcceptingFromUpstream()) { moveVehicleFromInlinkToOutlink(veh, currentLink.getId(), fromLane, nextLinkId, nextQueueLane); return true; if (vehicleIsStuck(fromLane, now)) { moveVehicleFromInlinkToAbort(veh, fromLane, now, currentLink.getId()); return false ; } else { moveVehicleFromInlinkToOutlink(veh, currentLink.getId(), fromLane, nextLinkId, nextQueueLane); return true;
int i = roundRobin % this.numOfRunners; if ( node instanceof QNodeImpl ) { ((QNodeImpl) node).setNetElementActivationRegistry(this.engines.get(i));
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 addToBuffer(final QVehicle veh) { // yy might make sense to just accumulate to "zero" and go into negative when something is used up. // kai/mz/amit, mar'12 double now = context.getSimTimer().getTimeOfDay() ; flowcap_accumulate.addValue(-veh.getFlowCapacityConsumptionInEquivalents(), now); buffer.add(veh); if (buffer.size() == 1) { bufferLastMovedTime = now; // (if there is one vehicle in the buffer now, there were zero vehicles in the buffer before. in consequence, // need to reset the lastMovedTime. If, in contrast, there was already a vehicle in the buffer before, we can // use the lastMovedTime that was (somehow) computed for that vehicle.) } final QNodeI toNode = qLink.getToNodeQ(); if ( toNode instanceof QNodeImpl ) { ((QNodeImpl) toNode).activateNode(); // yy for an "upstream" QLane, this activates the toNode too early. Yet I think I founds this // also in the original QLane code. kai, sep'13 } }
inLinksCapSum -= link.getLink().getCapacity(now); this.tempLinks[i] = null; this.moveLink(link, now); break;
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); } } }