Package it.polito.appeal.traci

Examples of it.polito.appeal.traci.MultiQuery


    conn.nextSimStep(); // to clear already read values
   
    start = System.currentTimeMillis();
    for (int r = 0; r < RETRIES; r++) {
      Map<String, Vehicle> vehicles = conn.getVehicleRepository().getAll();
      MultiQuery multi = conn.makeMultiQuery();
      for (Vehicle vehicle : vehicles.values()) {
        multi.add(vehicle.queryReadPosition());
      }
      multi.add(conn.getVehicleRepository().getQuery());
      multi.run();
      conn.nextSimStep();
    }
    long elapsedMulti = System.currentTimeMillis() - start;
    System.out.println("MultiQuery queries: " + elapsedMulti + " ms");
   
View Full Code Here


   
//    ValueReadQuery<Double> meanSpeed = detector.queryReadLastStepMeanSpeed();
    ValueReadQuery<Integer> vehicleNum = detector.queryReadLastStepVehicleNumber();
//    ValueReadQuery<Set<Vehicle>> vehicles = detector.queryReadLastStepVehicles();
   
    MultiQuery batch = conn.makeMultiQuery();
//    batch.add(meanSpeed);
    batch.add(vehicleNum);
//    batch.add(vehicles);
   
   
    for (int t=0; t<100; t++) {
      conn.nextSimStep();
    }
   
    batch.run();
//    System.out.println(""
//        + ":   " + meanSpeed.get()
//        + "    " + vehicleNum.get()
//        + "    " + vehicles.get());
   
View Full Code Here

    assertEquals(LOCATION_LOCAL.getY(), out.getY(), 1e-5);
  }
 
  @Test
  public void testMultiConvert() throws IOException {
    MultiQuery mq = conn.makeMultiQuery();
   
    PositionConversionQuery conv1 = conn.queryPositionConversion();
    conv1.setPositionToConvert(LOCATION_LOCAL, true);
    mq.add(conv1);

    PositionConversionQuery conv2 = conn.queryPositionConversion();
    Point2D loc2 = new Point2D.Double(LOCATION_LOCAL.getX() + 5, LOCATION_LOCAL.getY() + 5);
    conv2.setPositionToConvert(loc2, false);
    mq.add(conv2);
   
    mq.run();
   
    Point2D out1 = conv1.get();
    Point2D out2 = conv2.get();

    assertEquals(LOCATION_GEO.getX(), out1.getX(), 1e-5);
View Full Code Here

    conn.nextSimStep(); // to clear already read values
   
    start = System.currentTimeMillis();
    for (int r = 0; r < RETRIES; r++) {
      Map<String, Vehicle> vehicles = conn.getVehicleRepository().getAll();
      MultiQuery multi = conn.makeMultiQuery();
      for (Vehicle vehicle : vehicles.values()) {
        multi.add(vehicle.queryReadPosition());
      }
      multi.add(conn.getVehicleRepository().getQuery());
      multi.run();
      conn.nextSimStep();
    }
    long elapsedMulti = System.currentTimeMillis() - start;
    log.info("MultiQuery queries: " + elapsedMulti + " ms");
   
View Full Code Here

TOP

Related Classes of it.polito.appeal.traci.MultiQuery

Copyright © 2018 www.massapicom. 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.