Class CarTest

java.lang.Object
org.opentrafficsim.road.car.CarTest
All Implemented Interfaces:
UNITS

public final class CarTest extends Object implements UNITS

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
  • Method Details

    • carTest

      @Test public void carTest() throws NetworkException, nl.tudelft.simulation.dsol.SimRuntimeException, NamingException, GtuException
      Test some basics of the Car class.
      Throws:
      NetworkException - on ???
      nl.tudelft.simulation.dsol.SimRuntimeException - on ???
      NamingException - on ???
      GtuException - on ???
    • makeSimulator

      public static OtsSimulatorInterface makeSimulator() throws nl.tudelft.simulation.dsol.SimRuntimeException, NamingException
      Create the simplest possible simulator.
      Returns:
      DevsSimulator.TimeDoubleUnit
      Throws:
      nl.tudelft.simulation.dsol.SimRuntimeException - on ???
      NamingException - on ???
    • makeReferenceCar

      public static LaneBasedGtu makeReferenceCar(String id, GtuType gtuType, Lane lane, Length initialPosition, Speed initialSpeed, RoadNetwork network) throws NamingException, NetworkException, nl.tudelft.simulation.dsol.SimRuntimeException, GtuException
      Create a new Car.
      Parameters:
      id - the name (number) of the Car
      gtuType - the type of the new car
      lane - the lane on which the new Car is positioned
      initialPosition - the initial longitudinal position of the new Car
      initialSpeed - the initial speed
      network - the network
      Returns:
      the new Car
      Throws:
      NamingException - on network error when making the animation
      NetworkException - when the GTU cannot be placed on the given lane.
      nl.tudelft.simulation.dsol.SimRuntimeException - when the move method cannot be scheduled.
      GtuException - when construction of the GTU fails (probably due to an invalid parameter)
    • makeLane

      public static Lane makeLane(RoadNetwork network, LaneType laneType, OtsSimulatorInterface simulator) throws NetworkException
      Makes lane.
      Parameters:
      network - the network
      laneType - the type of the lane
      simulator - simulator
      Returns:
      a lane of 1000 m long.
      Throws:
      NetworkException - on network error