Class MacroscopicLinkSegmentImpl
- java.lang.Object
-
- org.planit.graph.EdgeSegmentImpl
-
- org.planit.network.physical.LinkSegmentImpl
-
- org.planit.network.macroscopic.physical.MacroscopicLinkSegmentImpl
-
- All Implemented Interfaces:
Serializable,Comparable<Idable>,EdgeSegment,ExternalIdable,Idable,LinkSegment,MacroscopicLinkSegment
public class MacroscopicLinkSegmentImpl extends LinkSegmentImpl implements MacroscopicLinkSegment
Link segment for macroscopic transport networks.- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected MacroscopicLinkSegmentTypelinkSegmentTypethe link type of this link containing all macroscopic features by user class-
Fields inherited from class org.planit.network.physical.LinkSegmentImpl
linkSegmentId, numberOfLanes, physicalSpeedLinkKmh
-
Fields inherited from class org.planit.graph.EdgeSegmentImpl
xmlId
-
Fields inherited from interface org.planit.utils.network.physical.LinkSegment
DEFAULT_MAX_SPEED, DEFAULT_NUMBER_OF_LANES, MAXIMUM_DENSITY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMacroscopicLinkSegmentImpl(MacroscopicLinkSegmentImpl macroscopicLinkSegmentImpl)Copy constructorprotectedMacroscopicLinkSegmentImpl(IdGroupingToken groupId, Link parentLink, boolean directionAB)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MacroscopicLinkSegmentImplclone()Clone the edge segmentdoublecomputeCapacityPcuH()Return the total capacity Compute the total capacity by multiplying the capacity per lane and number of lanesdoublecomputeFreeFlowTravelTime(Mode mode)Compute the free flow travel time by mode, i.e.booleanequals(Object obj)Set<Mode>getAllowedModes()Returns the modes that are allowed on the link segmentMacroscopicLinkSegmentTypegetLinkSegmentType()Collect the link segment type of the link segmentdoublegetModelledSpeedLimitKmH(Mode mode)Collect the maximum speed limit for the mode by taking the minimum of: (i) physical speed limit, (ii) mode's maximum speed limit, (iii) link segment type's mode specific speed limit.inthashCode()booleanisModeAllowed(Mode mode)Returns whether vehicles of a specified mode are allowed through this linkvoidsetLinkSegmentType(MacroscopicLinkSegmentType linkSegmentType)Set the link segment type this link segment adheres to-
Methods inherited from class org.planit.network.physical.LinkSegmentImpl
generateLinkSegmentId, getLinkSegmentId, getNumberOfLanes, getParentLink, getPhysicalSpeedLimitKmH, setLinkSegmentId, setNumberOfLanes, setPhysicalSpeedLimitKmH
-
Methods inherited from class org.planit.graph.EdgeSegmentImpl
generateEdgeSegmentId, getDownstreamVertex, getExternalId, getId, getParentEdge, getUpstreamVertex, getXmlId, isDirectionAb, remove, removeParentEdge, setDownstreamVertex, setExternalId, setId, setParentEdge, setUpstreamVertex, setXmlId, validate
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.planit.utils.graph.EdgeSegment
getDownstreamVertex, getParentEdge, getUpstreamVertex, isDirectionAb, remove, removeParentEdge, replace, setDownstreamVertex, setParentEdge, setUpstreamVertex, validate
-
Methods inherited from interface org.planit.utils.id.ExternalIdable
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId
-
Methods inherited from interface org.planit.utils.id.Idable
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.planit.utils.network.physical.LinkSegment
getLinkSegmentId, getNumberOfLanes, getParentLink, getPhysicalSpeedLimitKmH, setNumberOfLanes, setPhysicalSpeedLimitKmH
-
Methods inherited from interface org.planit.utils.network.physical.macroscopic.MacroscopicLinkSegment
hasLinkSegmentType
-
-
-
-
Field Detail
-
linkSegmentType
protected MacroscopicLinkSegmentType linkSegmentType
the link type of this link containing all macroscopic features by user class
-
-
Constructor Detail
-
MacroscopicLinkSegmentImpl
protected MacroscopicLinkSegmentImpl(IdGroupingToken groupId, Link parentLink, boolean directionAB) throws PlanItException
Constructor- Parameters:
groupId- contiguous id generation within this group for instances of this classparentLink- the parent link of this link segmentdirectionAB- direction of travel- Throws:
PlanItException- thrown when error
-
MacroscopicLinkSegmentImpl
protected MacroscopicLinkSegmentImpl(MacroscopicLinkSegmentImpl macroscopicLinkSegmentImpl)
Copy constructor- Parameters:
macroscopicLinkSegmentImpl- to copy
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classEdgeSegmentImpl
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classEdgeSegmentImpl
-
computeCapacityPcuH
public double computeCapacityPcuH()
Return the total capacity Compute the total capacity by multiplying the capacity per lane and number of lanes- Specified by:
computeCapacityPcuHin interfaceMacroscopicLinkSegment- Returns:
- linkSegmentCapacity in PCU/h
-
computeFreeFlowTravelTime
public double computeFreeFlowTravelTime(Mode mode)
Compute the free flow travel time by mode, i.e. when the link's maximum speed might be capped by the mode's maximum speed If the input data are invalid, this method logs the problem and returns a negative value.- Specified by:
computeFreeFlowTravelTimein interfaceMacroscopicLinkSegment- Parameters:
mode- mode of travel- Returns:
- freeFlowTravelTime for this mode
-
getModelledSpeedLimitKmH
public double getModelledSpeedLimitKmH(Mode mode)
Collect the maximum speed limit for the mode by taking the minimum of: (i) physical speed limit, (ii) mode's maximum speed limit, (iii) link segment type's mode specific speed limit. It is possible the link segment type's mode specific speed limit exceeds the physical speed limit. This can happen when the user has assigned a type to the link that is less restrictive than the physical speed limit sign indicates It is also possible the link segment type's mode specific speed limit is more restrictive than the physical speed limit. For example when trucks are on a motorway and they have a designated lower speed limit. It is also possible the mode's global speed limit is more restrictive than the physical speed limit. For example when trucks are on a motorway and the physical speed limit exceeds the mode specific one Hence, it is important to always use this speed limit value when collecting speed limits, rather than collecting the physical, mode specific, or link type/mode specific speed limits- Specified by:
getModelledSpeedLimitKmHin interfaceMacroscopicLinkSegment- Parameters:
mode- to collect modelled maximum speed for- Returns:
- modelled speed limit, when mode is not allowed on link, 0 is returned
-
isModeAllowed
public boolean isModeAllowed(Mode mode)
Returns whether vehicles of a specified mode are allowed through this link- Specified by:
isModeAllowedin interfaceMacroscopicLinkSegment- Parameters:
mode- the specified mode- Returns:
- true if vehicles of this mode can drive along this link, false otherwise
-
getAllowedModes
public Set<Mode> getAllowedModes()
Returns the modes that are allowed on the link segment- Specified by:
getAllowedModesin interfaceMacroscopicLinkSegment- Returns:
- allowed modes
-
setLinkSegmentType
public void setLinkSegmentType(MacroscopicLinkSegmentType linkSegmentType)
Set the link segment type this link segment adheres to- Specified by:
setLinkSegmentTypein interfaceMacroscopicLinkSegment- Parameters:
linkSegmentType- the link segment type
-
getLinkSegmentType
public MacroscopicLinkSegmentType getLinkSegmentType()
Collect the link segment type of the link segment- Specified by:
getLinkSegmentTypein interfaceMacroscopicLinkSegment- Returns:
- the link segment
-
clone
public MacroscopicLinkSegmentImpl clone()
Clone the edge segment- Specified by:
clonein interfaceEdgeSegment- Overrides:
clonein classLinkSegmentImpl- Returns:
- copy of this instance
-
-