Package jmt.engine.simEngine

Examples of jmt.engine.simEngine.Simulation$Connection


    try {
      //File model = new File(path);
      //FileInputStream is = new FileInputStream(model);
      SimLoader loader = new SimLoader(path);
      Simulation sim = loader.getSim();
      sim.initialize();
      start = System.currentTimeMillis();
      sim.run();
      stop = System.currentTimeMillis();
      elapsed = stop - start;
      //System.out.println("Duration execution "+i+": ");
      System.out.println(Long.toString(elapsed));
    } catch (FileNotFoundException e) {
View Full Code Here


  public static void test2() {

    try {

      SimLoader loader = new SimLoader("D://sim_test_2open.xml");
      Simulation sim = loader.getSim();
      sim.initialize();
      sim.run();
      double elapsed = NetSystem.getElapsedTime();
      System.out.println(elapsed);

    } catch (FileNotFoundException e) {
      System.out.println("Errore, file non trovato...");
View Full Code Here

    for (int i = 0; i < N; i++) {

      try {

        SimLoader loader = new SimLoader("D://sim_prova.xml");
        Simulation sim = loader.getSim();
        sim.initialize();
        start = System.currentTimeMillis();

        sim.run();

        stop = System.currentTimeMillis();
        elapsed = stop - start;
        //System.out.println("Duration execution "+i+": ");
        System.out.println(Long.toString(elapsed));
View Full Code Here

      //add class
      JobClass[] classes = new JobClass[1];
      classes[0] = new JobClass("prima");

      long simTime = 200;
      Simulation sim = new Simulation(-1, "SimulationWithTimer", simTime);

      sim.addClasses(classes);

      //terminal
      RoundRobinStrategy[] rrs_term = new RoundRobinStrategy[1];
      rrs_term[0] = new RoundRobinStrategy();

      int[] numJobs = { 6 };

      ServiceTimeStrategy[] ds = { new ServiceTimeStrategy(DelayExp[0], DelayPar[0]) };

      sim.addNode("terminal", new Terminal(numJobs), new Delay(ds), new Router(rrs_term));

      //server
      ServiceStrategy[] serv_strat = new ServiceStrategy[1];
      serv_strat[0] = new ServiceTimeStrategy(serverExp[0], serverPar[0]);

      RoundRobinStrategy[] rrs_serv = new RoundRobinStrategy[1];
      rrs_serv[0] = new RoundRobinStrategy();

      sim.addNode("server", new Queue(-1, false, null, null), new Server(1, null, serv_strat), new Router(rrs_serv));

      //connections
      sim.addConnection("terminal", "server");
      sim.addConnection("server", "terminal");

      //measure

      jmt.engine.dataAnalysis.Measure mis1 = new jmt.engine.dataAnalysis.Measure("queuelength_s.out", .1, .1, 1000000, false, null);
      jmt.engine.dataAnalysis.Measure mis11 = new jmt.engine.dataAnalysis.Measure("queuelength_t.out", .1, .1, 1000000, false, null);
      jmt.engine.dataAnalysis.Measure mis2 = new jmt.engine.dataAnalysis.Measure("utilization_s.out", .1, .1, 1000000, false, null);
      jmt.engine.dataAnalysis.Measure mis3 = new InverseMeasure("throughput_s.out", .1, .1, 1000000, false);
      jmt.engine.dataAnalysis.Measure mis4 = new jmt.engine.dataAnalysis.Measure("queuetime_s.out", .1, .1, 1000000, false, null);
      jmt.engine.dataAnalysis.Measure mis5 = new jmt.engine.dataAnalysis.Measure("residencetime_s.out", .1, .1, 1000000, false, null);

      jmt.engine.dataAnalysis.Measure mis6 = new jmt.engine.dataAnalysis.Measure("utilization_t.out", .1, .1, 1000000, false, null);
      jmt.engine.dataAnalysis.Measure mis7 = new InverseMeasure("throughput_t.out", .1, .1, 1000000, false);
      jmt.engine.dataAnalysis.Measure mis8 = new jmt.engine.dataAnalysis.Measure("residencetime_t.out", .1, .1, 1000000, false, null);
      jmt.engine.dataAnalysis.Measure mis9 = new jmt.engine.dataAnalysis.Measure("responsetime_s.out", .1, .1, 1000000, false, null);
      jmt.engine.dataAnalysis.Measure mis10 = new jmt.engine.dataAnalysis.Measure("responsetime_t.out", .1, .1, 1000000, false, null);

      int queue_l = SimConstants.QUEUE_LENGTH;
      int utiliz = SimConstants.UTILIZATION;
      int through = SimConstants.THROUGHPUT;
      int queue_t = SimConstants.QUEUE_TIME;
      int resid_t = SimConstants.RESIDENCE_TIME;;
      int resp_t = SimConstants.RESPONSE_TIME;

      //sim.addMeasure(queue_l, "server", mis1, classes[0].getName());
      //sim.addMeasure(queue_l, "terminal", mis11, classes[0].getName());
      sim.addMeasure(utiliz, "server", mis2, classes[0].getName());
      sim.addMeasure(utiliz, "terminal", mis6, classes[0].getName());
      sim.addMeasure(through, "server", mis3, classes[0].getName());
      sim.addMeasure(through, "terminal", mis7, classes[0].getName());
      //sim.addMeasure(resid_t, "server", mis5, classes[0].getName());
      //sim.addMeasure(resid_t, "terminal", mis8, classes[0].getName());
      //sim.addMeasure(resp_t, "server", mis9, classes[0].getName());
      //sim.addMeasure(resp_t, "terminal", mis10, classes[0].getName());

      sim.initialize();
      sim.run();

      System.out.println("tot time = " + NetSystem.getElapsedTime());

    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

    //sim model successfully created
    //now prepare simulation
    try {
      SimLoader simLoader = new SimLoader(simModelDefinitionPath);
      Simulation sim = simLoader.getSim();

      //sets in the Simulation object the path of the original (i.e. MVA)
      //xml model definition
      sim.setXmlModelDefPath(modelDefinitionPath);

      if (!automaticSeed) {
        //if automaticSeed == false, then a user defined seed is present
        sim.setRandomEngineSeed(simulationSeed);
        sim.initialize();

        logger.debug("jSIM correctly initialized with simulation seed = " + simulationSeed);
      } else {
        sim.initialize();
        logger.debug("jSIM correctly initialized");
      }

      //Avoid saturation
      if (sim.getAllRegions() == null) {
        //if there are no regions...
        boolean sufficientProcessingCapacity = checkProcessingCapacity();

        if (!sufficientProcessingCapacity) {
          logger.warn("Current workload causes system saturation. Simulation will not be started.");
          return false;
        }
      }

      simStarted = true;
      net = sim.getNetwork();

      long start, stop;
      double elapsed;

      //Start time
      start = System.currentTimeMillis();

      sim.run();

      //stop time
      stop = System.currentTimeMillis();
      elapsed = ((stop - start)) / 1000.0;
View Full Code Here

    //sim model successfully created
    //now prepare simulation
    try {
      SimLoader simLoader = new SimLoader(simModelDefinitionPath);
      Simulation sim = simLoader.getSim();
      //sim.MONITOR_BLOCKING_REGION = true;           
      //sets in the Simulation object the path of the original (i.e. MVA)
      //xml model definition
      sim.setXmlModelDefPath(modelDefinitionPath);

      if (!automaticSeed) {
        //if automaticSeed == false, then a user defined seed is present
        sim.setRandomEngineSeed(simulationSeed);
        sim.initialize();

        logger.debug("jSIM correctly initialized with simulation seed = " + simulationSeed);
      } else {
        sim.initialize();
        logger.debug("jSIM correctly initialized");
      }

      //Avoid saturation
      if (sim.getAllRegions() == null) {
        //if there are no regions...
        boolean sufficientProcessingCapacity = inputModel.checkSaturation() == ExactModel.NO_SATURATION;

        if (!sufficientProcessingCapacity) {
          logger.warn("Current workload causes system saturation. Simulation will not be started.");
          return false;
        }
      }

      simStarted = true;
      net = sim.getNetwork();

      long start, stop;
      double elapsed;

      //Start time
      start = System.currentTimeMillis();

      sim.run();

      //stop time
      stop = System.currentTimeMillis();
      elapsed = ((stop - start)) / 1000.0;
View Full Code Here

   /**
    * Returns a new connection.
    */
   Connection getConnection()
   {
      return new Connection(getAccessKeyId(), getSecretAccessKey(),
            isSecure(), getServer(), getPort(), getCallingFormat());
   }
View Full Code Here

    private void connectionClosed() {
        if(! reconnect.get()) {
            return; // Nothing to do
        }
        // Wait until the connection is closed before reconnecting
        final Connection connection = this.connection;
        if(connection != null) {
            if(channel == null) {
                connection.closeAsync();
            }
        } else {
            HostControllerLogger.ROOT_LOGGER.lostRemoteDomainConnection();
            executorService.execute(new Runnable() {
                @Override
View Full Code Here

     *
     * @param connectionURI the new connection URI
     */
    protected void reconfigure(final URI connectionURI) {
        configuration.setUri(connectionURI);
        final Connection connection = this.connection;
        if(connection != null) {
            connection.closeAsync();
        }
    }
View Full Code Here

            builder.set(Options.SASL_MECHANISMS, Sequence.of("JBOSS-LOCAL-USER"));
        }

        final IoFuture<Connection> futureConnection = endpoint.connect(connectionURI, builder.getMap(), new AuthenticationCallbackHandler(username, password));
        // wait for the connection to be established
        final Connection connection = IoFutureHelper.get(futureConnection, 5000, TimeUnit.MILLISECONDS);
        // create a remoting EJB receiver for this connection
        final EJBReceiver receiver = new RemotingConnectionEJBReceiver(connection);
        // associate it with the client context
        EJBClientContext context = EJBClientContext.create();
        context.registerEJBReceiver(receiver);
View Full Code Here

TOP

Related Classes of jmt.engine.simEngine.Simulation$Connection

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.