View Javadoc
1   package org.opentrafficsim.road.gtu.strategical;
2   
3   import org.junit.Test;
4   import org.opentrafficsim.base.parameters.Parameters;
5   import org.opentrafficsim.core.geometry.OTSGeometryException;
6   import org.opentrafficsim.core.geometry.OTSLine3D;
7   import org.opentrafficsim.core.geometry.OTSPoint3D;
8   import org.opentrafficsim.core.gtu.GTUException;
9   import org.opentrafficsim.core.network.LinkType;
10  import org.opentrafficsim.core.network.Network;
11  import org.opentrafficsim.core.network.NetworkException;
12  import org.opentrafficsim.core.network.OTSLink;
13  import org.opentrafficsim.core.network.OTSNetwork;
14  import org.opentrafficsim.core.network.OTSNode;
15  import org.opentrafficsim.road.DefaultTestParameters;
16  import org.opentrafficsim.road.gtu.lane.tactical.LaneBasedCFLCTacticalPlanner;
17  import org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel;
18  import org.opentrafficsim.road.gtu.lane.tactical.following.IDMPlus;
19  import org.opentrafficsim.road.mock.MockSimulator;
20  
21  import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
22  
23  /**
24   * Test the LaneBasedStrategicalRoutePlanner class.
25   * <p>
26   * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
27   * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
28   * <p>
29   * @version $Revision$, $LastChangedDate$, by $Author$, initial version Apr 19, 2016 <br>
30   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
31   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
32   */
33  public class LaneBasedStrategicalRoutePlannerTest
34  {
35  
36      /**
37       * Test the nextLinkDirection method.
38       * @throws GTUException if not caught this test has failed
39       * @throws NetworkException if not caught this test has failed
40       * @throws OTSGeometryException when construction of design line fails
41       */
42      @Test
43      public final void nextLinkDirectionTest() throws GTUException, NetworkException, OTSGeometryException
44      {
45          Network network = new OTSNetwork("next link direction test");
46          // Build a really simple network
47          OTSNode fromNode = new OTSNode(network, "from", new OTSPoint3D(0, 0, 0));
48          OTSNode toNode = new OTSNode(network, "to", new OTSPoint3D(100, 0, 0));
49          OTSLine3D designLine = new OTSLine3D(fromNode.getPoint(), toNode.getPoint());
50          SimulatorInterface.TimeDoubleUnit simulator = MockSimulator.createMock();
51          OTSLink link = new OTSLink(network, "link", fromNode, toNode, LinkType.ROAD, designLine, simulator);
52          CarFollowingModel cfm = new IDMPlus();
53          LaneBasedCFLCTacticalPlanner tacticalPlanner = new LaneBasedCFLCTacticalPlanner(null, null, null);
54          Parameters params = DefaultTestParameters.create();
55          // TODO Gtu cannot be null anymore...
56          // LaneBasedStrategicalRoutePlanner lbsrp = new LaneBasedStrategicalRoutePlanner(params, tacticalPlanner, null);
57  
58      }
59  }