Class CircularRoadModel

  • All Implemented Interfaces:
    Serializable, DSOLModel<Duration,​org.opentrafficsim.core.dsol.OTSSimulatorInterface>, UNITS, EventProducerInterface, 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-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    $LastChangedDate: 2018-11-18 20:49:04 +0100 (Sun, 18 Nov 2018) $, @version $Revision: 4743 $, by $Author: averbraeck $, initial version 1 nov. 2014

    Author:
    Peter Knoppers
    See Also:
    Serialized Form
    • Constructor Detail

      • CircularRoadModel

        public CircularRoadModel​(org.opentrafficsim.core.dsol.OTSSimulatorInterface simulator)
        Parameters:
        simulator - OTSSimulatorInterface; the simulator for this model
    • Method Detail

      • 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​(TraceVerifier tv)
        Sample the state of the simulation.
        Parameters:
        tv - TraceVerifier; sampler or verifier of the state
      • 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 OTSRoadNetwork 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