Ejemplo n.º 1
0
  /**
   * This test shows how a TraCI object is updated; calling {@link Vehicle#getSpeed()} in two
   * different simulation steps may give different results.
   *
   * @throws IllegalStateException
   * @throws IOException
   */
  @Test
  public void testRefreshedValues() throws IllegalStateException, IOException {
    conn.nextSimStep();
    Vehicle v = conn.getVehicleRepository().getAll().values().iterator().next();
    Double speedFirst = v.getSpeed();

    for (int i = 0; i < 10; i++) {
      conn.nextSimStep();
      Double speedNow = v.getSpeed();
      log.info(speedNow.toString());
      assertTrue(Math.abs(speedFirst - speedNow) > DELTA);
    }
  }