Class CircularRoadModel

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

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

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

Author:
Peter Knoppers
See Also:
  • Constructor Details

    • CircularRoadModel

      public CircularRoadModel(org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator)
      Parameters:
      simulator - OtsSimulatorInterface; 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)
      Parameters:
      index - int; the rank number of the path
      Returns:
      List<Lane>; the set of lanes for the specified index
    • sample

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

      public void constructModel() throws SimRuntimeException
      Specified by:
      constructModel in interface DSOLModel<Duration,org.opentrafficsim.core.dsol.OtsSimulatorInterface>
      Throws:
      SimRuntimeException
    • generateGTU

      protected final void generateGTU(Length initialPosition, Lane lane, org.opentrafficsim.core.gtu.GtuType gtuType) throws org.opentrafficsim.core.gtu.GtuException, org.opentrafficsim.core.network.NetworkException, SimRuntimeException, org.opentrafficsim.core.geometry.OtsGeometryException, InputParameterException
      Generate one gtu.
      Parameters:
      initialPosition - Length; the initial position of the new cars
      lane - Lane; the lane on which the new cars are placed
      gtuType - GtuType; the type of the new cars
      Throws:
      SimRuntimeException - cannot happen
      org.opentrafficsim.core.network.NetworkException - on network inconsistency
      org.opentrafficsim.core.gtu.GtuException - when something goes wrong during construction of the car
      org.opentrafficsim.core.geometry.OtsGeometryException - when the initial position is outside the center line of the lane
      InputParameterException - when generic.gradualLaneChange is not set
    • getNetwork

      public RoadNetwork getNetwork()
      Specified by:
      getNetwork in interface org.opentrafficsim.core.dsol.OtsModelInterface
    • getMinimumDistance

      public final Length getMinimumDistance()
      Returns:
      minimumDistance
    • stopSimulator

      public void stopSimulator(org.opentrafficsim.core.dsol.OtsSimulatorInterface theSimulator, String errorMessage)
      Stop simulation and throw an Error.
      Parameters:
      theSimulator - OtsSimulatorInterface; the simulator
      errorMessage - String; the error message