Interface FundamentalDiagramBranch
-
- All Known Implementing Classes:
LinearFundamentalDiagramBranch
public interface FundamentalDiagramBranch
A fundamental diagram has two branches each one can have a particular shape. Each branch is to be derived from this interface- Author:
- markr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description double
getDensityPcuKm(double flowPcuHour)
The flow at a given densitydefault double
getDensityTangent(double densityPcuKm)
The derivative of density towards a change in flow given a particular densitydouble
getFlowPcuHour(double densityPcuKm)
The flow at a given densitydouble
getFlowTangent(double flowPcuHour)
The derivative of flow towards a change in density given a particualr flowdouble
getSpeedKmHourAtZeroDensity()
Collect the speed at zero density when flow/density cannot be computed.double
getSpeedKmHourAtZeroFlow()
Collect the speed at zero flow when flow/density is either not feasible to compute or might not be representative, i.e., when there is no flow, the speed likely should not be zero, but instead reflect the maximum allowed speed insteaddefault double
getSpeedKmHourByDensity(double densityPcuKm)
The speed at a given density.default double
getSpeedKmHourByFlow(double flowPcuHour)
The speed at a given flow.boolean
isLinear()
Verify if the branch is linear or notint
relaxedHashCode(int scale)
A fundamental diagram branch is based on a limited number of double variables to define it.FundamentalDiagramBranch
shallowClone()
shallow clone a branch
-
-
-
Method Detail
-
getFlowPcuHour
double getFlowPcuHour(double densityPcuKm)
The flow at a given density- Parameters:
densityPcuKm
- to use- Returns:
- flowPcuHour found
-
getDensityPcuKm
double getDensityPcuKm(double flowPcuHour)
The flow at a given density- Parameters:
flowPcuHour
- to use- Returns:
- densityPcuKm found
-
getSpeedKmHourByFlow
default double getSpeedKmHourByFlow(double flowPcuHour)
The speed at a given flow. If flow is zero, the speed at zero flow is returned- Parameters:
flowPcuHour
- to use- Returns:
- speedKmHour found
-
getSpeedKmHourAtZeroFlow
double getSpeedKmHourAtZeroFlow()
Collect the speed at zero flow when flow/density is either not feasible to compute or might not be representative, i.e., when there is no flow, the speed likely should not be zero, but instead reflect the maximum allowed speed instead- Returns:
- speedKmHour
-
getSpeedKmHourByDensity
default double getSpeedKmHourByDensity(double densityPcuKm)
The speed at a given density. If density is zero, the speed at zero density is returned- Parameters:
densityPcuKm
- to use- Returns:
- speedKmHour found
-
getSpeedKmHourAtZeroDensity
double getSpeedKmHourAtZeroDensity()
Collect the speed at zero density when flow/density cannot be computed.- Returns:
- speedKmHour found
-
getFlowTangent
double getFlowTangent(double flowPcuHour)
The derivative of flow towards a change in density given a particualr flow- Parameters:
flowPcuHour
- to use- Returns:
- tangent of flow
-
getDensityTangent
default double getDensityTangent(double densityPcuKm)
The derivative of density towards a change in flow given a particular density- Parameters:
densityPcuKm
- to use- Returns:
- tangent of density
-
relaxedHashCode
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.- Parameters:
scale
- indicating how many decimals to consider, e.g., 2 considers 2 decimals for precision- Returns:
- the created relaxed hash code
-
shallowClone
FundamentalDiagramBranch shallowClone()
shallow clone a branch- Returns:
- cloned branch
-
isLinear
boolean isLinear()
Verify if the branch is linear or not- Returns:
- true when linear, false otherwise
-
-