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