Class SplitFraction


  • public class SplitFraction
    extends Object
    Split fraction at a node with fractions per link, optionally per gtu type.

    Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version 4 mei 2017
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Detail

      • SplitFraction

        public SplitFraction​(Node node,
                             Interpolation interpolation,
                             StreamInterface random,
                             DEVSSimulatorInterface.TimeDoubleUnit simulator)
        Constructor.
        Parameters:
        node - Node; node
        interpolation - Interpolation; interpolation
        random - StreamInterface; random stream
        simulator - DEVSSimulatorInterface.TimeDoubleUnit; simulator
    • Method Detail

      • addFraction

        public void addFraction​(Link link,
                                double fraction)
        Add fraction to link, this will apply to GTUType.ALL and all time.
        Parameters:
        link - Link; link
        fraction - double; fraction
      • addFraction

        public void addFraction​(Link link,
                                GTUType gtuType,
                                double fraction)
        Add fraction to link for gtu type, this will apply to all time.
        Parameters:
        link - Link; link
        gtuType - GTUType; gtu type
        fraction - double; fraction
      • addFraction

        public void addFraction​(Link link,
                                DurationVector time,
                                double[] fraction)
        Add fraction to link over time, this will apply to GTUType.ALL.
        Parameters:
        link - Link; link
        time - DurationVector; time
        fraction - double[]; fraction
      • addFraction

        public void addFraction​(Link link,
                                GTUType gtuType,
                                DurationVector time,
                                double[] fraction)
        Add fraction to link over time for gtu type.
        Parameters:
        link - Link; link
        gtuType - GTUType; gtu type
        time - DurationVector; time
        fraction - double[]; fraction
      • draw

        public Link draw​(GTUType gtuType)
        Draw next link based on split fractions. If no fractions were defined, split fractions are determined based on the number of lanes per link.
        Parameters:
        gtuType - GTUType; gtuType
        Returns:
        next link
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object