Class CircularRoadModel

java.lang.Object
org.djutils.event.LocalEventProducer
nl.tudelft.simulation.dsol.model.AbstractDsolModel<Duration,OtsSimulatorInterface>
org.opentrafficsim.core.dsol.AbstractOtsModel
org.opentrafficsim.demo.CircularRoadModel
All Implemented Interfaces:
nl.tudelft.simulation.dsol.model.DsolModel<Duration,OtsSimulatorInterface>, UNITS, EventProducer, OtsModelInterface

public class CircularRoadModel extends AbstractOtsModel implements UNITS
Simulate traffic on a circular, two-lane road.

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

Author:
Peter Knoppers
  • Constructor Details

    • CircularRoadModel

      public CircularRoadModel(OtsSimulatorInterface simulator)
      Constructor.
      Parameters:
      simulator - the simulator for this model
  • Method Details

    • makeInputParameterMap

      public void makeInputParameterMap()
      Make a map of input parameters for this demo.
    • getPath

      public List<Lane> getPath(int index)
      Returns path.
      Parameters:
      index - the rank number of the path
      Returns:
      the set of lanes for the specified index
    • sample

      public void sample(TraceVerifier tv)
      Sample the state of the simulation.
      Parameters:
      tv - sampler or verifier of the state
    • constructModel

      public void constructModel() throws nl.tudelft.simulation.dsol.SimRuntimeException
      Specified by:
      constructModel in interface nl.tudelft.simulation.dsol.model.DsolModel<Duration,OtsSimulatorInterface>
      Throws:
      nl.tudelft.simulation.dsol.SimRuntimeException
    • generateGTU

      protected final void generateGTU(Length initialPosition, Lane lane, GtuType gtuType) throws GtuException, NetworkException, nl.tudelft.simulation.dsol.SimRuntimeException, nl.tudelft.simulation.dsol.model.inputparameters.InputParameterException
      Generate one gtu.
      Parameters:
      initialPosition - the initial position of the new cars
      lane - the lane on which the new cars are placed
      gtuType - the type of the new cars
      Throws:
      nl.tudelft.simulation.dsol.SimRuntimeException - cannot happen
      NetworkException - on network inconsistency
      GtuException - when something goes wrong during construction of the car
      nl.tudelft.simulation.dsol.model.inputparameters.InputParameterException - when generic.gradualLaneChange is not set
    • getNetwork

      public RoadNetwork getNetwork()
      Specified by:
      getNetwork in interface OtsModelInterface
    • getMinimumDistance

      public final Length getMinimumDistance()
      Returns the minimum distance.
      Returns:
      minimumDistance