Package org.goplanit.cost.virtual
Class SpeedConnectoidTravelTimeCost
- java.lang.Object
-
- org.goplanit.component.PlanitComponent<AbstractVirtualCost>
-
- org.goplanit.cost.virtual.AbstractVirtualCost
-
- org.goplanit.cost.virtual.SpeedConnectoidTravelTimeCost
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IdAble>
,EventListener
,PlanitComponentListener
,Cost<ConnectoidSegment>
,VirtualCost
,EventListener
,ExternalIdAble
,IdAble
public class SpeedConnectoidTravelTimeCost extends AbstractVirtualCost
Class to calculate the connectoid travel time using connectoid speed- Author:
- gman6028
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_CONNECTOID_SPEED_KPH
default to apply-
Fields inherited from interface org.goplanit.cost.virtual.VirtualCost
FIXED, SPEED
-
-
Constructor Summary
Constructors Constructor Description SpeedConnectoidTravelTimeCost(SpeedConnectoidTravelTimeCost other)
Copy constructorSpeedConnectoidTravelTimeCost(IdGroupingToken groupId)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SpeedConnectoidTravelTimeCost
clone()
Create a shallow copy of this entitydouble
getDTravelTimeDFlow(boolean uncongested, Mode mode, ConnectoidSegment connectoidSegment)
Fixed, so derivative is always zerodouble
getGeneralisedCost(Mode mode, ConnectoidSegment connectoidSegment)
Return the connectoid travel time using speeddouble
getTravelTimeCost(Mode mode, ConnectoidSegment connectoidSegment)
Returns the generalised cost of travel along an edge segment for a specified modevoid
initialiseBeforeSimulation(VirtualNetwork virtualNetwork)
Initialize the virtual cost componentvoid
populateWithCost(VirtualNetwork virtualNetwork, Mode mode, double[] costToFill)
Invoker expects (mode specific ) costs in passed in array to be filled, where each entry signifies a link segment by its idvoid
reset()
Chosen speed is considered configuration not internal state, so upon resetting the chosen speed remains in tactvoid
setConnectoidSpeed(double connectoidSpeed)
set the connectoid speedvoid
updateTimePeriod(TimePeriod timePeriod)
Provide the cost calculation with information regarding the time period for which the cost is to be calculated-
Methods inherited from class org.goplanit.component.PlanitComponent
equals, getComponentType, getExternalId, getId, getIdGroupingToken, getKnownSupportedEventTypes, getXmlId, hashCode, onPlanitComponentEvent, setExternalId, setXmlId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.event.EventListener
hasKnownSupportedEventTypes
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
hasExternalId, hasXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, idEquals, idHashCode
-
-
-
-
Field Detail
-
DEFAULT_CONNECTOID_SPEED_KPH
public static final double DEFAULT_CONNECTOID_SPEED_KPH
default to apply- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SpeedConnectoidTravelTimeCost
public SpeedConnectoidTravelTimeCost(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this class
-
SpeedConnectoidTravelTimeCost
public SpeedConnectoidTravelTimeCost(SpeedConnectoidTravelTimeCost other)
Copy constructor- Parameters:
other
- to copy
-
-
Method Detail
-
setConnectoidSpeed
public void setConnectoidSpeed(double connectoidSpeed)
set the connectoid speed- Parameters:
connectoidSpeed
- the speed
-
initialiseBeforeSimulation
public void initialiseBeforeSimulation(VirtualNetwork virtualNetwork) throws PlanItException
Initialize the virtual cost component- Specified by:
initialiseBeforeSimulation
in classAbstractVirtualCost
- Parameters:
virtualNetwork
- the virtual network- Throws:
PlanItException
- thrown if a link/mode combination exists for which no cost parameters have been set
-
updateTimePeriod
public void updateTimePeriod(TimePeriod timePeriod)
Provide the cost calculation with information regarding the time period for which the cost is to be calculated- Specified by:
updateTimePeriod
in classAbstractVirtualCost
- Parameters:
timePeriod
- to apply
-
getGeneralisedCost
public double getGeneralisedCost(Mode mode, ConnectoidSegment connectoidSegment)
Return the connectoid travel time using speed- Parameters:
mode
- the mode of travelconnectoidSegment
- the connectoid segment- Returns:
- the travel time for this connectoid segment
-
populateWithCost
public void populateWithCost(VirtualNetwork virtualNetwork, Mode mode, double[] costToFill) throws PlanItException
Invoker expects (mode specific ) costs in passed in array to be filled, where each entry signifies a link segment by its id- Parameters:
virtualNetwork
- the cost pertains tomode
- the mode these costs pertain tocostToFill
- array of link segment costs identified by the link segment's internal id- Throws:
PlanItException
- thrown if error
-
clone
public SpeedConnectoidTravelTimeCost clone()
Create a shallow copy of this entity- Specified by:
clone
in interfaceIdAble
- Specified by:
clone
in classPlanitComponent<AbstractVirtualCost>
- Returns:
- shallow copy of entity
-
reset
public void reset()
Chosen speed is considered configuration not internal state, so upon resetting the chosen speed remains in tact- Specified by:
reset
in classPlanitComponent<AbstractVirtualCost>
-
getTravelTimeCost
public double getTravelTimeCost(Mode mode, ConnectoidSegment connectoidSegment)
Returns the generalised cost of travel along an edge segment for a specified mode- Parameters:
mode
- the specified mode of travelconnectoidSegment
- the specified edge segment (which can be physical or virtual)- Returns:
- the cost of travel along the specified segment
-
getDTravelTimeDFlow
public double getDTravelTimeDFlow(boolean uncongested, Mode mode, ConnectoidSegment connectoidSegment)
Fixed, so derivative is always zero- Parameters:
uncongested
- flag idicating if the provided flow is uncongested or congested flow, relevant when flow can represent multiple traffic statesmode
- to useconnectoidSegment
- to use- Returns:
- the first derivative of travel time for a unit flow rate change in PCU per Hour
-
-