Class Simulation
java.lang.Object
simEngine.Simulation
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 Summary
ConstructorsConstructorDescriptionSimulation(long seed, String simName) Creates a new Simulation object.Simulation(long seed, String simName, long maxSimulationTime) Creates a new Simulation object. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts simulation.voidaddClasses(JobClass[] classes) Adds all Job Classes to the simulation.voidaddConnection(String start, String end) Connects two nodes of the simulation: if a node has not been inserted in the model, then return a LoadException.voidaddDistrNetNode(NetNode netNode) voidaddMeasure(int measureType, String nodeName, Measure measure, String jClass) Adds to the system a new measure to be computed.voidaddMeasure(int measureType, String nodeName, Measure measure, String jClass, String nodeType) Adds to the system a new measure to be computed.voidaddNode(String name, InputSection inSec, ServiceSection serSec, OutputSection outSec) Adds a node to the simulation model.voidaddRegion(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) Creates a blocking region.Returns an array with all the blocking regions defined inside the modelJobClass[]Returns the array of classesgetName()Returns output file handlerintbooleanReturns true if the simulation has finishedvoidInitializes all the components of this Simulation.booleanvoidpreload_station(String stationName, int[] jobs) Preload jobs in a queuevoidrun()Runs this simulation.voidvoidsetParametricStep(int parametricStep) voidsetPreload_initialPopulations(int[][] preload_initialPopulations) voidsetPreload_stationNames(String[] preload_stationNames) voidsetPreloadEnabled(boolean preloadEnabled) voidsetRandomEngineSeed(long seed) voidsetSimParameters(SimParameters simParameters) voidsetTerminalSimulation(boolean isTerminalSimulation) voidsetXmlModelDefPath(String xmlModelDefPath) voidsetXmlSimModelDefPath(String xmlSimModelDefPath)
-
Constructor Details
-
Simulation
Creates a new Simulation object.- Parameters:
seed- simulation seed (if -1, an automatic seed will be generated)simName- Name of simulationmaxSimulationTime- The max duration (in milliseconds) of the simulation- Throws:
IOException
-
Simulation
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
Adds all Job Classes to the simulation. *- Parameters:
classes- the job classes of simulation
-
addNode
Adds a node to the simulation model.- Parameters:
name- name of the nodeinSec- input section of the nodeserSec- service section of the nodeoutSec- output section of the node
-
addConnection
Connects two nodes of the simulation: if a node has not been inserted in the model, then return a LoadException.- Parameters:
start- the source nodeend- 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 classnodeType- 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
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:
NetExceptionInterruptedException
-
abort
public void abort()Aborts simulation. -
getOutputFile
Returns output file handler- Returns:
- output file handler or null if a problem occurred
-
preload_station
Preload jobs in a queue -
getName
-
setName
-
getXmlModelDefPath
-
setXmlModelDefPath
-
getXmlSimModelDefPath
-
setXmlSimModelDefPath
-
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
-
getAllRegions
Returns an array with all the blocking regions defined inside the model- Returns:
- null if no region has been defined
-
getClasses
-
setSimParameters
-
getSimParameters
-
setPreloadEnabled
public void setPreloadEnabled(boolean preloadEnabled) -
setPreload_stationNames
-
setPreload_initialPopulations
public void setPreload_initialPopulations(int[][] preload_initialPopulations) -
addDistrNetNode
-
isTerminalSimulation
public boolean isTerminalSimulation() -
setTerminalSimulation
public void setTerminalSimulation(boolean isTerminalSimulation) -
getParametricStep
public int getParametricStep() -
setParametricStep
public void setParametricStep(int parametricStep) -
getSimSystem
-
getNetSystem
-
getEngine
-