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