1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.simulators;
11
12 import java.io.Serializable;
13 import java.rmi.Remote;
14 import java.rmi.RemoteException;
15
16 import nl.tudelft.simulation.dsol.SimRuntimeException;
17 import nl.tudelft.simulation.dsol.experiment.Replication;
18 import nl.tudelft.simulation.event.EventProducerInterface;
19 import nl.tudelft.simulation.event.EventType;
20
21 /***
22 * The SimulatorInterface defines the behavior of the simulators in the DSOL
23 * framework. The simulator is defined as the computational object capable of
24 * executing the model. The simulator is therefore an object which must can be
25 * stopped, paused, started, reset, etc.
26 * <p>
27 * (c) copyright 2002-2004 <a href="http://www.simulation.tudelft.nl">Delft
28 * University of Technology </a>, the Netherlands. <br>
29 * See for project information <a href="http://www.simulation.tudelft.nl">
30 * www.simulation.tudelft.nl </a> <br>
31 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
32 * License (GPL) </a>, no warranty <br>
33 *
34 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
35 * Jacobs </a>
36 * @version 1.10 2004-03-18
37 * @since 1.0
38 */
39 public abstract interface SimulatorInterface extends Remote, Serializable,
40 EventProducerInterface
41 {
42 /*** END_OF_REPLICATION_EVENT is fired when a replication is finished */
43 EventType END_OF_REPLICATION_EVENT = new EventType(
44 "END_OF_REPLICATION_EVENT");
45
46 /*** START_EVENT is fired when the simulator is started */
47 EventType START_REPLICATION_EVENT = new EventType("START_REPLICATION_EVENT");
48
49 /*** START_EVENT is fired when the simulator is started */
50 EventType START_EVENT = new EventType("START_EVENT");
51
52 /*** STEP_EVENT is fired when the simulator is stepped */
53 EventType STEP_EVENT = new EventType("STEP_EVENT");
54
55 /*** STOP_EVENT is fired when the simulator is stopped */
56 EventType STOP_EVENT = new EventType("STOP_EVENT");
57
58 /*** TIME_CHANGED_EVENT is fired when the simulatorTime is updated */
59 EventType TIME_CHANGED_EVENT = new EventType("TIME_CHANGED_EVENT");
60
61 /*** WARMUP_EVENT is fired when the initialize method is invoked */
62 EventType WARMUP_EVENT = new EventType("WARMUP_EVENT");
63
64 /***
65 * returns the actual simulator time.
66 *
67 * @return the simulator time.
68 * @throws RemoteException on network failure.
69 */
70 double getSimulatorTime() throws RemoteException;
71
72 /***
73 * returns the currently executed replication.
74 *
75 * @return the current replication
76 * @throws RemoteException on network failure
77 */
78 Replication getReplication() throws RemoteException;
79
80 /***
81 * initializes the simulator with a specified replication.
82 *
83 * @param replication the replication
84 * @throws RemoteException on network failure
85 * @throws SimRuntimeException on simulator failure (simulator is running)
86 */
87 void initialize(Replication replication) throws RemoteException,
88 SimRuntimeException;
89
90 /***
91 * is the simulator running.
92 *
93 * @return boolean
94 * @throws RemoteException on network failure
95 */
96 boolean isRunning() throws RemoteException;
97
98 /***
99 * starts the simulator
100 *
101 * @throws RemoteException on network failure
102 * @throws SimRuntimeException whenever starting fails. Possible occasions
103 * include starting a started simulator
104 */
105 void start() throws RemoteException, SimRuntimeException;
106
107 /***
108 * steps the simulator.
109 *
110 * @throws RemoteException on network failure
111 * @throws SimRuntimeException whenever stepping fails. Possible occasions
112 * include stepping a stopped simulator
113 */
114 void step() throws RemoteException, SimRuntimeException;
115
116 /***
117 * stops the simulator.
118 *
119 * @throws RemoteException on network failure
120 * @throws SimRuntimeException whenever stopping fails. Possible occasions
121 * include stopping a stopped simulator
122 */
123 void stop() throws RemoteException, SimRuntimeException;
124 }