1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.simulators;
11
12 import java.rmi.RemoteException;
13
14 import nl.tudelft.simulation.dsol.SimRuntimeException;
15 import nl.tudelft.simulation.dsol.experiment.Experiment;
16 import nl.tudelft.simulation.dsol.formalisms.devs.SimEvent;
17 import nl.tudelft.simulation.dsol.simulators.DEVSSimulator;
18 import nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface;
19 import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
20
21 /***
22 * The DEVSSimulatorTestmodel specifies the model <br>
23 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
24 * University of Technology </a>, the Netherlands. <br>
25 * See for project information <a
26 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
27 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
28 * License (GPL) </a>, no warranty <br>
29 *
30 * @version 2.0 21.09.2003 <br>
31 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
32 * Jacobs </a>, <a
33 * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
34 * Verbraeck </a>
35 */
36 public class DEVSTestModel extends TestModel
37 {
38 /*** simulator refers to the target */
39 protected DEVSSimulatorInterface simulator;
40
41 /***
42 * constructs a new DEVSTestModel
43 *
44 * @param experiment the experiment which is triggered on the model
45 */
46 public DEVSTestModel(final Experiment experiment)
47 {
48 super(experiment);
49 }
50
51 /***
52 * @see nl.tudelft.simulation.dsol.ModelInterface
53 * #constructModel(SimulatorInterface)
54 */
55 public void constructModel(final SimulatorInterface simulator)
56 throws RemoteException
57 {
58 super.constructModel(simulator);
59 this.simulator = (DEVSSimulator) simulator;
60 for (int i = 0; i < 100; i++)
61 {
62 try
63 {
64 this.simulator.scheduleEvent(new SimEvent(Math.random() * i,
65 this, this, "run", null));
66 } catch (RemoteException exception)
67 {
68 exception.printStackTrace();
69 } catch (SimRuntimeException exception)
70 {
71 exception.printStackTrace();
72 }
73 }
74 }
75
76 /***
77 * the method which is scheduled
78 */
79 public void run()
80 {
81
82 }
83 }