import desmoj.core.simulator.*; import desmoj.core.dist.*; import desmoj.core.advancedModellingFeatures.*; public class SimulationModel extends Model { private static final int NUM_CUSTOMER_INIT = 4; private static int SIM_DURATION = 1000; // 1000 takes ~20sec on a Pentium 1.8Ghz (for customers=4) private static double SIM_TRACE_PERIOD = 10; private static double SIM_DEBUG_PERIOD = 0; private static boolean SHOW_PROGRESS_BAR = false; private RealDistUniform routingProb; private RealDistExponential cpuServiceTime; private RealDistExponential disk1ServiceTime; private RealDistExponential disk2ServiceTime; Res cpu; Res disk1; Res disk2; Res infiniteServer; public SimulationModel(Model owner, String modelName, boolean showInReport, boolean showInTrace) { super(owner, modelName, showInReport, showInTrace); } public String description() { return "This is the Central Server model description,"+ "in a process oriented version with RES objects that HOLD."+ "This model is a central server model where customers(requests) will arrive and "+ "require the service of a CPU, which in turn requests service at one of."+ "two disks. The customer may then leave the system, or get serviced once "+ "more by the CPU. We use an InfiniteServer with no servicetime to get the "+ "Throughput of the system. Simulation time is in seconds"; } public double getRoutingProb() { return routingProb.sample(); } public double getCPUServiceTime() { return cpuServiceTime.sample(); } public double getDisk1ServiceTime() { return disk1ServiceTime.sample(); } public double getDisk2ServiceTime() { return disk2ServiceTime.sample(); } public void doInitialSchedules() { for (int i=0; i