Class NetSystem
java.lang.Object
QueueNet.NetSystem
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.
- Author:
- Francesco Radaelli, Federico Granata, Stefano Omini Modified by Bertoli Marco: fixed bug that avoided simulation termination with closed classes. 22-09-2005
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts the NetSystem Engine and terminates the simulation (aborts all the controlled QueueNetworks).voidabort(QueueNetwork network) Aborts the NetSystem Engine and terminates the simulation.voidaddNetwork(QueueNetwork Network) Adds a new network to the NetSystem.doublecheckProgress(QueueNetwork network) Checks simulation progress, showing a percentage of completed works
Author: Bertoli MarcodoubleGets the current "real" elapsed time.Gets networks list.final NetNodegetNode(int Id) Gets a node from its id.Gets a node from its name.doubleGets total simulation time.doublegetTempMeasures(QueueNetwork network) doublegetTime()Gets the current simulation time.voidInitializes the simulation systembooleanChecks if the NetSystem Engine is running.intbooleanpause()booleanvoidsetMaxProcessedEvents(int maxProcessedEvents) Sets the maximum processed events for the simulation in the netControllervoidsetMaxSimulatedTime(double maxSimulatedTime) Sets the maximum simulated time for the simulation in the netControllervoidstart()Starts the NetSystem Engine and executes the simulation.voidstop()Stops the NetSystem Engine and terminates the simulation (stops all the controlled QueueNetworks).voidstop(QueueNetwork Network) Stops the NetSystem Engine and terminates the simulation.voidTerminates NetSystem and closes the log.
-
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
Starts the NetSystem Engine and executes the simulation. This method should be called when all NetNode of all QueueNetworks are ready to start.- Throws:
NetExceptionInterruptedException
-
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
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
Aborts the NetSystem Engine and terminates the simulation.- Parameters:
network- Reference to the network to be stopped.
-
addNetwork
Adds a new network to the NetSystem.- Parameters:
Network- Reference to the network to be added.
-
getNetworkList
-
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
Gets a node from its id. Searches the id between all the networks- Parameters:
Id- the id of the node- Returns:
- searched node
-
getNode
-
checkProgress
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
- 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
-
nextjobNumber
public int nextjobNumber() -
getEngine
-