MATSIM
Public Member Functions | Static Private Attributes | List of all members
org.matsim.core.mobsim.qsim.qnetsimengine.DefaultTurnAcceptanceLogic Class Reference
Inheritance diagram for org.matsim.core.mobsim.qsim.qnetsimengine.DefaultTurnAcceptanceLogic:
Inheritance graph
[legend]

Public Member Functions

AcceptTurn isAcceptingTurn (Link currentLink, QLaneI currentLane, Id< Link > nextLinkId, QVehicle veh, QNetwork qNetwork, double now)
 

Static Private Attributes

static final Logger log = LogManager.getLogger( DefaultTurnAcceptanceLogic.class)
 

Detailed Description

this class checks whether turning is physically possible, i.e. if the next link exists and if it is connected to the current link

Author
kainagel

Definition at line 35 of file DefaultTurnAcceptanceLogic.java.

Member Function Documentation

◆ isAcceptingTurn()

AcceptTurn org.matsim.core.mobsim.qsim.qnetsimengine.DefaultTurnAcceptanceLogic.isAcceptingTurn ( Link  currentLink,
QLaneI  currentLane,
Id< Link nextLinkId,
QVehicle  veh,
QNetwork  qNetwork,
double  now 
)

We need qNetwork to get the next QLink, because the link lookup may lead to a NullPointer otherwise

Implements org.matsim.core.mobsim.qsim.qnetsimengine.TurnAcceptanceLogic.

Definition at line 40 of file DefaultTurnAcceptanceLogic.java.

References org.matsim.core.mobsim.qsim.qnetsimengine.TurnAcceptanceLogic.AcceptTurn.ABORT, org.matsim.core.mobsim.qsim.interfaces.MobsimVehicle.getCurrentLink(), org.matsim.vis.snapshotwriters.VisVehicle.getDriver(), org.matsim.api.core.v01.network.Link.getFromNode(), org.matsim.api.core.v01.Identifiable< T >.getId(), org.matsim.vis.snapshotwriters.VisLink.getLink(), org.matsim.core.mobsim.qsim.qnetsimengine.QNetwork.getNetsimLinks(), org.matsim.api.core.v01.network.Link.getToNode(), and org.matsim.core.mobsim.qsim.qnetsimengine.TurnAcceptanceLogic.AcceptTurn.GO.

40  {
41  if (nextLinkId == null) {
42  log.error( "Agent has no or wrong route! agentId=" + veh.getDriver().getId()
43  + " currentLink=" + currentLink.getId().toString()
44  + ". The agent is removed from the simulation.");
45  return AcceptTurn.ABORT;
46  }
47  QLinkI nextQLink = qNetwork.getNetsimLinks().get(nextLinkId);
48 
49  if (nextQLink == null){
50  log.warn("The link id " + nextLinkId + " is not available in the simulation network, but vehicle " + veh.getId() +
51  " plans to travel on that link from link " + veh.getCurrentLink().getId());
52  return AcceptTurn.ABORT ;
53  }
54  if (currentLink.getToNode() != nextQLink.getLink().getFromNode()) {
55  log.warn("Cannot move vehicle " + veh.getId() + " from link " + currentLink.getId() + " to link " + nextQLink.getLink().getId());
56  return AcceptTurn.ABORT ;
57  }
58 // if ( !nextQLink.getLink().getAllowedModes().contains( veh.getDriver().getMode() ) ) {
59 // final String message = "The link with id " + nextLinkId + " does not allow the current mode, which is " + veh.getDriver().getMode();
60 // throw new RuntimeException( message ) ;
63 // // yyyy is rather nonsensical to get the mode from the driver, not from the vehicle. However, this seems to be
64 // // how it currently works: network links are defined for modes, not for vehicle types. kai, may'16
65 // }
66  // currently does not work, see MATSIM-533
67 
68  /* note: it cannot happen, that currentLane does not lead to nextLink (e.g. due to turn restrictions) because this is checked before:
69  * a vehicle only enters a lane when that lane leads to the next link. see QLinkLanesImpl.moveBufferToNextLane() and .chooseNextLane()
70  * tthunig, oct'17 */
71 
72  return AcceptTurn.GO ;
73  }
Here is the call graph for this function:

Member Data Documentation

◆ log

final Logger org.matsim.core.mobsim.qsim.qnetsimengine.DefaultTurnAcceptanceLogic.log = LogManager.getLogger( DefaultTurnAcceptanceLogic.class)
staticprivate

Definition at line 36 of file DefaultTurnAcceptanceLogic.java.


The documentation for this class was generated from the following file: