Class LinearFundamentalDiagramBranch
- java.lang.Object
-
- org.goplanit.supply.fundamentaldiagram.LinearFundamentalDiagramBranch
-
- All Implemented Interfaces:
FundamentalDiagramBranch
public class LinearFundamentalDiagramBranch extends Object implements FundamentalDiagramBranch
A linear fundamental diagram branch implementation- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description LinearFundamentalDiagramBranch(double characteristicWaveSpeedKmHour, double densityAtZeroFlowPcuKm)ConstructorLinearFundamentalDiagramBranch(LinearFundamentalDiagramBranch linearFundamentalDiagramBranch)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetCharateristicWaveSpeedKmHour()The characteristic wave speed of the linear branch in km/hourdoublegetDensityPcuKm(double flowPcuHour)The flow at a given densitydoublegetFlowPcuHour(double densityPcuKm)The flow at a given densitydoublegetFlowTangent(double flowPcuHour)The derivative of flow towards a change in density given a particualr flowdoublegetSpeedKmHourAtZeroDensity()speed at zero density is the same as the characteristic wave speeddoublegetSpeedKmHourAtZeroFlow()speed at zero flow is the same as the characteristic wave speedbooleanisLinear()Verify if the branch is linear or notintrelaxedHashCode(int scale)A fundamental diagram branch is based on a limited number of double variables to define it.protected voidsetCharacteristicWaveSpeedKmHour(double characteristicWaveSpeedKmHour)Set the characteristic wave speed in km/hprotected voidsetDensityAtZeroFlow(double densityAtZeroFlowPcuKm)Set the density at zero flow in Pcu/kmLinearFundamentalDiagramBranchshallowClone()shallow clone a branch-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.supply.fundamentaldiagram.FundamentalDiagramBranch
getDensityTangent, getSpeedKmHourByDensity, getSpeedKmHourByFlow
-
-
-
-
Constructor Detail
-
LinearFundamentalDiagramBranch
public LinearFundamentalDiagramBranch(double characteristicWaveSpeedKmHour, double densityAtZeroFlowPcuKm)Constructor- Parameters:
characteristicWaveSpeedKmHour- to use (either free flow speed to use or backward wave speed)densityAtZeroFlowPcuKm- to use
-
LinearFundamentalDiagramBranch
public LinearFundamentalDiagramBranch(LinearFundamentalDiagramBranch linearFundamentalDiagramBranch)
Copy constructor- Parameters:
linearFundamentalDiagramBranch- to copy
-
-
Method Detail
-
setCharacteristicWaveSpeedKmHour
protected void setCharacteristicWaveSpeedKmHour(double characteristicWaveSpeedKmHour)
Set the characteristic wave speed in km/h- Parameters:
characteristicWaveSpeedKmHour- to set
-
setDensityAtZeroFlow
protected void setDensityAtZeroFlow(double densityAtZeroFlowPcuKm)
Set the density at zero flow in Pcu/km- Parameters:
densityAtZeroFlowPcuKm- to set
-
getFlowPcuHour
public double getFlowPcuHour(double densityPcuKm)
The flow at a given density- Specified by:
getFlowPcuHourin interfaceFundamentalDiagramBranch- Parameters:
densityPcuKm- to use- Returns:
- flowPcuHour found
-
getDensityPcuKm
public double getDensityPcuKm(double flowPcuHour)
The flow at a given density- Specified by:
getDensityPcuKmin interfaceFundamentalDiagramBranch- Parameters:
flowPcuHour- to use- Returns:
- densityPcuKm found
-
getFlowTangent
public double getFlowTangent(double flowPcuHour)
The derivative of flow towards a change in density given a particualr flow- Specified by:
getFlowTangentin interfaceFundamentalDiagramBranch- Parameters:
flowPcuHour- to use- Returns:
- tangent of flow
-
getCharateristicWaveSpeedKmHour
public double getCharateristicWaveSpeedKmHour()
The characteristic wave speed of the linear branch in km/hour- Returns:
- wave speed
-
relaxedHashCode
public int relaxedHashCode(int scale)
A fundamental diagram branch is based on a limited number of double variables to define it. In case we want to reuse the same branch for extremely similar variables, then we can use this relaxed hash code that ensures that for the given precision level identical hashes are created even if the underlying floating point variables differ beyond this precision.- Specified by:
relaxedHashCodein interfaceFundamentalDiagramBranch- Parameters:
scale- indicating how many decimals to consider, e.g., 2 considers 2 decimals for precision- Returns:
- the created relaxed hash code
-
shallowClone
public LinearFundamentalDiagramBranch shallowClone()
shallow clone a branch- Specified by:
shallowClonein interfaceFundamentalDiagramBranch- Returns:
- cloned branch
-
getSpeedKmHourAtZeroFlow
public double getSpeedKmHourAtZeroFlow()
speed at zero flow is the same as the characteristic wave speed- Specified by:
getSpeedKmHourAtZeroFlowin interfaceFundamentalDiagramBranch- Returns:
- speedKmHour
-
getSpeedKmHourAtZeroDensity
public double getSpeedKmHourAtZeroDensity()
speed at zero density is the same as the characteristic wave speed- Specified by:
getSpeedKmHourAtZeroDensityin interfaceFundamentalDiagramBranch- Returns:
- speedKmHour found
-
isLinear
public boolean isLinear()
Verify if the branch is linear or not- Specified by:
isLinearin interfaceFundamentalDiagramBranch- Returns:
- true when linear, false otherwise
-
-