Examples of TestVehicle


Examples of org.movsim.simulator.vehicles.TestVehicle

        calcApproximateInflow(dt);

        if (nWait >= 1.0) {
            // try to insert vehicle
            final TestVehicle testVehicle = vehGenerator.getTestVehicle();
            SortedSet<GapCandidate> gapCandidates = findLargestPossibleGap(testVehicle); // only one insert per timestep

            if (!gapCandidates.isEmpty()) {
                GapCandidate gap = gapCandidates.first();
                addVehicle(roadSegment.laneSegment(gap.laneIndex), testVehicle, gap.enterPosition, gap.enterSpeed);
View Full Code Here

Examples of org.movsim.simulator.vehicles.TestVehicle

                continue;
            }

            double position = roadSegment.roadLength(); // start at end of segment
            while (position > 0) {
                final TestVehicle testVehicle = vehGenerator.getTestVehicle();

                final double rhoLocal = icMacro.rho(position);
                double speedInit = icMacro.hasUserDefinedSpeeds() ? icMacro.vInit(position) : testVehicle
                        .getEquilibriumSpeed(rhoLocal);
                if (LOG.isDebugEnabled() && !icMacro.hasUserDefinedSpeeds()) {
                    LOG.debug("use equilibrium speed={} in macroscopic initial conditions.", speedInit);
                }
View Full Code Here

Examples of rinde.sim.core.model.pdp.PDPModelTest.TestVehicle

    final TestDepot d = new TestDepot(10);
    model.register(d);
    assertSame(model, d.pdpModel.get());

    final TestVehicle v = new TestVehicle(new Point(0d, 0d), 1d, 30d);
    model.register(v);
    assertSame(model, v.pdpModel.get());
  }
View Full Code Here

Examples of rinde.sim.core.model.pdp.PDPModelTest.TestVehicle

  /**
   * Cannot register the same depot twice.
   */
  @Test(expected = IllegalArgumentException.class)
  public void registerFail3() {
    final TestVehicle v = new TestVehicle(new Point(0d, 0d), 1d, 30d);
    model.register(v);
    model.register(v);
  }
View Full Code Here

Examples of rinde.sim.core.model.pdp.PDPModelTest.TestVehicle

    assertTrue(model.getSupportedType().equals(PDPObject.class));
  }
  @Test
  public void testDrop(){
      final Vehicle truck = new TestVehicle(new Point(1, 1), 10.0, 1.0);
      model.register(truck);
      rm.register(truck);

      final Parcel pack = new TestParcel(new Point(2, 2), 100, 100, 2);
      model.register(pack);
View Full Code Here

Examples of rinde.sim.core.model.pdp.PDPModelTest.TestVehicle

      assertEquals(VehicleState.IDLE, model.getVehicleState(truck));
           
  }
  @Test
  public void testPickupAfterDrop(){
      final Vehicle truck = new TestVehicle(new Point(1, 1), 10.0, 1.0);
      model.register(truck);
      rm.register(truck);

      final Parcel pack2 = new TestParcel(new Point(2, 2), 100, 100, 2);
      model.register(pack2);
      rm.register(pack2);
      rm.addObjectAt(pack2, new Point(1, 2));

      rm.followPath(truck, newLinkedList(asList(new Point(1, 2))),
          TimeLapseFactory.create(0, 3600000));
      model.pickup(truck, pack2, TimeLapseFactory.create(0, 40));
      model.continuePreviousActions(truck, TimeLapseFactory.create(0, 40));

      final TimeLapse tl = TimeLapseFactory.create(0, 40);
      model.continuePreviousActions(truck, tl);
      assertFalse(model.getContents(truck).isEmpty());
      assertEquals(ParcelState.IN_CARGO, model.getParcelState(pack2));
      assertEquals(VehicleState.IDLE, model.getVehicleState(truck));
     
      //riding to other spot to drop
      rm.followPath(truck, newLinkedList(asList(new Point(2, 2))),
            TimeLapseFactory.create(0, 3600000));
     
      model.drop(truck, pack2, TimeLapseFactory.create(0, 100));
     
      final Vehicle truck2 = new TestVehicle(new Point(2, 2), 10.0, 1.0);
      model.register(truck2);
      rm.register(truck2);
     
      model.pickup(truck2, pack2, TimeLapseFactory.create(0, 40));
      model.continuePreviousActions(truck2, TimeLapseFactory.create(0, 40));
View Full Code Here

Examples of rinde.sim.core.model.pdp.PDPModelTest.TestVehicle

}
 
  @Test
  public void testPickup() {
    final Parcel pack1 = new TestParcel(new Point(2, 2), 0, 0, 2);
    final Vehicle truck = new TestVehicle(new Point(1, 1), 10.0, 1.0);
    model.register(pack1);
    model.register(truck);
    rm.register(pack1);
    rm.register(truck);
    rm.addObjectAt(pack1, new Point(1, 1));

    // nothing should happen
    truck.tick(TimeLapseFactory.create(0, 10000));

    assertEquals(0, model.getContentsSize(truck), EPSILON);
    assertTrue(model.getContents(truck).isEmpty());
    assertEquals(ParcelState.AVAILABLE, model.getParcelState(pack1));
    assertEquals(VehicleState.IDLE, model.getVehicleState(truck));
View Full Code Here

Examples of rinde.sim.core.model.pdp.PDPModelTest.TestVehicle

  @Test
  public void testDelayedPickup() {

    final Parcel pack1 = new TestParcel(new Point(2, 2), 10, 10, 2);
    final Vehicle truck = new TestVehicle(new Point(1, 1), 10.0, 1.0);
    model.register(pack1);
    model.register(truck);
    rm.register(pack1);
    rm.register(truck);
    rm.addObjectAt(pack1, new Point(1, 1));

    model.pickup(truck, pack1, TimeLapseFactory.create(0, 1));
    assertTrue(model.getContents(truck).isEmpty());
    assertEquals(model.getContentsSize(truck), 0, EPSILON);

    truck.tick(TimeLapseFactory.create(1, 10));
    assertFalse(model.getContents(truck).isEmpty());
    assertTrue(model.getContents(truck).contains(pack1));
    assertEquals(model.getContentsSize(truck), 2, EPSILON);
  }
View Full Code Here

Examples of rinde.sim.core.model.pdp.PDPModelTest.TestVehicle

  }

  @Test(expected = IllegalArgumentException.class)
  public void testPickupFail1() {
    // truck not in roadmodel
    final Vehicle truck = new TestVehicle(new Point(1, 1), 10.0, 1.0);
    model.pickup(truck, null, TimeLapseFactory.create(0, 1));
  }
View Full Code Here

Examples of rinde.sim.core.model.pdp.PDPModelTest.TestVehicle

  }

  @Test(expected = IllegalArgumentException.class)
  public void testPickupFail2() {
    // package not in roadmodel
    final Vehicle truck = new TestVehicle(new Point(1, 1), 10.0, 1.0);
    rm.register(truck);
    final Parcel pack1 = new TestParcel(new Point(2, 2), 0, 0, 2.0);
    model.pickup(truck, pack1, TimeLapseFactory.create(0, 1));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.