The following document contains the results of PMD's CPD 5.1.2.
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\FundamentalDiagrams.java | 301 |
org\opentrafficsim\demo\carFollowing\Trajectories.java | 296 |
exception.printStackTrace(); } for (AbstractProperty<?> p : this.properties) { if (p instanceof SelectionProperty) { SelectionProperty sp = (SelectionProperty) p; if ("Car following model".equals(sp.getShortName())) { String modelName = sp.getValue(); if (modelName.equals("IDM")) { this.carFollowingModelCars = new IDM(new DoubleScalar.Abs<AccelerationUnit>(1, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Abs<AccelerationUnit>(1.5, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Rel<LengthUnit>(2, LengthUnit.METER), new DoubleScalar.Rel<TimeUnit>(1, TimeUnit.SECOND), 1d); this.carFollowingModelTrucks = new IDM(new DoubleScalar.Abs<AccelerationUnit>(0.5, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Abs<AccelerationUnit>(1.5, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Rel<LengthUnit>(2, LengthUnit.METER), new DoubleScalar.Rel<TimeUnit>(1, TimeUnit.SECOND), 1d); } else if (modelName.equals("IDM+")) { this.carFollowingModelCars = new IDMPlus(new DoubleScalar.Abs<AccelerationUnit>(1, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Abs<AccelerationUnit>(1.5, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Rel<LengthUnit>(2, LengthUnit.METER), new DoubleScalar.Rel<TimeUnit>(1, TimeUnit.SECOND), 1d); this.carFollowingModelTrucks = new IDMPlus(new DoubleScalar.Abs<AccelerationUnit>(0.5, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Abs<AccelerationUnit>(1.5, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Rel<LengthUnit>(2, LengthUnit.METER), new DoubleScalar.Rel<TimeUnit>(1, TimeUnit.SECOND), 1d); } else { throw new Error("Car following model " + modelName + " not implemented"); } } else { throw new Error("Unhandled SelectionProperty " + p.getShortName()); } } else if (p instanceof ProbabilityDistributionProperty) { ProbabilityDistributionProperty pdp = (ProbabilityDistributionProperty) p; String modelName = p.getShortName(); if (modelName.equals("Traffic composition")) { this.carProbability = pdp.getValue()[0]; } else { throw new Error("Unhandled ProbabilityDistributionProperty " + p.getShortName()); } } else { throw new Error("Unhandled property: " + p); } } // 1500 [veh / hour] == 2.4s headway this.headway = new DoubleScalar.Rel<TimeUnit>(3600.0 / 1500.0, TimeUnit.SECOND); try { // Schedule creation of the first car (this will re-schedule itself one headway later, etc.). this.simulator.scheduleEventAbs(new DoubleScalar.Abs<TimeUnit>(0.0, TimeUnit.SECOND), this, this, "generateCar", null); // Create a block at t = 5 minutes this.simulator.scheduleEventAbs(new DoubleScalar.Abs<TimeUnit>(300, TimeUnit.SECOND), this, this, "createBlock", null); // Remove the block at t = 7 minutes this.simulator.scheduleEventAbs(new DoubleScalar.Abs<TimeUnit>(420, TimeUnit.SECOND), this, this, "removeBlock", |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 383 |
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 422 |
if (modelName.equals("Traffic composition")) { this.carProbability = pdp.getValue()[0]; } } else if (ap instanceof IntegerProperty) { IntegerProperty ip = (IntegerProperty) ap; if ("Track length".equals(ip.getShortName())) { radius = ip.getValue() / 2 / Math.PI; } } else if (ap instanceof ContinuousProperty) { ContinuousProperty cp = (ContinuousProperty) ap; if (cp.getShortName().equals("Mean density")) { headway = 1000 / cp.getValue(); } if (cp.getShortName().equals("Density variability")) { headwayVariability = cp.getValue(); } } else if (ap instanceof CompoundProperty) { CompoundProperty cp = (CompoundProperty) ap; if (ap.getShortName().equals("Output")) { continue; // Output settings are handled elsewhere } if (ap.getShortName().contains("IDM")) { // System.out.println("Car following model name appears to be " + ap.getShortName()); DoubleScalar.Abs<AccelerationUnit> a = IDMPropertySet.getA(cp); DoubleScalar.Abs<AccelerationUnit> b = IDMPropertySet.getB(cp); DoubleScalar.Rel<LengthUnit> s0 = IDMPropertySet.getS0(cp); DoubleScalar.Rel<TimeUnit> tSafe = IDMPropertySet.getTSafe(cp); GTUFollowingModel gtuFollowingModel = null; if (carFollowingModelName.equals("IDM")) { gtuFollowingModel = new IDM(a, b, s0, tSafe, 1.0); } else if (carFollowingModelName.equals("IDM+")) { gtuFollowingModel = new IDMPlus(a, b, s0, tSafe, 1.0); } else { throw new Error("Unknown gtu following model: " + carFollowingModelName); } if (ap.getShortName().contains(" Car ")) { this.carFollowingModelCars = gtuFollowingModel; } else if (ap.getShortName().contains(" Truck ")) { this.carFollowingModelTrucks = gtuFollowingModel; } else { throw new Error("Cannot determine gtu type for " + ap.getShortName()); } } /* * System.out.println("Created " + carFollowingModelName + " for " + p.getShortName()); * System.out.println("a: " + a); System.out.println("b: " + b); System.out.println("s0: " + s0); * System.out.println("tSafe: " + tSafe); */ } } |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 167 |
org\opentrafficsim\demo\carFollowing\Straight.java | 176 |
new CompoundProperty("", "", userModifiedProperties, false, 0).findByShortName("Output"); if (null == output) { throw new Error("Cannot find output properties"); } ArrayList<BooleanProperty> graphs = new ArrayList<BooleanProperty>(); if (output instanceof CompoundProperty) { CompoundProperty outputProperties = (CompoundProperty) output; for (AbstractProperty<?> ap : outputProperties.getValue()) { if (ap instanceof BooleanProperty) { BooleanProperty bp = (BooleanProperty) ap; if (bp.getValue()) { graphs.add(bp); } } } } else { throw new Error("output properties should be compound"); } int graphCount = graphs.size(); int columns = (int) Math.ceil(Math.sqrt(graphCount)); int rows = 0 == columns ? 0 : (int) Math.ceil(graphCount * 1.0 / columns); TablePanel charts = new TablePanel(columns, rows); result.getPanel().getTabbedPane().addTab("statistics", charts); for (int i = 0; i < graphCount; i++) { String graphName = graphs.get(i).getShortName(); Container container = null; LaneBasedGTUSampler graph; if (graphName.contains("Trajectories")) { TrajectoryPlot tp = new TrajectoryPlot("TrajectoryPlot", new DoubleScalar.Rel<TimeUnit>(0.5, TimeUnit.SECOND), model .getMinimumDistance(), model.lane1.getLength()); |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\FundamentalDiagrams.java | 411 |
org\opentrafficsim\demo\carFollowing\Straight.java | 531 |
catch (NamingException exception) { exception.printStackTrace(); } } /** * Remove the block. */ protected final void removeBlock() { this.block = null; } /** * Generate cars at a fixed rate (implemented by re-scheduling this method). * @throws NamingException on ??? */ protected final void generateCar() { boolean generateTruck = this.randomGenerator.nextDouble() > this.carProbability; DoubleScalar.Rel<LengthUnit> initialPosition = new DoubleScalar.Rel<LengthUnit>(0, LengthUnit.METER); DoubleScalar.Abs<SpeedUnit> initialSpeed = new DoubleScalar.Abs<SpeedUnit>(100, SpeedUnit.KM_PER_HOUR); Map<Lane, DoubleScalar.Rel<LengthUnit>> initialPositions = new HashMap<Lane, DoubleScalar.Rel<LengthUnit>>(); initialPositions.put(this.lane, initialPosition); try { DoubleScalar.Rel<LengthUnit> vehicleLength = new DoubleScalar.Rel<LengthUnit>(generateTruck ? 15 : 4, LengthUnit.METER); IDMCar car = new IDMCar(++this.carsCreated, null, this.simulator, generateTruck ? this.carFollowingModelTrucks : this.carFollowingModelCars, vehicleLength, this.simulator.getSimulatorTime().get(), initialPositions, initialSpeed); this.cars.add(0, car); this.simulator.scheduleEventRel(this.headway, this, this, "generateCar", null); } catch (RemoteException | SimRuntimeException | NamingException | NetworkException exception) { exception.printStackTrace(); } } |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 114 |
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 130 |
ArrayList<AbstractProperty<?>> properties = circularLane.getProperties(); try { properties.add(new ProbabilityDistributionProperty("Traffic composition", "<html>Mix of passenger cars and trucks</html>", new String[] {"passenger car", "truck"}, new Double[] {0.8, 0.2}, false, 10)); } catch (PropertyException exception) { exception.printStackTrace(); } properties.add(new SelectionProperty("Car following model", "<html>The car following model determines " + "the acceleration that a vehicle will make taking into account " + "nearby vehicles, infrastructural restrictions (e.g. speed limit, " + "curvature of the road) capabilities of the vehicle and personality " + "of the driver.</html>", new String[] {"IDM", "IDM+"}, 1, false, 1)); properties.add(IDMPropertySet.makeIDMPropertySet("Car", new DoubleScalar.Abs<AccelerationUnit>(1.0, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Abs<AccelerationUnit>(1.5, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Rel<LengthUnit>(2.0, LengthUnit.METER), new DoubleScalar.Rel<TimeUnit>(1.0, TimeUnit.SECOND), 2)); properties.add(IDMPropertySet.makeIDMPropertySet("Truck", new DoubleScalar.Abs<AccelerationUnit>(0.5, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Abs<AccelerationUnit>(1.25, AccelerationUnit.METER_PER_SECOND_2), new DoubleScalar.Rel<LengthUnit>(2.0, LengthUnit.METER), new DoubleScalar.Rel<TimeUnit>(1.0, TimeUnit.SECOND), 3)); new SimulatorFrame("Circular Lane animation", circularLane.buildSimulator(properties).getPanel()); |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 406 |
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 445 |
org\opentrafficsim\demo\carFollowing\Straight.java | 418 |
} } else if (ap instanceof CompoundProperty) { CompoundProperty cp = (CompoundProperty) ap; if (ap.getShortName().equals("Output")) { continue; // Output settings are handled elsewhere } if (ap.getShortName().contains("IDM")) { // System.out.println("Car following model name appears to be " + ap.getShortName()); DoubleScalar.Abs<AccelerationUnit> a = IDMPropertySet.getA(cp); DoubleScalar.Abs<AccelerationUnit> b = IDMPropertySet.getB(cp); DoubleScalar.Rel<LengthUnit> s0 = IDMPropertySet.getS0(cp); DoubleScalar.Rel<TimeUnit> tSafe = IDMPropertySet.getTSafe(cp); GTUFollowingModel gtuFollowingModel = null; if (carFollowingModelName.equals("IDM")) { gtuFollowingModel = new IDM(a, b, s0, tSafe, 1.0); } else if (carFollowingModelName.equals("IDM+")) { gtuFollowingModel = new IDMPlus(a, b, s0, tSafe, 1.0); } else { throw new Error("Unknown gtu following model: " + carFollowingModelName); } if (ap.getShortName().contains(" Car ")) { this.carFollowingModelCars = gtuFollowingModel; } else if (ap.getShortName().contains(" Truck ")) { this.carFollowingModelTrucks = gtuFollowingModel; } else { throw new Error("Cannot determine gtu type for " + ap.getShortName()); } } /* * System.out.println("Created " + carFollowingModelName + " for " + p.getShortName()); * System.out.println("a: " + a); System.out.println("b: " + b); System.out.println("s0: " + s0); * System.out.println("tSafe: " + tSafe); */ } } |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 182 |
org\opentrafficsim\demo\carFollowing\Straight.java | 176 |
AbstractProperty<?> output = new CompoundProperty("", "", this.properties, false, 0).findByShortName("Output"); if (null == output) { throw new Error("Cannot find output properties"); } ArrayList<BooleanProperty> graphs = new ArrayList<BooleanProperty>(); if (output instanceof CompoundProperty) { CompoundProperty outputProperties = (CompoundProperty) output; for (AbstractProperty<?> ap : outputProperties.getValue()) { if (ap instanceof BooleanProperty) { BooleanProperty bp = (BooleanProperty) ap; if (bp.getValue()) { graphs.add(bp); } } } } else { throw new Error("output properties should be compound"); } int graphCount = graphs.size(); int columns = (int) Math.ceil(Math.sqrt(graphCount)); int rows = 0 == columns ? 0 : (int) Math.ceil(graphCount * 1.0 / columns); TablePanel charts = new TablePanel(columns, rows); result.getPanel().getTabbedPane().addTab("statistics", charts); for (int i = 0; i < graphCount; i++) { String graphName = graphs.get(i).getShortName(); Container container = null; LaneBasedGTUSampler graph; |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 167 |
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 182 |
new CompoundProperty("", "", userModifiedProperties, false, 0).findByShortName("Output"); if (null == output) { throw new Error("Cannot find output properties"); } ArrayList<BooleanProperty> graphs = new ArrayList<BooleanProperty>(); if (output instanceof CompoundProperty) { CompoundProperty outputProperties = (CompoundProperty) output; for (AbstractProperty<?> ap : outputProperties.getValue()) { if (ap instanceof BooleanProperty) { BooleanProperty bp = (BooleanProperty) ap; if (bp.getValue()) { graphs.add(bp); } } } } else { throw new Error("output properties should be compound"); } int graphCount = graphs.size(); int columns = (int) Math.ceil(Math.sqrt(graphCount)); int rows = 0 == columns ? 0 : (int) Math.ceil(graphCount * 1.0 / columns); TablePanel charts = new TablePanel(columns, rows); result.getPanel().getTabbedPane().addTab("statistics", charts); for (int i = 0; i < graphCount; i++) { String graphName = graphs.get(i).getShortName(); Container container = null; LaneBasedGTUSampler graph; |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 345 |
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 370 |
double radius = 2000 / 2 / Math.PI; double headway = 40; double headwayVariability = 0; try { String carFollowingModelName = null; CompoundProperty propertyContainer = new CompoundProperty("", "", this.properties, false, 0); AbstractProperty<?> cfmp = propertyContainer.findByShortName("Car following model"); if (null == cfmp) { throw new Error("Cannot find \"Car following model\" property"); } if (cfmp instanceof SelectionProperty) { carFollowingModelName = ((SelectionProperty) cfmp).getValue(); } else { throw new Error("\"Car following model\" property has wrong type"); } Iterator<AbstractProperty<ArrayList<AbstractProperty<?>>>> iterator = new CompoundProperty("", "", this.properties, false, 0).iterator(); while (iterator.hasNext()) { AbstractProperty<?> ap = iterator.next(); // System.out.println("Handling property " + ap.getShortName()); if (ap instanceof SelectionProperty) { SelectionProperty sp = (SelectionProperty) ap; if ("Car following model".equals(sp.getShortName())) { carFollowingModelName = sp.getValue(); } |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 89 |
org\opentrafficsim\demo\carFollowing\Straight.java | 82 |
ArrayList<AbstractProperty<?>> outputProperties = new ArrayList<AbstractProperty<?>>(); outputProperties.add(new BooleanProperty("Density", "Density contour plot", true, false, 0)); outputProperties.add(new BooleanProperty("Flow", "Flow contour plot", true, false, 1)); outputProperties.add(new BooleanProperty("Speed", "Speed contour plot", true, false, 2)); outputProperties.add(new BooleanProperty("Acceleration", "Acceleration contour plot", true, false, 3)); outputProperties.add(new BooleanProperty("Trajectories", "Trajectory (time/distance) diagram", true, false, 4)); this.properties.add(new CompoundProperty("Output", "Select the graphical output", outputProperties, true, 1000)); } /** * Main program. * @param args String[]; the command line arguments (not used) * @throws SimRuntimeException * @throws RemoteException */ public static void main(final String[] args) throws RemoteException, SimRuntimeException { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 350 |
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 375 |
org\opentrafficsim\demo\carFollowing\Straight.java | 380 |
String carFollowingModelName = null; CompoundProperty propertyContainer = new CompoundProperty("", "", this.properties, false, 0); AbstractProperty<?> cfmp = propertyContainer.findByShortName("Car following model"); if (null == cfmp) { throw new Error("Cannot find \"Car following model\" property"); } if (cfmp instanceof SelectionProperty) { carFollowingModelName = ((SelectionProperty) cfmp).getValue(); } else { throw new Error("\"Car following model\" property has wrong type"); } Iterator<AbstractProperty<ArrayList<AbstractProperty<?>>>> iterator = new CompoundProperty("", "", this.properties, false, 0).iterator(); while (iterator.hasNext()) { AbstractProperty<?> ap = iterator.next(); // System.out.println("Handling property " + ap.getShortName()); if (ap instanceof SelectionProperty) { SelectionProperty sp = (SelectionProperty) ap; if ("Car following model".equals(sp.getShortName())) { |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\Straight.java | 554 |
org\opentrafficsim\demo\carFollowing\Trajectories.java | 423 |
initialPositions.put(this.lane, initialPosition); try { DoubleScalar.Rel<LengthUnit> vehicleLength = new DoubleScalar.Rel<LengthUnit>(generateTruck ? 15 : 4, LengthUnit.METER); IDMCar car = new IDMCar(++this.carsCreated, null, this.simulator, generateTruck ? this.carFollowingModelTrucks : this.carFollowingModelCars, vehicleLength, this.simulator.getSimulatorTime().get(), initialPositions, initialSpeed); this.cars.add(0, car); this.simulator.scheduleEventRel(this.headway, this, this, "generateCar", null); } catch (RemoteException | SimRuntimeException | NamingException | NetworkException exception) { exception.printStackTrace(); } } /** {@inheritDoc} */ @Override public final SimulatorInterface<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble> getSimulator() throws RemoteException { return this.simulator; } |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\FundamentalDiagrams.java | 280 |
org\opentrafficsim\demo\carFollowing\Trajectories.java | 275 |
public FundamentalDiagramPlotsModel(ArrayList<AbstractProperty<?>> properties) { this.properties = properties; } /** {@inheritDoc} */ @Override public final void constructModel( final SimulatorInterface<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble> theSimulator) throws SimRuntimeException, RemoteException { this.simulator = (OTSDEVSSimulatorInterface) theSimulator; Node from = new Node("From", new Coordinate(getMinimumDistance().getSI(), 0, 0)); Node to = new Node("To", new Coordinate(getMaximumDistance().getSI(), 0, 0)); LaneType<String> laneType = new LaneType<String>("CarLane"); try { this.lane = LaneFactory.makeLane("Lane", from, to, null, laneType, this.simulator); } catch (NamingException | NetworkException exception) |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\FundamentalDiagrams.java | 372 |
org\opentrafficsim\demo\carFollowing\Straight.java | 469 |
this.simulator.scheduleEventAbs(new DoubleScalar.Abs<TimeUnit>(0.0, TimeUnit.SECOND), this, this, "generateCar", null); // Create a block at t = 5 minutes this.simulator.scheduleEventAbs(new DoubleScalar.Abs<TimeUnit>(300, TimeUnit.SECOND), this, this, "createBlock", null); // Remove the block at t = 7 minutes this.simulator.scheduleEventAbs(new DoubleScalar.Abs<TimeUnit>(420, TimeUnit.SECOND), this, this, "removeBlock", null); // Schedule regular updates of the graph for (int t = 1; t <= 1800; t++) { this.simulator.scheduleEventAbs(new DoubleScalar.Abs<TimeUnit>(t - 0.001, TimeUnit.SECOND), this, this, "drawGraphs", null); } } catch (RemoteException | SimRuntimeException exception) |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\FundamentalDiagrams.java | 520 |
org\opentrafficsim\demo\carFollowing\Straight.java | 628 |
final GTUFollowingModel carFollowingModel, DoubleScalar.Rel<LengthUnit> vehicleLength, final DoubleScalar.Abs<TimeUnit> initialTime, final Map<Lane, DoubleScalar.Rel<LengthUnit>> initialLongitudinalPositions, final DoubleScalar.Abs<SpeedUnit> initialSpeed) throws RemoteException, NamingException, NetworkException, SimRuntimeException { super(id, gtuType, carFollowingModel, initialLongitudinalPositions, initialSpeed, vehicleLength, new DoubleScalar.Rel<LengthUnit>(1.8, LengthUnit.METER), new DoubleScalar.Abs<SpeedUnit>(200, SpeedUnit.KM_PER_HOUR), simulator); try { simulator.scheduleEventAbs(simulator.getSimulatorTime(), this, this, "move", null); } catch (SimRuntimeException exception) { exception.printStackTrace(); } } /** * @throws RemoteException on communication failure * @throws NetworkException on network inconsistency * @throws SimRuntimeException on ??? */ protected final void move() throws RemoteException, NetworkException, SimRuntimeException |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 621 |
org\opentrafficsim\demo\carFollowing\Trajectories.java | 448 |
} /** Inner class IDMCar. */ protected class IDMCar extends Car<Integer> { /** */ private static final long serialVersionUID = 20141030L; /** * Create a new IDMCar. * @param id integer; the id of the new IDMCar * @param gtuType GTUType<String>; the type of the GTU * @param simulator OTSDEVSSimulator; the simulator that runs the new IDMCar * @param carFollowingModel CarFollowingModel; the car following model of the new IDMCar * @param vehicleLength DoubleScalar.Rel<LengthUnit>; the length of the new IDMCar * @param initialTime DoubleScalar.Abs<TimeUnit>; the time of first evaluation of the new IDMCar * @param initialLongitudinalPositions Map<Lane, DoubleScalar.Rel<LengthUnit>>; the initial lane positions * of the new IDMCar * @param initialSpeed DoubleScalar.Abs<SpeedUnit>; the initial speed of the new IDMCar * @throws NamingException on ??? * @throws RemoteException on Communications failure */ public IDMCar(final int id, GTUType<String> gtuType, final OTSDEVSSimulatorInterface simulator, final GTUFollowingModel carFollowingModel, DoubleScalar.Rel<LengthUnit> vehicleLength, final DoubleScalar.Abs<TimeUnit> initialTime, final Map<Lane, DoubleScalar.Rel<LengthUnit>> initialLongitudinalPositions, final DoubleScalar.Abs<SpeedUnit> initialSpeed) throws RemoteException, NamingException, SimRuntimeException, NetworkException { super(id, gtuType, carFollowingModel, initialLongitudinalPositions, initialSpeed, vehicleLength, new DoubleScalar.Rel<LengthUnit>(1.8, LengthUnit.METER), new DoubleScalar.Abs<SpeedUnit>(200, SpeedUnit.KM_PER_HOUR), simulator); try { |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\FundamentalDiagrams.java | 400 |
org\opentrafficsim\demo\carFollowing\Straight.java | 520 |
{ DoubleScalar.Rel<LengthUnit> initialPosition = new DoubleScalar.Rel<LengthUnit>(4000, LengthUnit.METER); Map<Lane, DoubleScalar.Rel<LengthUnit>> initialPositions = new HashMap<Lane, DoubleScalar.Rel<LengthUnit>>(); initialPositions.put(this.lane, initialPosition); try { this.block = new IDMCar(999999, null, this.simulator, this.carFollowingModelCars, new DoubleScalar.Rel<LengthUnit>(4, LengthUnit.METER), this.simulator.getSimulatorTime().get(), initialPositions, new DoubleScalar.Abs<SpeedUnit>(0, SpeedUnit.KM_PER_HOUR)); } catch (NamingException exception) |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\FundamentalDiagrams.java | 435 |
org\opentrafficsim\demo\carFollowing\Trajectories.java | 423 |
initialPositions.put(this.lane, initialPosition); try { DoubleScalar.Rel<LengthUnit> vehicleLength = new DoubleScalar.Rel<LengthUnit>(generateTruck ? 15 : 4, LengthUnit.METER); IDMCar car = new IDMCar(++this.carsCreated, null, this.simulator, generateTruck ? this.carFollowingModelTrucks : this.carFollowingModelCars, vehicleLength, this.simulator.getSimulatorTime().get(), initialPositions, initialSpeed); this.cars.add(0, car); this.simulator.scheduleEventRel(this.headway, this, this, "generateCar", null); } catch (RemoteException | SimRuntimeException | NamingException | NetworkException exception) { exception.printStackTrace(); } } |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 653 |
org\opentrafficsim\demo\carFollowing\FundamentalDiagrams.java | 519 |
public IDMCar(final int id, GTUType<String> gtuType, final OTSDEVSSimulatorInterface simulator, final GTUFollowingModel carFollowingModel, DoubleScalar.Rel<LengthUnit> vehicleLength, final DoubleScalar.Abs<TimeUnit> initialTime, final Map<Lane, DoubleScalar.Rel<LengthUnit>> initialLongitudinalPositions, final DoubleScalar.Abs<SpeedUnit> initialSpeed) throws RemoteException, NamingException, NetworkException, SimRuntimeException { super(id, gtuType, carFollowingModel, initialLongitudinalPositions, initialSpeed, vehicleLength, new DoubleScalar.Rel<LengthUnit>(1.8, LengthUnit.METER), new DoubleScalar.Abs<SpeedUnit>(200, SpeedUnit.KM_PER_HOUR), simulator); try { |
File | Line |
---|---|
org\opentrafficsim\demo\geometry\shape\ShapeFileReader.java | 395 |
org\opentrafficsim\demo\geometry\TestModel.java | 176 |
private static void addNLanes(final int n, final int spits, final Link link, final OTSSimulatorInterface simulator) throws NetworkException { // 2 x n lanes, grass underneath, lines between lanes, barrier in center // lane is 3.5 meters wide. gap in middle is one meter. outside 0.5 meters on both sides DoubleScalar.Rel<LengthUnit> m05 = new DoubleScalar.Rel<LengthUnit>(0.5, LengthUnit.METER); DoubleScalar.Rel<LengthUnit> m10 = new DoubleScalar.Rel<LengthUnit>(1.0, LengthUnit.METER); DoubleScalar.Rel<LengthUnit> m35 = new DoubleScalar.Rel<LengthUnit>(3.5, LengthUnit.METER); DoubleScalar.Abs<FrequencyUnit> f0 = new DoubleScalar.Abs<FrequencyUnit>(0.0, FrequencyUnit.PER_HOUR); DoubleScalar.Abs<FrequencyUnit> f200 = new DoubleScalar.Abs<FrequencyUnit>(200.0, FrequencyUnit.PER_HOUR); |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\FundamentalDiagrams.java | 280 |
org\opentrafficsim\demo\carFollowing\Straight.java | 362 |
org\opentrafficsim\demo\carFollowing\Trajectories.java | 275 |
public FundamentalDiagramPlotsModel(ArrayList<AbstractProperty<?>> properties) { this.properties = properties; } /** {@inheritDoc} */ @Override public final void constructModel( final SimulatorInterface<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble> theSimulator) throws SimRuntimeException, RemoteException { this.simulator = (OTSDEVSSimulatorInterface) theSimulator; Node from = new Node("From", new Coordinate(getMinimumDistance().getSI(), 0, 0)); Node to = new Node("To", new Coordinate(getMaximumDistance().getSI(), 0, 0)); |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 649 |
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 659 |
{ super(id, gtuType, carFollowingModel, initialLongitudinalPositions, initialSpeed, vehicleLength, new DoubleScalar.Rel<LengthUnit>(1.8, LengthUnit.METER), new DoubleScalar.Abs<SpeedUnit>(200, SpeedUnit.KM_PER_HOUR), simulator); try { if (id >= 0) { simulator.scheduleEventAbs(simulator.getSimulatorTime(), this, this, "move", null); } } catch (SimRuntimeException exception) { exception.printStackTrace(); } } /** * Determine the movement of this car. * @throws RemoteException RemoteException * @throws NamingException on ??? * @throws NetworkException on network inconsistency * @throws SimRuntimeException on ??? */ protected final void move() throws RemoteException, NamingException, NetworkException, SimRuntimeException { |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\newGUI.java | 449 |
org\opentrafficsim\demo\carFollowing\newGUI.java | 501 |
LaneSimulationModel model = new LaneSimulationModel(new ArrayList<AbstractProperty<?>>()); SimpleSimulator simSimulator = new SimpleSimulator(new OTSSimTimeDouble(new DoubleScalar.Abs<TimeUnit>(0.0, TimeUnit.SECOND)), new DoubleScalar.Rel<TimeUnit>(0.0, TimeUnit.SECOND), new DoubleScalar.Rel<TimeUnit>(3600.0, TimeUnit.SECOND), model, new Rectangle2D.Double(-1000, -1000, 1000, 1000)); this.simPanel.add(simSimulator.getPanel(), BorderLayout.CENTER); ContourPlot cp; |
File | Line |
---|---|
org\opentrafficsim\demo\carFollowing\CircularLane.java | 613 |
org\opentrafficsim\demo\carFollowing\CircularRoad.java | 619 |
} /** * @return minimumDistance */ public final DoubleScalar.Rel<LengthUnit> getMinimumDistance() { return this.minimumDistance; } /** Inner class IDMCar. */ protected class IDMCar extends Car<Integer> { /** */ private static final long serialVersionUID = 20141030L; /** * Create a new IDMCar. * @param id integer; the id of the new IDMCar * @param gtuType GTUType<String>; the type of the GTU * @param simulator OTSDEVSSimulator; the simulator that runs the new IDMCar * @param carFollowingModel CarFollowingModel; the car following model of the new IDMCar * @param vehicleLength DoubleScalar.Rel<LengthUnit>; the length of the new IDMCar * @param initialTime DoubleScalar.Abs<TimeUnit>; the time of first evaluation of the new IDMCar * @param initialLongitudinalPositions Map<Lane, DoubleScalar.Rel<LengthUnit>>; the initial lane positions * of the new IDMCar * @param initialSpeed DoubleScalar.Abs<SpeedUnit>; the initial speed of the new IDMCar * @throws NamingException on ??? * @throws RemoteException on Communications failure */ public IDMCar(final int id, GTUType<String> gtuType, final OTSDEVSSimulatorInterface simulator, final GTUFollowingModel carFollowingModel, DoubleScalar.Rel<LengthUnit> vehicleLength, final DoubleScalar.Abs<TimeUnit> initialTime, final Map<Lane, DoubleScalar.Rel<LengthUnit>> initialLongitudinalPositions, final DoubleScalar.Abs<SpeedUnit> initialSpeed) throws RemoteException, NamingException, SimRuntimeException, |