Examples of Simulator


Examples of org.jgroups.debug.Simulator

        super.setUp();
        a1=new IpAddress(1111);
        members=new Vector<Address>();
        members.add(a1);
        v=new View(a1, 1, members);
        s=new Simulator();
        s.setLocalAddress(a1);
        s.setView(v);
        s.addMember(a1);
        bottom_prot=new PING();
        Protocol[] stack=new Protocol[]{new VIEW_SYNC(), barrier_prot, bottom_prot};
View Full Code Here

Examples of org.jgroups.debug.Simulator

        super.setUp();
        a1=new IpAddress(1111);
        members=new Vector();
        members.add(a1);
        v=new View(a1, 1, members);
        s=new Simulator();
        s.setLocalAddress(a1);
        s.setView(v);
        s.addMember(a1);
        FC fc=new FC();
        Properties props=new Properties();
View Full Code Here

Examples of org.jgroups.debug.Simulator

        members=new Vector();
        members.add(a1);
        members.add(a2);
        v=new View(a1, 1, members);

        s=new Simulator();
        s.setLocalAddress(a1);
        s.setView(v);
        s.addMember(a1);

        VERIFY_SUSPECT v=new VERIFY_SUSPECT();
View Full Code Here

Examples of org.jgroups.debug.Simulator

        a1=new IpAddress(1111); // own address
        a2=new IpAddress(2222);
        Vector members=new Vector();
        members.add(a1);
        View v=new View(a1, 1, members);
        s=new Simulator();
        s.setLocalAddress(a1);
        s.setView(v);
        s.addMember(a1);
        TCPPING tcpping=new TCPPING();
        Properties props=new Properties();
View Full Code Here

Examples of org.jgroups.debug.Simulator

        a2=new IpAddress(2222);
        Vector members=new Vector();
        members.add(a1);
        members.add(a2);
        View v=new View(a1, 1, members);
        s=new Simulator();
        s.setLocalAddress(a1);
        s.setView(v);
        s.addMember(a1);
        NAKACK nak=new NAKACK();
        interceptor = new MessageInterceptor();
View Full Code Here

Examples of org.movsim.simulator.Simulator

        final String scenarioPath = scenario.substring(0, scenario.lastIndexOf("/")+1);
        projectMetaData.setPathToProjectXmlFile(scenarioPath);
        final String scenarioName = scenario.substring(scenario.lastIndexOf("/")+1);
        projectMetaData.setProjectName(scenarioName);

        final Simulator simulator = new Simulator();
        initLookAndFeel();

        final TrafficCanvas trafficCanvas = new TrafficCanvas(simulator, properties);
        canvasPanel = new CanvasPanel(resourceBundle, trafficCanvas);
        statusPanel = new StatusPanel(resourceBundle, simulator);
View Full Code Here

Examples of org.rhq.metrics.simulator.Simulator

    @Test
    public void runSimulator() throws Throwable {
        File jsonFile = new File(getClass().getResource("test-simulator.json").toURI());
        SimulationPlanner planner = new SimulationPlanner();
        SimulationPlan plan = planner.create(jsonFile);
        Simulator simulator = new Simulator();
        simulator.run(plan);
    }
View Full Code Here

Examples of rinde.sim.core.Simulator

   */
  public static void main(String[] args) {
    final String string = "AgentWise";
    final List<Point> points = measureString(string, 30, 30, 0);
    final RandomGenerator rng = new MersenneTwister(123);
    final Simulator sim = new Simulator(rng, Measure.valueOf(1000L,
        SI.MILLI(SI.SECOND)));
    sim.register(new PlaneRoadModel(new Point(0, 0), new Point(4500, 1200),
        SI.METER, Measure.valueOf(1000d, NonSI.KILOMETERS_PER_HOUR)));
    sim.configure();
    for (final Point p : points) {
      sim.register(new Vehicle(p, rng));
    }
    View.create(sim)
        .with(new PlaneRoadModelRenderer(), new VehicleRenderer(),
            new DemoPanel(string, rng)).show();
  }
View Full Code Here

Examples of rinde.sim.core.Simulator

    // initialize a random generator which we use throughout this
    // 'experiment'
    final RandomGenerator rnd = new MersenneTwister(123);

    // initialize a new Simulator instance
    final Simulator sim = new Simulator(rnd, Measure.valueOf(1000L,
        SI.MILLI(SI.SECOND)));

    // register a PlaneRoadModel, a model which facilitates the moving of
    // RoadUsers on a plane. The plane is bounded by two corner points:
    // (0,0) and (10,10)
    sim.register(new PlaneRoadModel(new Point(0, 0), new Point(10, 10),
        SI.KILOMETER, Measure.valueOf(VEHICLE_SPEED, NonSI.KILOMETERS_PER_HOUR)));
    // configure the simulator, once configured we can no longer change the
    // configuration (i.e. add new models) but we can start adding objects
    sim.configure();

    // add a number of drivers on the road
    final int numDrivers = 200;
    for (int i = 0; i < numDrivers; i++) {
      // when an object is registered in the simulator it gets
      // automatically 'hooked up' with models that it's interested in. An
      // object declares to be interested in an model by implementing an
      // interface.
      sim.register(new Driver(rnd));
    }
    // initialize the GUI. We use separate renderers for the road model and
    // for the drivers. By default the road model is rendererd as a square
    // (indicating its boundaries), and the drivers are rendererd as red
    // dots.
View Full Code Here

Examples of rinde.sim.core.Simulator

      String graphFile,
      @Nullable Display display, @Nullable Monitor m, @Nullable Listener list) {

    // create a new simulator
    final RandomGenerator rng = new MersenneTwister(123);
    final Simulator simulator = new Simulator(rng, Measure.valueOf(1000L,
        SI.MILLI(SI.SECOND)));

    // use map of leuven
    final RoadModel roadModel = new GraphRoadModel(loadGraph(graphFile));
    final DefaultPDPModel pdpModel = new DefaultPDPModel();

    // configure simulator with models
    simulator.register(roadModel);
    simulator.register(pdpModel);
    simulator.configure();

    // add depots, taxis and parcels to simulator
    for (int i = 0; i < NUM_DEPOTS; i++) {
      simulator.register(new TaxiBase(roadModel.getRandomPosition(rng),
          DEPOT_CAPACITY));
    }
    for (int i = 0; i < NUM_TAXIS; i++) {
      simulator.register(new Taxi(roadModel.getRandomPosition(rng),
          TAXI_CAPACITY));
    }
    for (int i = 0; i < NUM_CUSTOMERS; i++) {
      simulator.register(new Customer(roadModel.getRandomPosition(rng),
          roadModel.getRandomPosition(rng), SERVICE_DURATION, SERVICE_DURATION,
          1 + rng.nextInt(3)));
    }

    simulator.addTickListener(new TickListener() {
      @Override
      public void tick(TimeLapse time) {
        if (time.getStartTime() > endTime) {
          simulator.stop();
        } else if (rng.nextDouble() < .007) {
          simulator.register(new Customer(
              roadModel.getRandomPosition(rng), roadModel
                  .getRandomPosition(rng), SERVICE_DURATION, SERVICE_DURATION,
              1 + rng.nextInt(3)));
        }
      }
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.