Package jmt.engine.QueueNet

Examples of jmt.engine.QueueNet.BlockingRegion


    if (regions != null) {
      //at least one region has been defined

      for (BlockingRegion region : regions) {

        BlockingRegion reg = region;

        if (!reg.hasGlobalConstraint()) {
          continue;
        }
        //max capacity
        double maxCapacity = reg.getMaxCapacity();
        String[] stations = reg.getRegionNodeNames();

        double classTotalQueue, regUtilization;
        double classWeight;
        String className;

        for (int c = 0; c < classNumber; c++) {

          className = classes[c].getName();
          //logger.debug("Computing region U for class " + className);

          classWeight = reg.getClassWeights()[c];
          classTotalQueue = 0.0;
          boolean success = true;

          if (classWeight == 0.0) {
            regUtilization = 0.0;
          } else {
            for (String station : stations) {
              double queue = findQueueMeasure(className, station);
              if (queue == -1) {
                success = false;
                break;
              }
              //logger.debug("Queue at station " + stations[s] + ": " + Double.toString(queue));
              classTotalQueue += queue;
            }

            if (success) {
              //logger.debug("Total queue: " + Double.toString(classTotalQueue));
              //logger.debug("Weight: " + Double.toString(classWeight));
              regUtilization = (classTotalQueue * classWeight) / maxCapacity;
              logger.debug("Region Utilization for " + reg.getName() + "-" + className + ": " + Double.toString(regUtilization));
            } else {
              //regUtilization = -1;
              regUtilization = Double.NEGATIVE_INFINITY;
              logger.debug("Region Utilization for " + reg.getName() + "-" + className + " not computed");
            }
          }

          Element el = doc.createElement("measure");
          root.appendChild(el);

          String inputStation = reg.getInputStation().getName();
          el.setAttribute("station", inputStation);
          el.setAttribute("class", className);
          el.setAttribute("meanValue", Double.toString(regUtilization));
          el.setAttribute("successful", Boolean.toString(success));
          el.setAttribute("measureType", "Region Utilization");
View Full Code Here


   */
  public void addRegion(String name, double maxCapacity, double[] maxCapacityPerClass, double[] classWeights, boolean[] drop, String[] stations)
      throws LoadException {
    if (true) {
      //TODO: andrebbero aggiunti controlli (nome non univoco, jobs<0, ecc...)
      regions.add(new BlockingRegion(name, maxCapacity, maxCapacityPerClass, classWeights, drop, this, stations));
    } else {
      throw new LoadException("Exception while creating a blocking region.");
    }
  }
View Full Code Here

      //NEW
      //@author Stefano Omini

      //add blocking regions
      BlockingRegion br;
      for (int i = 0; i < regions.size(); i++) {
        br = regions.get(i);

        String regionName = br.getName();
        String inputStationName = regionName + "_inputStation";

        InputSection is = new BlockingQueue(br);
        ServiceSection ss = new ServiceTunnel();
        OutputSection os = new BlockingRouter();

        SimNode inputStation = new SimNode(inputStationName, is, ss, os);
        inputStation.getNode().setBlockingRegionInputStation(br);

        //adds the input station of the blocking region
        nodes.add(inputStation);

        network.addNode(inputStation.getNode());

        //auto-connect the node, to avoid problems in job info lists refreshing
        //(otherwise a node with no connections presents problems)
        inputStation.getNode().connect(inputStation.getNode());

        NetNode inputSt = inputStation.getNode();
        if (inputStation.getInput() != null) {
          inputStation.getNode().addSection(inputStation.getInput());
        }
        if (inputStation.getService() != null) {
          inputStation.getNode().addSection(inputStation.getService());
        }
        if (inputStation.getOutput() != null) {
          inputStation.getNode().addSection(inputStation.getOutput());
        }
        inputStation.getNode().initializeSections();

        //sets the input station of the blocking region
        br.setInputStation(inputSt);

        //sets blocking region behaviour for inner nodes
        String[] regNodes = br.getRegionNodeNames();
        for (String regNode : regNodes) {
          NetNode innerNode = br.getRegionNode(regNode);

          //at the moment inner stations must have a Queue-type input section
          //and a Router-type output section
          //other not compliant sections will cause a NetException
View Full Code Here

TOP

Related Classes of jmt.engine.QueueNet.BlockingRegion

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.