# Result

**Some snippets from your converted document:**

>>> Assignment #4 for Simulation (CAP 4800) <<< >>> SOLUTIONS <<< This assignment covers material from the fourth week of class lecture. Problem #1 (35 points) Determine X, Ts, U, W, Wq, L, and Lq for the following single-server queueing system for the time period 0 to 150 seconds. Carefully show your work including all pertinent figures and formulas. Hint: Review your week #4 reading (MacDougall, Chapter 1). Arrival #1 at time = 10 seconds with service time = 20 seconds Arrival #2 at time = 20 seconds with service time = 30 seconds Arrival #3 at time = 35 seconds with service time = 10 seconds Arrival #4 at time = 80 seconds with service time = 120 seconds Arrival #5 at time = 100 seconds with service time = 20 seconds For solution see next page (scan of handwritten solution) KJC (as3_4sol.doc – 05/30/13) Page 1 of 6 Problem #2 (30 points) Using the mm1.c simulation program we discussed in class (and that is available for download via the class website), simulate the following offered loads for an M/M/1 queue: 50%, 60%, 70%, 80%, 85%, 90%, 91%, 92%, …, 98%. Fix the service time to be 1.0. For each offered load collect results on the mean number of customers in the system (L). Use a SIM_TIME of 200000 seconds. Plot both the simulation results and theory results (based on the formula for L for M/M/1) on one graph. Plot a graph of relative error for simulation to theory versus offered load on another graph. Comment on the relative error. Does it stay the same for all offered loads? M/M/1 simulation and theory results SIM_TIME = 200000 seconds offered sim L theory L Error (%) 0.5 1.008 1.000 -0.82 0.6 1.503 1.500 -0.21 0.7 2.349 2.333 -0.67 0.8 3.948 4.000 1.31 0.85 5.713 5.667 -0.82 0.9 8.793 9.000 2.36 0.91 10.231 10.111 -1.17 0.92 10.744 11.500 7.04 0.93 13.337 13.286 -0.38 0.94 15.453 15.667 1.38 0.95 21.541 19.000 -11.80 0.96 23.153 24.000 3.66 0.97 34.251 32.333 -5.60 0.98 37.980 49.000 29.02 The absolute magnitude of relative error increases as offered load increases. KJC (as3_4sol.doc – 05/30/13) Page 2 of 6 Problem #3 (35 points) Repeat problem #2 for M/D/1 (of course, you can’t use the formula for L for M/M/1, you must use the P-K formula correctly). You will need to modify mm1.c to model an M/D/1 queue. In addition to the two plots, also submit your modified mm1.c (perhaps call it md1.c?) source code. Comments on the relative error – is it greater or smaller than for the M/M/1 simulation? Speculate on the “why”. M/D/1 simulation and theory results SIM_TIME = 200000 seconds offered sim L theory L Error (%) 0.5 0.753 0.750 -0.45 0.6 1.052 1.050 -0.18 0.7 1.518 1.517 -0.12 0.8 2.398 2.400 0.10 0.85 3.224 3.258 1.05 0.9 4.891 4.950 1.20 0.91 5.421 5.511 1.65 0.92 6.096 6.210 1.88 0.93 6.906 7.108 2.93 0.94 7.938 8.303 4.60 0.95 9.482 9.975 5.20 0.96 11.977 12.480 4.20 0.97 15.327 16.652 8.65 0.98 21.793 24.990 14.67 The absolute magnitude of relative error is less than for the M/M/1 simulation. This is because there is less variability in the M/D/1 case (deterministic service, which has variance = 0) than the M/M/1 case (exponential service time with non- zero variance). KJC (as3_4sol.doc – 05/30/13) Page 3 of 6 Appendix – M/D/1 simulation program for problem #3 //=========================================================== file = md1.c ===== //= A simple "straight C" M/D/1 queue simulation = //============================================================================== //= Notes: = //= 1) The values of SIM_TIME, ARR_TIME, and SERV_TIME need to be set. = //=----------------------------------------------------------------------------= //= Build: gcc md1.c -lm, bcc32 md1.c, cl md1.c = //=----------------------------------------------------------------------------= //= Execute: mm1

**Recently converted files (publicly available):**