Class Simulation

java.lang.Object
simEngine.Simulation

public class Simulation extends Object
This class creates a new Simulation. It provides an easy way to initialize the jmt engine.
Author:
Federico Granata, Stefano Omini, Bertoli Marco Modified by Ashanka (May 2010): Patch: Multi-Sink Perf. Index Description: Added new Performance index for capturing 1. global response time (ResponseTime per Sink) 2. global throughput (Throughput per Sink) each sink per class.
  • Constructor Details

    • Simulation

      public Simulation(long seed, String simName, long maxSimulationTime) throws IOException
      Creates a new Simulation object.
      Parameters:
      seed - simulation seed (if -1, an automatic seed will be generated)
      simName - Name of simulation
      maxSimulationTime - The max duration (in milliseconds) of the simulation
      Throws:
      IOException
    • Simulation

      public Simulation(long seed, String simName) throws IOException
      Creates a new Simulation object.
      Parameters:
      seed - simulation seed (if -1, an automatic seed will be generated)
      simName - Name of simulation
      Throws:
      IOException
  • Method Details

    • addClasses

      public void addClasses(JobClass[] classes)
      Adds all Job Classes to the simulation. *
      Parameters:
      classes - the job classes of simulation
    • addNode

      public void addNode(String name, InputSection inSec, ServiceSection serSec, OutputSection outSec)
      Adds a node to the simulation model.
      Parameters:
      name - name of the node
      inSec - input section of the node
      serSec - service section of the node
      outSec - output section of the node
    • addConnection

      public void addConnection(String start, String end) throws LoadException
      Connects two nodes of the simulation: if a node has not been inserted in the model, then return a LoadException.
      Parameters:
      start - the source node
      end - the target node
      Throws:
      LoadException - one of the nodes has not been inserted in the model
    • addMeasure

      public void addMeasure(int measureType, String nodeName, Measure measure, String jClass) throws LoadException
      Adds to the system a new measure to be computed.
      Parameters:
      measureType - type of measure (see the constants specified in this class).
      nodeName - name of the node to be measured.
      measure -
      jClass -
      Throws:
      LoadException
    • addMeasure

      public void addMeasure(int measureType, String nodeName, Measure measure, String jClass, String nodeType) throws LoadException
      Adds to the system a new measure to be computed.
      Parameters:
      measureType - type of measure (see the constants specified in this class).
      nodeName - name of the node to be measured. [Attribute assign in `referenceNode`]
      "" (empty string) means Global Measure, no need specify referNode.
      measure -
      jClass - name of the job class to be measured. [Attribute assign in `referenceUserClass`]
      null means measuring all the class, not to the specific class
      nodeType - type of the node to be measured. [Attribute assign in `nodeType`]
      - null -> Global Measure, no specific referNode.
      - station -> Node Measure, bind to a specific referNode
      - region -> Capacity Region Measure.
      Throws:
      LoadException
    • addRegion

      public void addRegion(String name, double maxCapacity, double maxMemory, double[] maxCapacityPerClass, double[] maxMemoryPerClass, boolean[] drop, double[] classWeights, double[] classSizes, double[] classSoftDeadlines, String[] groupNames, double[] maxCapacityPerGroup, double[] maxMemoryPerGroup, List<List<Integer>> groupClassIndexLists, String[] stations) throws LoadException
      Creates a blocking region.
      Throws:
      LoadException
    • initialize

      public void initialize()
      Initializes all the components of this Simulation. This method assures that all the operations are executed in the correct order.
    • run

      public void run() throws NetException, InterruptedException
      Runs this simulation. If it has not been initialized, then throws an Exception. Controls the timer for max simulation time (if it has been defined).
      Throws:
      NetException
      InterruptedException
    • abort

      public void abort()
      Aborts simulation.
    • getOutputFile

      public File getOutputFile()
      Returns output file handler
      Returns:
      output file handler or null if a problem occurred
    • preload_station

      public void preload_station(String stationName, int[] jobs)
      Preload jobs in a queue
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getXmlModelDefPath

      public String getXmlModelDefPath()
    • setXmlModelDefPath

      public void setXmlModelDefPath(String xmlModelDefPath)
    • getXmlSimModelDefPath

      public String getXmlSimModelDefPath()
    • setXmlSimModelDefPath

      public void setXmlSimModelDefPath(String xmlSimModelDefPath)
    • setRandomEngineSeed

      public void setRandomEngineSeed(long seed)
    • hasFinished

      public boolean hasFinished()
      Returns true if the simulation has finished
      Returns:
      true if the simulation has finished
    • getNetwork

      public QueueNetwork getNetwork()
    • getAllRegions

      public BlockingRegion[] getAllRegions()
      Returns an array with all the blocking regions defined inside the model
      Returns:
      null if no region has been defined
    • getClasses

      public JobClass[] getClasses()
      Returns the array of classes
      Returns:
      the array of classes
    • setSimParameters

      public void setSimParameters(SimParameters simParameters)
    • getSimParameters

      public SimParameters getSimParameters()
    • setPreloadEnabled

      public void setPreloadEnabled(boolean preloadEnabled)
    • setPreload_stationNames

      public void setPreload_stationNames(String[] preload_stationNames)
    • setPreload_initialPopulations

      public void setPreload_initialPopulations(int[][] preload_initialPopulations)
    • addDistrNetNode

      public void addDistrNetNode(NetNode netNode)
    • isTerminalSimulation

      public boolean isTerminalSimulation()
    • setTerminalSimulation

      public void setTerminalSimulation(boolean isTerminalSimulation)
    • getParametricStep

      public int getParametricStep()
    • setParametricStep

      public void setParametricStep(int parametricStep)
    • getSimSystem

      public SimSystem getSimSystem()
    • getNetSystem

      public NetSystem getNetSystem()
    • getEngine

      public RandomEngine getEngine()