Package org.opentrafficsim.demo
Class CircularRoadModel
-
- All Implemented Interfaces:
Serializable
,DSOLModel<Time,Duration,SimTimeDoubleUnit,OTSSimulatorInterface>
,DSOLModel.TimeDoubleUnit<OTSSimulatorInterface>
,UNITS
,EventProducerInterface
,OTSModelInterface
public class CircularRoadModel extends AbstractOTSModel implements UNITS
Simulate traffic on a circular, two-lane road.Copyright (c) 2013-2020 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class nl.tudelft.simulation.dsol.model.AbstractDSOLModel
AbstractDSOLModel.CalendarDouble<S extends SimulatorInterface.CalendarDouble>, AbstractDSOLModel.CalendarFloat<S extends SimulatorInterface.CalendarFloat>, AbstractDSOLModel.CalendarLong<S extends SimulatorInterface.CalendarLong>, AbstractDSOLModel.TimeDouble<S extends SimulatorInterface.TimeDouble>, AbstractDSOLModel.TimeDoubleUnit<S extends SimulatorInterface.TimeDoubleUnit>, AbstractDSOLModel.TimeFloat<S extends SimulatorInterface.TimeFloat>, AbstractDSOLModel.TimeFloatUnit<S extends SimulatorInterface.TimeFloatUnit>, AbstractDSOLModel.TimeLong<S extends SimulatorInterface.TimeLong>
-
Nested classes/interfaces inherited from interface nl.tudelft.simulation.dsol.model.DSOLModel
DSOLModel.CalendarDouble<S extends SimulatorInterface.CalendarDouble>, DSOLModel.CalendarFloat<S extends SimulatorInterface.CalendarFloat>, DSOLModel.CalendarLong<S extends SimulatorInterface.CalendarLong>, DSOLModel.TimeDouble<S extends SimulatorInterface.TimeDouble>, DSOLModel.TimeDoubleUnit<S extends SimulatorInterface.TimeDoubleUnit>, DSOLModel.TimeFloat<S extends SimulatorInterface.TimeFloat>, DSOLModel.TimeFloatUnit<S extends SimulatorInterface.TimeFloatUnit>, DSOLModel.TimeLong<S extends SimulatorInterface.TimeLong>
-
-
Field Summary
-
Fields inherited from class nl.tudelft.simulation.dsol.model.AbstractDSOLModel
inputParameterMap, outputStatistics, simulator
-
Fields inherited from class org.djutils.event.EventProducer
eventProducerImpl
-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
Fields inherited from interface org.djunits.unit.util.UNITS
ABAMPERE, ABCOULOMB, ABOHM, ABVOLT, ACRE, AMPERE, AMPERE_HOUR, ANGSTROM, ANGSTROM_ABS, ARCMINUTE, ARCMINUTE_PER_SECOND, ARCMINUTE_PER_SECOND_SQUARED, ARCSECOND, ARCSECOND_PER_SECOND, ARCSECOND_PER_SECOND_SQUARED, ARE, ASTRONOMICAL_UNIT, ASTRONOMICAL_UNIT_ABS, ATMOSPHERE_STANDARD, ATMOSPHERE_TECHNICAL, ATOMIC_UNIT, BAR, BARYE, BASE_DAY, BASE_HOUR, BASE_MICROSECOND, BASE_MILLISECOND, BASE_MINUTE, BASE_SECOND, BASE_WEEK, BECQUEREL, BTU_ISO, BTU_IT, CALORIE, CALORIE_IT, CANDELA, CENTESIMAL_ARCMINUTE, CENTESIMAL_ARCMINUTE_PER_SECOND, CENTESIMAL_ARCMINUTE_SQUARED, CENTESIMAL_ARCSECOND, CENTESIMAL_ARCSECOND_PER_SECOND, CENTESIMAL_ARCSECOND_PER_SECOND_SQUARED, CENTIARE, CENTIMETER, CENTIMETER_ABS, CENTIMETER_MERCURY, COULOMB, CUBIC_CENTIMETER, CUBIC_DECAMETER, CUBIC_DECIMETER, CUBIC_FEET_PER_MINUTE, CUBIC_FEET_PER_SECOND, CUBIC_FOOT, CUBIC_HECTOMETER, CUBIC_INCH, CUBIC_INCH_PER_MINUTE, CUBIC_INCH_PER_SECOND, CUBIC_KILOMETER, CUBIC_LIGHTYEAR, CUBIC_METER, CUBIC_METER_PER_DAY, CUBIC_METER_PER_HOUR, CUBIC_METER_PER_MINUTE, CUBIC_METER_PER_SECOND, CUBIC_MILE, CUBIC_MILLIMETER, CUBIC_NAUTICAL_MILE, CUBIC_PARSEC, CUBIC_YARD, CURIE, DALTON, DAY, DECAMETER, DECAMETER_ABS, DECIMETER, DECIMETER_ABS, DEGREE, DEGREE_CELSIUS, DEGREE_CELSIUS_ABS, DEGREE_FAHRENHEIT, DEGREE_FAHRENHEIT_ABS, DEGREE_PER_SECOND, DEGREE_PER_SECOND_SQUARED, DEGREE_RANKINE, DEGREE_RANKINE_ABS, DEGREE_REAUMUR, DEGREE_REAUMUR_ABS, DYNE, EAST_DEGREE, EAST_RADIAN, EMU, ENERGY_ELECTRONVOLT, ENERGY_GIGAELECTRONVOLT, ENERGY_KILOELECTRONVOLT, ENERGY_MEGAELECTRONVOLT, ENERGY_MICROELECTRONVOLT, ENERGY_MILLIELECTRONVOLT, EPOCH_DAY, EPOCH_HOUR, EPOCH_J2000_SECOND, EPOCH_MICROSECOND, EPOCH_MILLISECOND, EPOCH_MINUTE, EPOCH_SECOND, EPOCH_WEEK, EPOCH_YEAR1_SECOND, ERG, ERG_PER_GRAM, ERG_PER_SECOND, ESU, FARAD, FARADAY, FLUID_OUNCE_IMP, FLUID_OUNCE_US, FOOT, FOOT_ABS, FOOT_MERCURY, FOOT_PER_HOUR, FOOT_PER_MINUTE, FOOT_PER_SECOND, FOOT_PER_SECOND_2, FOOT_POUND_FORCE, FOOT_POUND_FORCE_PER_HOUR, FOOT_POUND_FORCE_PER_MINUTE, FOOT_POUND_FORCE_PER_SECOND, FRANKLIN, GAL, GALLON_IMP, GALLON_US, GALLON_US_PER_DAY, GALLON_US_PER_HOUR, GALLON_US_PER_MINUTE, GALLON_US_PER_SECOND, GAUSS, GIGABECQUEREL, GIGAHERTZ, GIGAJOULE, GIGAOHM, GIGAVOLT, GIGAWATT, GIGAWATT_HOUR, GRAD, GRAD_PER_SECOND, GRAD_PER_SECOND_SQUARED, GRAM, GRAM_PER_CENTIMETER_3, GRAY, HECTARE, HECTOMETER, HECTOMETER_ABS, HECTOPASCAL, HENRY, HERTZ, HORSEPOWER_METRIC, HOUR, INCH, INCH_ABS, INCH_MERCURY, INCH_PER_HOUR, INCH_PER_MINUTE, INCH_PER_SECOND, INCH_PER_SECOND_2, INCH_POUND_FORCE, JOULE, KATAL, KELVIN, KELVIN_ABS, KG_PER_METER_3, KGF_PER_SQUARE_MM, KILOAMPERE, KILOAMPERE_HOUR, KILOBECQUEREL, KILOCALORIE, KILOGRAM, KILOGRAM_FORCE, KILOGRAM_METER_PER_SECOND, KILOGRAM_PER_SECOND, KILOHERTZ, KILOJOULE, KILOLUX, KILOMETER, KILOMETER_ABS, KILOOHM, KILOPASCAL, KILOVOLT, KILOWATT, KILOWATT_HOUR, KM_PER_HOUR, KM_PER_HOUR_2, KM_PER_SECOND, KNOT, KNOT_PER_SECOND, LIGHTYEAR, LIGHTYEAR_ABS, LITER, LITER_PER_DAY, LITER_PER_HOUR, LITER_PER_MINUTE, LITER_PER_SECOND, LUMEN, LUX, MASS_ELECTRONVOLT, MASS_GIGAELECTRONVOLT, MASS_KILOELECTRONVOLT, MASS_MEGAELECTRONVOLT, MASS_MICROELECTRONVOLT, MASS_MILLIELECTRONVOLT, MAXWELL, MEGAAMPERE, MEGAAMPERE_HOUR, MEGABECQUEREL, MEGAHERTZ, MEGAJOULE, MEGAOHM, MEGAVOLT, MEGAWATT, MEGAWATT_HOUR, METER, METER_ABS, METER_KILOGRAM_FORCE, METER_PER_HOUR, METER_PER_SECOND, METER_PER_SECOND_2, MICROAMPERE, MICROCOULOMB, MICROCURIE, MICROFARAD, MICROGRAM, MICROGRAY, MICROHENRY, MICROJOULE, MICROKATAL, MICROLUX, MICROMETER, MICROMETER_ABS, MICROMOLE, MICROOHM, MICROSECOND, MICROSIEMENS, MICROSIEVERT, MICROTESLA, MICROVOLT, MICROWATT, MICROWATT_HOUR, MICROWEBER, MILE, MILE_ABS, MILE_PER_HOUR, MILE_PER_HOUR_2, MILE_PER_HOUR_PER_SECOND, MILE_PER_MINUTE, MILE_PER_SECOND, MILE_PER_SECOND_2, MILLIAMPERE, MILLIAMPERE_HOUR, MILLIAMPERE_SECOND, MILLIBAR, MILLICOULOMB, MILLICURIE, MILLIFARAD, MILLIGRAM, MILLIGRAY, MILLIHENRY, MILLIJOULE, MILLIKATAL, MILLILUX, MILLIMETER, MILLIMETER_ABS, MILLIMETER_MERCURY, MILLIMOLE, MILLIOHM, MILLISECOND, MILLISIEMENS, MILLISIEVERT, MILLITESLA, MILLIVOLT, MILLIWATT, MILLIWATT_HOUR, MILLIWEBER, MINUTE, MOLE, NANOCURIE, NANOFARAD, NANOHENRY, NANOKATAL, NANOMETER, NANOMETER_ABS, NANOMOLE, NANOSIEMENS, NANOTESLA, NANOWEBER, NAUTICAL_MILE, NAUTICAL_MILE_ABS, NEWTON, NEWTON_METER, NORTH_DEGREE, NORTH_RADIAN, NOX, OHM, OUNCE, OUNCE_FORCE, PARSEC, PARSEC_ABS, PASCAL, PER_ANGSTROM, PER_ASTRONOMICAL_UNIT, PER_CENTIMETER, PER_DAY, PER_DECAMETER, PER_DECIMETER, PER_FOOT, PER_HECTOMETER, PER_HOUR, PER_INCH, PER_KILOMETER, PER_LIGHTYEAR, PER_METER, PER_MICROMETER, PER_MICROSECOND, PER_MILE, PER_MILLIMETER, PER_MILLISECOND, PER_MINUTE, PER_NAUTICAL_MILE, PER_PARSEC, PER_SECOND, PER_WEEK, PER_YARD, PERCENT, PETABECQUEREL, PETAJOULE, PETAWATT, PETAWATT_HOUR, PHOT, PICOFARAD, PIEZE, PINT_IMP, PINT_US, POUND, POUND_FOOT, POUND_FORCE, POUND_INCH, POUND_PER_SECOND, POUND_PER_SQUARE_FOOT, POUND_PER_SQUARE_INCH, QUART_IMP, QUART_US, RAD, RADIAN, RADIAN_PER_SECOND, RADIAN_PER_SECOND_SQUARED, REM, RPM, RUTHERFORD, SECOND, SIEMENS, SIEVERT, SQUARE_CENTIMETER, SQUARE_DECAMETER, SQUARE_DECIMETER, SQUARE_DEGREE, SQUARE_FOOT, SQUARE_HECTOMETER, SQUARE_INCH, SQUARE_KILOMETER, SQUARE_METER, SQUARE_MILE, SQUARE_MILLIMETER, SQUARE_NAUTICAL_MILE, SQUARE_YARD, STANDARD_GRAVITY, STATAMPERE, STATCOULOMB, STATOHM, STATVOLT, STERADIAN, STHENE, STHENE_METER, STHENE_METER_PER_SECOND, TERABECQUEREL, TERAHERTZ, TERAJOULE, TERAWATT, TERAWATT_HOUR, TESLA, TON_FORCE, TON_LONG, TON_METRIC, TON_SHORT, TONNE, TORR, UNIT, VOLT, WATT, WATT_HOUR, WEBER, WEEK, YARD, YARD_ABS
-
-
Constructor Summary
Constructors Constructor Description CircularRoadModel(OTSSimulatorInterface simulator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
constructModel()
protected void
generateGTU(Length initialPosition, Lane lane, GTUType gtuType)
Generate one gtu.Length
getMinimumDistance()
OTSRoadNetwork
getNetwork()
List<Lane>
getPath(int index)
Serializable
getSourceId()
void
makeInputParameterMap()
Make a map of input parameters for this demo.void
sample(TraceVerifier tv)
Sample the state of the simulation.void
stopSimulator(DEVSSimulatorInterface.TimeDoubleUnit theSimulator, String errorMessage)
Stop simulation and throw an Error.-
Methods inherited from class org.opentrafficsim.core.dsol.AbstractOTSModel
getDescription, getShortName, setDescription, setShortName
-
Methods inherited from class nl.tudelft.simulation.dsol.model.AbstractDSOLModel
addInputParameter, getInputParameter, getInputParameterMap, getOutputStatistics, getSimulator
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface nl.tudelft.simulation.dsol.model.DSOLModel
getInputParameterMap, getOutputStatistics, getSimulator
-
-
-
-
Constructor Detail
-
CircularRoadModel
public CircularRoadModel(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
-
constructModel
public void constructModel() throws SimRuntimeException
- Specified by:
constructModel
in interfaceDSOLModel<Time,Duration,SimTimeDoubleUnit,OTSSimulatorInterface>
- Throws:
SimRuntimeException
-
generateGTU
protected final void generateGTU(Length initialPosition, Lane lane, GTUType gtuType) throws GTUException, NetworkException, SimRuntimeException, OTSGeometryException, InputParameterException
Generate one gtu.- Parameters:
initialPosition
- Length; the initial position of the new carslane
- Lane; the lane on which the new cars are placedgtuType
- GTUType; the type of the new cars- Throws:
SimRuntimeException
- cannot happenNetworkException
- on network inconsistencyGTUException
- when something goes wrong during construction of the carOTSGeometryException
- when the initial position is outside the center line of the laneInputParameterException
- when generic.gradualLaneChange is not set
-
getNetwork
public OTSRoadNetwork getNetwork()
- Specified by:
getNetwork
in interfaceOTSModelInterface
-
getMinimumDistance
public final Length getMinimumDistance()
- Returns:
- minimumDistance
-
stopSimulator
public void stopSimulator(DEVSSimulatorInterface.TimeDoubleUnit theSimulator, String errorMessage)
Stop simulation and throw an Error.- Parameters:
theSimulator
- DEVSSimulatorInterface.TimeDoubleUnit; the simulatorerrorMessage
- String; the error message
-
getSourceId
public Serializable getSourceId()
- Specified by:
getSourceId
in interfaceEventProducerInterface
- Specified by:
getSourceId
in classEventProducer
-
-