Tribhuwan University

Institute of Science and Technology

2082

Bachelor Level / Third Year / Fifth Semester / Science

B.Sc in Computer Science and Information Technology (CSC328)

(Simulation and Modeling)

Full Marks: 60

Pass Marks: 24

Time: 3 Hours

Candidates are required to give their answers in their own words as for as practicable.

The figures in the margin indicate full marks.

Section A

Long Answers Questions

Attempt any TWO questions.
[2*10=20]
1.
Describe the MARK and TABULATE block in GPSS. A coffee shop has a single barista serving customers. Customers arrive at an average rate of one every 3 minutes and the barista takes an average of 2.5 minutes to serve a customer. Create a simulation model and block diagram representing the coffee shop using GPSS blocks and simulate the system for 8 hours.[10]

MARK and TABULATE Block in GPSS & Coffee Shop Simulation


Part A: MARK Block

MARK block is used to record the current clock time in a specified parameter of a transaction, which can later be used to calculate transit time or time intervals.

Syntax: MARK A

  • If operand A is specified, the current clock time is stored in parameter A of the transaction
  • If A is blank, the clock time is stored in the Mark Time word of the transaction
  • Used in conjunction with the TABULATE block to measure time spent by transactions in the system
  • Helps in collecting time-in-system statistics

Part B: TABULATE Block

TABULATE block is used to collect statistical data and record frequency distributions in a TABLE entity.

Syntax: TABULATE A

  • Operand A specifies the TABLE number where the data is to be recorded
  • Each time a transaction enters a TABULATE block, it makes one entry in the specified table
  • Works with a previously defined TABLE definition that specifies:
    • The variable to be tabulated
    • Upper limit of the first frequency class
    • Width of each frequency class
    • Number of frequency classes
  • Commonly used to tabulate transit times (time spent by transactions in the model)

TABLE Definition Syntax: name TABLE A,B,C,D

Where A = variable, B = upper limit of first class, C = class width, D = number of classes


Part C: Coffee Shop Simulation Model

Given Data:

  • Inter-arrival time: Average 3 minutes (exponentially distributed)
  • Service time: Average 2.5 minutes (exponentially distributed)
  • Single barista (one server)
  • Simulation duration: 8 hours = 480 minutes

Block Diagram (Described in Words)

GENERATE → QUEUE → SEIZE → DEPART → ADVANCE → RELEASE → TABULATE → TERMINATE

The flow is:

  • Customers are generated every 3 minutes
  • They join the queue (QUEUE)
  • They seize the barista (SEIZE)
  • They depart from the queue (DEPART)
  • They are served for 2.5 minutes (ADVANCE)
  • They release the barista (RELEASE)
  • Transit time is tabulated (TABULATE)
  • They leave the system (TERMINATE)

GPSS Code

* Coffee Shop Simulation Model
* Simulation time: 480 minutes (8 hours)

        SIMULATE

* Define Table for Transit Time
THRUPUT TABLE   MP1,0,1,20

* Customer Generation and Service
        GENERATE    3,FN$XPDIS       ;Customers arrive every 3 min (exponential)
        MARK        1                 ;Mark arrival time in parameter 1
        QUEUE       LINE              ;Join the waiting line
        SEIZE       BARISTA           ;Capture the barista
        DEPART      LINE              ;Leave the queue
        ADVANCE     2.5,FN$XPDIS     ;Service time avg 2.5 min (exponential)
        RELEASE     BARISTA           ;Free the barista
        TABULATE    THRUPUT           ;Record transit time in table
        TERMINATE                     ;Customer leaves

* Timer Segment
        GENERATE    480               ;Generate one transaction at 480 min
        TERMINATE   1                 ;Decrement termination counter

* Control Statement
        START       1                 ;Run until counter reaches 0

        END

Explanation of Key Blocks Used

Block Purpose
GENERATE 3 Creates customers with inter-arrival time of 3 min
MARK 1 Records arrival time in parameter 1
QUEUE LINE Collects queue statistics
SEIZE BARISTA Customer occupies the single server
DEPART LINE Removes customer from queue count
ADVANCE 2.5 Simulates service time of 2.5 min
RELEASE BARISTA Frees server for next customer
TABULATE THRUPUT Records total time in system
TERMINATE 1 Ends simulation after 480 minutes

Expected Performance

  • Server Utilization = Average Service Time / Average Inter-arrival Time = 2.5 / 3 = 0.833 (83.3%)
  • Approximately 160 customers will be served in 8 hours (480/3)
  • The MARK and TABULATE blocks help measure average transit time of each customer through the system

Conclusion: The MARK block timestamps transactions on arrival, and the TABULATE block records time-based statistics in tables. Together, they provide essential performance metrics like average time-in-system for the coffee shop simulation model.

2.
What is simulation? Describe the analogy between a mechanical system and corresponding electrical system with reference to dynamic physical model.[10]
3.
What are the properties of random numbers? The sequence of numbers 0.23, 0.45, 0.67, 0.12, 0.89, 0.34, 0.56, 0.78, 0.19, 0.41, 0.63, 0.08, 0.85, 0.29, 0.51, 0.73, 0.16, 0.94, 0.37, 0.59 has been generated. Test for the independence among numbers in the sequence starting with index (i) = 2 and lag (m) = 3 using auto-correlation test. (α=0.05\alpha = 0.05, Zα/2=1.96Z_{\alpha/2} = 1.96)[10]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
Explain static mathematical model with suitable example. [5]
5.
Define Markov Chain. Explain with suitable example. [5]
6.
Explain non-stationary Poisson process in brief. [5]
7.
Discuss the inverse transform technique and acceptance-rejection technique for random variate generation. [5]
8.
Explain the iterative process of calibrating a model. [5]
9.
Explain Kendall notation with appropriate example. [5]
10.
Explain Hybrid Simulation with examples. [5]
11.
What is a feedback system? Explain with suitable examples. [5]
12.
Write a short note on: a. Mid Square Method b. Digital Analog Simulation [2.5+2.5]