umontreal.iro.lecuyer.simevents
Class Sim
- java.lang.Object
-
- umontreal.iro.lecuyer.simevents.Sim
-
public final class Sim extends java.lang.ObjectThis static class contains the executive of a discrete-event simulation. It maintains the simulation clock and starts executing the events in the appropriate order. Its methods permit one to start, stop, and (re)initialize the simulation, and read the simulation clock.Starting from SSJ-2.0, the Sim class now uses the default simulator returned by the getDefaultSimulator() method in the
Simulatorclass. Although the Sim class is perfectly adequate for simple simulations, theSimulatorclass is more general and supports more functionnalities. For example, if one needs to have more than one simulation clock and event list, one will have to use theSimulatorclass instead of the simpler Sim class.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static EventListgetEventList()Gets the currently used event list.static voidinit()Reinitializes the simulation executive by clearing up the event list, and resetting the simulation clock to zero.static voidinit(EventList evlist)Same asinit, but also chooses evlist as the event list to be used.static voidstart()Starts the simulation executive.static voidstop()Tells the simulation executive to stop as soon as it takes control, and to return control to the program that calledstart.static doubletime()Returns the current value of the simulation clock.
-
-
-
Method Detail
-
time
public static double time()
Returns the current value of the simulation clock.- Returns:
- the current simulation time
-
init
public static void init()
Reinitializes the simulation executive by clearing up the event list, and resetting the simulation clock to zero. This method must not be used to initialize process-driven simulation;SimProcess.initmust be used instead.
-
init
public static void init(EventList evlist)
Same asinit, but also chooses evlist as the event list to be used. For example, calling init(new DoublyLinked()) initializes the simulation with a doubly linked linear structure for the event list. This method must not be used to initialize process-driven simulation;umontreal.iro.lecuyer.simprocs.DSOLProcessSimulator(EventList) orumontreal.iro.lecuyer.simprocs.ThreadProcessSimulator(EventList) must be used instead.- Parameters:
evlist- selected event list implementation
-
getEventList
public static EventList getEventList()
Gets the currently used event list.- Returns:
- the currently used event list
-
start
public static void start()
Starts the simulation executive. There must be at least one Event in the event list when this method is called.
-
stop
public static void stop()
Tells the simulation executive to stop as soon as it takes control, and to return control to the program that calledstart. This program will then continue executing from the instructions right after its call to Sim.start. If anEventis currently executing (and this event has just called Sim.stop), the executive will take control when the event terminates its execution.
-
-
DMelt 3.0 © DataMelt by jWork.ORG