Examples of Simulation


Examples of jmt.engine.simEngine.Simulation

    try {
      //File model = new File(path);
      //FileInputStream is = new FileInputStream(model);
      SimLoader loader = new SimLoader(path);
      Simulation sim = loader.getSim();

      //TODO: fixed seed
      sim.setRandomEngineSeed(seed);

      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

Examples of jmt.engine.simEngine.Simulation

    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

Examples of jmt.engine.simEngine.Simulation

  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

Examples of jmt.engine.simEngine.Simulation

    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

Examples of jmt.engine.simEngine.Simulation

      //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

Examples of jmt.engine.simEngine.Simulation

    //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

Examples of jmt.engine.simEngine.Simulation

    //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

Examples of newExamples.Simulation

    double magBol   = 12.1;        // (Compute from bolometric corrections in Allen)
    int    pop      = 6;        // (Besancon model. 6: 5-7 Gyr)
    String spType   = "M4 V";      // String defining the spectral type
   
    // Generate simulation
    Simulation sim = new Simulation();
   
    // Generate solar system, set parameters, generate planet and star; finalize
    SimulatedSystem system = sim.addSystem("GJ 876");
    system.setAstrometry(ra, dec, parallax, muRa, muDec, vRad);
    system.createStar(magMv, distance, vMinusI, absV, feH, alphaE, mass, spType, magBol, pop);
    system.addPlanet(massPlanet, period, timePeriastron, eccentricity, inclination, omega2, nodeAngle);
    system.finalizeSystem();//*/
   
 
View Full Code Here

Examples of org.contikios.cooja.Simulation

    /* Load simulation */
    logger.info("Loading " + config);
    Cooja.externalToolsUserSettingsFile = new File(
        System.getProperty("user.home"),
        Cooja.EXTERNAL_TOOLS_USER_SETTINGS_FILENAME);
    Simulation s = Cooja.quickStartSimulationConfig(config, false, null);
    if (s == null) {
      throw new RuntimeException(
          "Error when creating simulation"
      );
    }
    s.stopSimulation();

    try {
      buildExecutableJAR(s.getCooja(), jar);
    } catch (RuntimeException e) {
      logger.fatal(e.getMessage(), e);
      System.exit(1);
    }
    System.exit(0);
View Full Code Here

Examples of org.contikios.cooja.Simulation

      return;
    }

    logger.info("Starting simulation");
    Cooja.setLookAndFeel();
    Simulation sim = Cooja.quickStartSimulationConfig(new File(executeDir, SIMCONFIG_FILENAME), false, null);
    if (sim != null){
        /* Set simulation speed to maximum and start simulation */
        sim.setSpeedLimit(null);
        sim.startSimulation();
    } else {
        logger.fatal("Cannot load simulation, aborting");
        System.exit(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.