Class LinearFundamentalDiagramBranch

    • 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:
        getFlowPcuHour in interface FundamentalDiagramBranch
        Parameters:
        densityPcuKm - to use
        Returns:
        flowPcuHour found
      • getDensityPcuKm

        public double getDensityPcuKm​(double flowPcuHour)
        The flow at a given density
        Specified by:
        getDensityPcuKm in interface FundamentalDiagramBranch
        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:
        getFlowTangent in interface FundamentalDiagramBranch
        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:
        relaxedHashCode in interface FundamentalDiagramBranch
        Parameters:
        scale - indicating how many decimals to consider, e.g., 2 considers 2 decimals for precision
        Returns:
        the created relaxed hash code
      • isLinear

        public boolean isLinear()
        Verify if the branch is linear or not
        Specified by:
        isLinear in interface FundamentalDiagramBranch
        Returns:
        true when linear, false otherwise