Class BurstTripGenerator

All Implemented Interfaces:
CondObserver<Condition,Actor>, NamedObjectOps

public class BurstTripGenerator extends TripGenerator
Trip generator for trips that occur in bursts. While the trips start in bursts, the destinations for each trip is independent of the others.
  • Constructor Details

    • BurstTripGenerator

      public BurstTripGenerator(DramaSimulation sim, String name, boolean intern)
      Constructor.
      Parameters:
      sim - the simulation
      name - the name of this object
      intern - true if this object should be interned in the simulation's name table; false otherwise
  • Method Details

    • setFanInParameters

      public void setFanInParameters(int estimationCount, double estimationFactor, double estimationOffset)
      Set parameters for the fan-in case. The estimation count is used to compute an estimated delay between two hubs, assuming that estimationCount is the number of users traveling together (the delay is the mean delay for the slowest of a set of estimationCount users). This estimated delay is then multiplied by estimationFactor. Finally a fixed number estimationOffset is added to that delay to compute the delay that will be assumed.
      Parameters:
      estimationCount - the number of users to assume in a delay estimate
      estimationFactor - the factor by which to scale the delay
      estimationOffset - an offset (in seconds) to add to the delay
    • getEstimationCount

      public int getEstimationCount()
      Get the estimation-count parameter.
      Returns:
      the estimation count
      See Also:
    • getEstimationFactor

      public double getEstimationFactor()
      Get the estimation-factor parameter.
      Returns:
      the estimation factor
      See Also:
    • getEstimationOffset

      public double getEstimationOffset()
      Get the estimation-offset parameter.
      Returns:
      the estimation offset
      See Also:
    • init

      public void init(Hub hub, double time, int nbikes, Hub[] otherHubs, double[] weights, double[] overflowProb, boolean fanIn)
      Initialization.
      Parameters:
      hub - the hub from which trips originate
      time - the time at which trips are generated
      nbikes - is the number of bicycles in a burst
      otherHubs - the destination hubs
      weights - the probabilities that the destination is a particular hub
      overflowProb - the probability for a destination hub that the overflow area is used regardless of whether or not there is excess capacity in the preferred location
      fanIn - true of traffic goes in the reverse direction (i.e., towards Hub hub); false if the traffic starts at Hub hub
    • getNextInterval

      protected double getNextInterval()
      Description copied from class: TripGenerator
      Get the time interval to wait before scheduling the next trip.
      Specified by:
      getNextInterval in class TripGenerator
      Returns:
      the next trip interarrival time
    • restart

      public void restart()
      Description copied from class: TripGenerator
      Restart the trip generator after it has been stopped. If the trip generator is already running, calling TripGenerator.restart() will have no effect.
      Overrides:
      restart in class TripGenerator
      See Also:
    • stop

      public void stop()
      Description copied from class: TripGenerator
      Stop the trip generator. If this method is called when a trip generator is not running, it will have no effect. After TripGenerator.stop() is called, the traffic generator may be restarted. If one stops and restarts before the event associated with the initial delay is processed, the initial delay will be ignored.
      Overrides:
      stop in class TripGenerator
      See Also:
    • action

      protected boolean action()
      Description copied from class: TripGenerator
      Perform an action that generates a trip. Implementations of this method will typically call the Hub method Hub.sendUsers(Hub,int,boolean,Callable) or Hub.sendUsers(Hub,int,boolean,RealValuedFunctionTwo,Callable). The Callable argument handles multi-hop trips and also a final call to TripGenerator.fireTripEnded(long,Hub) for successfully completed trips. The return value for sendUsers or sendUsers can be used to determine whether TripGenerator.fireTripStarted(long,Hub,HubDomain) or TripGenerator.fireTripFailedAtStart(long,Hub) should be called. If sendUsers or sendUsers is used mid-trip, a failure is noted by calling TripGenerator.fireTripFailedMidstream(long,Hub) (which should not be called except for multi-hop trips). For multi-hop trips, the TripGenerator.fireTripPauseStart(long,Hub) should be called to note that a trip has temporarily paused at an intermediate hub and TripGenerator.fireTripPauseEnd(long,Hub,HubDomain) to indicate that the trip is continuing after a pause.

      Note: when this method returns false, the traffic generator cannot be restarted.

      Specified by:
      action in class TripGenerator
      Returns:
      true if more trips can be generated; false otherwise
    • printConfiguration

      public void printConfiguration(String iPrefix, String prefix, boolean printName, PrintWriter out)
      Print the configuration for an instance of TripGenerator. The documentation for method SimObject.printConfiguration(String,String,boolean,java.io.PrintWriter) contains a description of how this method is used and how to override it. The method GenericActor.printConfiguration(String,String,boolean,java.io.PrintWriter) describes this method as it applies to all actors . The data that will be printed when this method is called are the following.

      For class TripGenerator:

      • the initial delay - the time to wait before trips are generated.

      Defined in BurstTripGenerator:

      • the burst time - he time at which trips are secheduled to leave from or arrive at the central hub. This is the exact time for the "fan-in" case and an estimate for the fan-out case.
      • the burst size - the number of trips that will be generated.
      • the fan-in flag - true if trips start at the central hub; false if trips end at the central hub.
      • the central hub - the destination hub when the fan-in value is true; the originating hub when the fan-in value is false.
      • the other-hub table - A table of hubs other than the central hub. Each entry contains the following:
        • the hub - a destination hub when the fan-in value is false; an originating hub when the fan-in value is true.
        • the branching probability - the probability that a trip uses the specified hub.
        • the overflow probability - the probability that the overflow area is chosen regardless of the hub state. This value is ignored when the fan-in value is true and is not printed for this case.
      Overrides:
      printConfiguration in class TripGenerator
      Parameters:
      iPrefix - the prefix to use for an initial line when printName is true with null treated as an empty string
      prefix - a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is true
      printName - requests printing the name of an object
      out - the output print writer
    • printState

      public void printState(String iPrefix, String prefix, boolean printName, PrintWriter out)
      Print the configuration for an instance of TripGenerator. The documentation for method SimObject.printState(String,String,boolean,java.io.PrintWriter) contains a description of how this method is used and how to override it. The method GenericSimObject.printState(String,String,boolean,java.io.PrintWriter) describes this method as it applies to all actors. In addition, the state that is printed includes the following items.

      Defined in TripGenerator:

      • whether or not the trip generator is running and the next time an action will be run if the trip generator is running.

      Defined for class BurstTripGenerator:

      • trips pending. The number of trips scheduled but not yet started.
      • trips completed. The number of trips that were completed.
      • trips in progress. The number of trips in progress.
      • trips failed. The number of trips that could not be completed.
      Overrides:
      printState in class TripGenerator
      Parameters:
      iPrefix - the prefix to use for an initial line when printName is true with null treated as an empty string
      prefix - a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is true
      printName - requests printing the name of an object
      out - the output print writer
    • clone

      protected Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • isInterned

      public boolean isInterned()
      Specified by:
      isInterned in interface NamedObjectOps
    • getObjectNamer

      protected Simulation getObjectNamer()
    • getName

      public final String getName()
      Specified by:
      getName in interface NamedObjectOps
    • canDelete

      public boolean canDelete()
      Specified by:
      canDelete in interface NamedObjectOps
    • delete

      public final boolean delete()
      Specified by:
      delete in interface NamedObjectOps
    • isDeleted

      public final boolean isDeleted()
      Specified by:
      isDeleted in interface NamedObjectOps
    • deletePending

      public final boolean deletePending()
      Specified by:
      deletePending in interface NamedObjectOps