Class NetSystem

java.lang.Object
QueueNet.NetSystem

public class NetSystem extends Object
This class controls the simulation running. It should be used to :
  • start the simulation;
  • stop the simulation;
  • abort the simulation;
  • get simulation elapsed time;
  • get total simulation time;
  • get real elapsed time.
Note that all methods are static and the class should not be instanced.
Author:
Francesco Radaelli, Federico Granata, Stefano Omini Modified by Bertoli Marco: fixed bug that avoided simulation termination with closed classes. 22-09-2005
  • Constructor Details

    • NetSystem

      public NetSystem()
  • Method Details

    • initialize

      public void initialize()
      Initializes the simulation system
    • terminate

      public void terminate()
      Terminates NetSystem and closes the log. You should recall the initialize method, rebuild all the network nodes and recall the start method in order to launch a new simulation.
    • getTime

      public double getTime()
      Gets the current simulation time.
      Returns:
      Current simulation time.
    • getElapsedTime

      public double getElapsedTime()
      Gets the current "real" elapsed time.
      Returns:
      Current simulation time.
    • start

      public void start() throws NetException, InterruptedException
      Starts the NetSystem Engine and executes the simulation. This method should be called when all NetNode of all QueueNetworks are ready to start.
      Throws:
      NetException
      InterruptedException
    • pause

      public boolean pause()
    • restartFromPause

      public boolean restartFromPause()
    • stop

      public void stop()
      Stops the NetSystem Engine and terminates the simulation (stops all the controlled QueueNetworks).
    • stop

      public void stop(QueueNetwork Network)
      Stops the NetSystem Engine and terminates the simulation.
      Parameters:
      Network - Reference to the network to be stopped.
    • abort

      public void abort()
      Aborts the NetSystem Engine and terminates the simulation (aborts all the controlled QueueNetworks).
    • abort

      public void abort(QueueNetwork network)
      Aborts the NetSystem Engine and terminates the simulation.
      Parameters:
      network - Reference to the network to be stopped.
    • addNetwork

      public void addNetwork(QueueNetwork Network)
      Adds a new network to the NetSystem.
      Parameters:
      Network - Reference to the network to be added.
    • getNetworkList

      public NetworkList getNetworkList()
      Gets networks list.
      Returns:
      Reference to a network list.
    • isRunning

      public boolean isRunning()
      Checks if the NetSystem Engine is running.
      Returns:
      True if NetSystem Engine is running.
    • getSimulationTime

      public double getSimulationTime()
      Gets total simulation time.
      Returns:
      Simulation time.
    • getNode

      public final NetNode getNode(int Id)
      Gets a node from its id. Searches the id between all the networks
      Parameters:
      Id - the id of the node
      Returns:
      searched node
    • getNode

      public NetNode getNode(String name)
      Gets a node from its name. Searches the name between all the networks
      Parameters:
      name - the name of the node
      Returns:
      searched node
    • checkProgress

      public double checkProgress(QueueNetwork network) throws NetException
      Checks simulation progress, showing a percentage of completed works
      Author: Bertoli Marco
      Parameters:
      network - network to be checked for progress
      Returns:
      estimated simulation progress
      Throws:
      NetException - if network is null
    • getTempMeasures

      public double getTempMeasures(QueueNetwork network) throws NetException
      Throws:
      NetException
    • setMaxSimulatedTime

      public void setMaxSimulatedTime(double maxSimulatedTime)
      Sets the maximum simulated time for the simulation in the netController
      Parameters:
      maxSimulatedTime - the maximum simulated time for the simulation
    • setMaxProcessedEvents

      public void setMaxProcessedEvents(int maxProcessedEvents)
      Sets the maximum processed events for the simulation in the netController
      Parameters:
      maxProcessedEvents - the maximum processed events for the simulation
    • getSimSystem

      public SimSystem getSimSystem()
    • nextjobNumber

      public int nextjobNumber()
    • getEngine

      public RandomEngine getEngine()