1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.tutorial.section42;
11
12 import java.rmi.RemoteException;
13
14 import nl.tudelft.simulation.dsol.ModelInterface;
15 import nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface;
16 import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
17 import nl.tudelft.simulation.dsol.statistics.Persistent;
18 import nl.tudelft.simulation.dsol.statistics.Tally;
19 import nl.tudelft.simulation.dsol.statistics.charts.XYChart;
20
21 /***
22 * A 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 href="http://www.simulation.tudelft.nl">
26 * 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 1.0 Dec 8, 2003 <br>
31 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
32 * Jacobs </a>
33 */
34 public class Model implements ModelInterface
35 {
36 /***
37 * constructs a new Model
38 *
39 */
40 public Model()
41 {
42 super();
43 }
44
45 /***
46 * @see nl.tudelft.simulation.dsol.ModelInterface
47 * #constructModel(nl.tudelft.simulation.dsol.simulators.SimulatorInterface)
48 */
49 public void constructModel(final SimulatorInterface simulator)
50 throws RemoteException
51 {
52 DEVSSimulatorInterface devsSimulator = (DEVSSimulatorInterface) simulator;
53
54 SellerInterface warehouse = new Warehouse(devsSimulator);
55 Retailer retailer = new Retailer(devsSimulator, warehouse);
56 new Customer(devsSimulator, retailer);
57
58 new Tally("orderingCosts", simulator, retailer,
59 Retailer.TOTAL_ORDERING_COST_EVENT);
60
61 Persistent inventory = new Persistent("inventory level", simulator,
62 retailer, Retailer.INVENTORY_LEVEL_EVENT);
63 Persistent backlog = new Persistent("backlog level", simulator,
64 retailer, Retailer.BACKLOG_LEVEL);
65
66 XYChart chart = new XYChart(simulator, "Inventory Levels");
67 chart.add(inventory);
68 chart.add(backlog);
69 }
70 }