VIEWVULN2uUCA Exercise 2. Consider the above initial state (0) of a simulation-by-hand of a given FIFO server queue. Complete it and determine the 2 next states (l) and (2) and fill in the blanks to explain your calculations. State (1): ww w .times in eve Explanation: State: .......................Event .... Clock - min....... B(1) .... Because . O(0) -.. Calendar: Explanation: ..Event.. State: ... Clock - min........ BU) -... Because QU) ........ Calendar: Number of completed delays... State (2): V es Events Explanation: State (2): comedang menu ung Explanation: State: ..... Clock-min...... B(t)-... Because Event EVE O(t) . Calendar Number of completed delays... Exercise 1. Consider the following data of an SSQ system to simulate according to FIFO discipline: 12345678 Arrival time 15 45 10 15 152 16.622 Service Time 053423 43.121 Number of jobs 1. Calculate interarrivals 2. Calculate and values for 3. Calculate and 4. Calculate the arrival rate and the service rate 5. Calculate the traffic intensity 6. Calculate for 7. Calculate and & Calculate, and Your Answer: Exercise 1. Consider the following data of an SSQ system to simulate according to FIFO discipline: 1 Arrival time a 1. 5 457 T1015 15.2 16.6 Service Times 4 3.5 3. 4 2 38 Number of jobs 1 8 1. Calculate interarrivals . 2. Calculate and d, values for i=1, 3. Calculate F and S. 4. Calculate the arrival rate and the service rate 5. Calculate the traffic intensity 6. Calculate w, for i=1.. 7. Calculated and . 8. Calculate T. and f Your Answer: 3)...... Exercise 2. Ste v en Initialize in graph Consider the above initial state (0) of a simulation-by-hand of a given FIFO serverenComplete it and determine the 2 next states (1) and (2) and fit in the blanks to explain your calculations. State (1): Setete (Event Clock B o Amval times of cu in que Del An Endl Number of Total of completed waiting waiting times in queue times in queue Are under o o graph B graph 15 1 3 interarrival times Service times Time Mate 255 25 24 3 4 5 54 23 State: ...................... Even Clock-min........ .... BO...... Because .......... (t)- ............ Calendar: ........ Number of completed delays... Ed. S06)de-... SB()dt-..... State (2) State: (Event Clock B(H) om Arrival times of custs, in queue Event calendar Depl Arr] - 20.00. End] Area under B(0) Number of completed waiting times in queue Total of waiting times in queue Area under Q() Q(1) graph B(1) graph Time (Minutes) ] Interarrival times Service times 25 5.4 Explanation: State: ... ............. Event ... Clock = min. B(t) = ...... Because Q(t) = ............... Calendar: .. Number of completed delays = .... ... It is possible to verify your codes by calling the function in command window using the vector A [ 15, 1, 8, 6, 10, 5) ... It is possible to verify your codes by calling the function in command window using the vector S-(0.5, 0.8, 0.6, 1, 0.4, 0.2] Part 1 Q1. Write a function or script arrivall) with input N and A. It asks the user to enter element by element the arrival data value A(1), A/2),..., AIN) such that values are accepted only if are real between 0 and 8 A loop structure is used to ask entering values. Another nested loop is used to re-enter values it they don't respect the given condition Q2. Write a function testi() with input a vector A of size N. It returns 1 ifall values of A are between 0 and 8 and returns 0 otherwise Part 2 Q3. Write a function correct() with input: a vector A of size N. It asks the user to correct elements of A that are not between 0 and 8. No test is applied after correction. Q4. Write a function test2() with input: a vector A of size N. It returns the number of bad values in A (ie not in the interval [0, 8]) and a vectors E of size b containing the indexes of bad values in A. Part 3 Q5. Write a function interarrivall) that returns for a sorted input vector Aa vector B such that B(1)=A(1) and B() Ali)-A[i-1) for i=2 B is called interarrival vector Q6. In command window, do the following: . Call the function arrival() to generate arrival vector A with n=10 Sort A in increasing order Call the function interarrival() to obtain interarrival vector B Part 4 Q7. Create a function or script service() with input N and S that asks the user to enter element by element the service time values S(1), S(2)..., S(N) such that values are accepted only if are real between O and 1.5 A loop structure is used to ask entering values, in which another loop is used to re-enter values if they don't respect the given condition Q8. Write a function avgval() with vector S as input. It returns the average value of the vector 5 Q9. Write a function maxval() with vector Sas input. It returns the larger value in the vectors Part 5 Q10. Write a function runsim() that for input data S and A as service and arrival time vectors calculate and display all simulation variables and outputs: . Interarrival - Delay Completion time dbar, rbar, sbar, wbar, Ibar, abar, xbar VIEWVULN2uUCA Exercise 2. Consider the above initial state (0) of a simulation-by-hand of a given FIFO server queue. Complete it and determine the 2 next states (l) and (2) and fill in the blanks to explain your calculations. State (1): ww w .times in eve Explanation: State: .......................Event .... Clock - min....... B(1) .... Because . O(0) -.. Calendar: Explanation: ..Event.. State: ... Clock - min........ BU) -... Because QU) ........ Calendar: Number of completed delays... State (2): V es Events Explanation: State (2): comedang menu ung Explanation: State: ..... Clock-min...... B(t)-... Because Event EVE O(t) . Calendar Number of completed delays... Exercise 1. Consider the following data of an SSQ system to simulate according to FIFO discipline: 12345678 Arrival time 15 45 10 15 152 16.622 Service Time 053423 43.121 Number of jobs 1. Calculate interarrivals 2. Calculate and values for 3. Calculate and 4. Calculate the arrival rate and the service rate 5. Calculate the traffic intensity 6. Calculate for 7. Calculate and & Calculate, and Your Answer: Exercise 1. Consider the following data of an SSQ system to simulate according to FIFO discipline: 1 Arrival time a 1. 5 457 T1015 15.2 16.6 Service Times 4 3.5 3. 4 2 38 Number of jobs 1 8 1. Calculate interarrivals . 2. Calculate and d, values for i=1, 3. Calculate F and S. 4. Calculate the arrival rate and the service rate 5. Calculate the traffic intensity 6. Calculate w, for i=1.. 7. Calculated and . 8. Calculate T. and f Your Answer: 3)...... Exercise 2. Ste v en Initialize in graph Consider the above initial state (0) of a simulation-by-hand of a given FIFO serverenComplete it and determine the 2 next states (1) and (2) and fit in the blanks to explain your calculations. State (1): Setete (Event Clock B o Amval times of cu in que Del An Endl Number of Total of completed waiting waiting times in queue times in queue Are under o o graph B graph 15 1 3 interarrival times Service times Time Mate 255 25 24 3 4 5 54 23 State: ...................... Even Clock-min........ .... BO...... Because .......... (t)- ............ Calendar: ........ Number of completed delays... Ed. S06)de-... SB()dt-..... State (2) State: (Event Clock B(H) om Arrival times of custs, in queue Event calendar Depl Arr] - 20.00. End] Area under B(0) Number of completed waiting times in queue Total of waiting times in queue Area under Q() Q(1) graph B(1) graph Time (Minutes) ] Interarrival times Service times 25 5.4 Explanation: State: ... ............. Event ... Clock = min. B(t) = ...... Because Q(t) = ............... Calendar: .. Number of completed delays = .... ... It is possible to verify your codes by calling the function in command window using the vector A [ 15, 1, 8, 6, 10, 5) ... It is possible to verify your codes by calling the function in command window using the vector S-(0.5, 0.8, 0.6, 1, 0.4, 0.2] Part 1 Q1. Write a function or script arrivall) with input N and A. It asks the user to enter element by element the arrival data value A(1), A/2),..., AIN) such that values are accepted only if are real between 0 and 8 A loop structure is used to ask entering values. Another nested loop is used to re-enter values it they don't respect the given condition Q2. Write a function testi() with input a vector A of size N. It returns 1 ifall values of A are between 0 and 8 and returns 0 otherwise Part 2 Q3. Write a function correct() with input: a vector A of size N. It asks the user to correct elements of A that are not between 0 and 8. No test is applied after correction. Q4. Write a function test2() with input: a vector A of size N. It returns the number of bad values in A (ie not in the interval [0, 8]) and a vectors E of size b containing the indexes of bad values in A. Part 3 Q5. Write a function interarrivall) that returns for a sorted input vector Aa vector B such that B(1)=A(1) and B() Ali)-A[i-1) for i=2 B is called interarrival vector Q6. In command window, do the following: . Call the function arrival() to generate arrival vector A with n=10 Sort A in increasing order Call the function interarrival() to obtain interarrival vector B Part 4 Q7. Create a function or script service() with input N and S that asks the user to enter element by element the service time values S(1), S(2)..., S(N) such that values are accepted only if are real between O and 1.5 A loop structure is used to ask entering values, in which another loop is used to re-enter values if they don't respect the given condition Q8. Write a function avgval() with vector S as input. It returns the average value of the vector 5 Q9. Write a function maxval() with vector Sas input. It returns the larger value in the vectors Part 5 Q10. Write a function runsim() that for input data S and A as service and arrival time vectors calculate and display all simulation variables and outputs: . Interarrival - Delay Completion time dbar, rbar, sbar, wbar, Ibar, abar, xbar