Tribhuwan University

Institute of Science and Technology

2079

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.
What is transaction in GPSS? Explain about facility in GPSS. Customers arrive at Joey Barbershop one every 15±3 minutes and it takes Joey 18±2 minutes to cut hair of a customer. Create a GPSS model with block diagram for the Barbershop using the concept of facility and run the simulation for 9 hours.[10]

Transaction in GPSS

A transaction is a dynamic entity in GPSS that moves through the block diagram representing temporary objects flowing through the system (such as customers, jobs, messages, etc.).

  • Transactions are created by the GENERATE block and destroyed by the TERMINATE block
  • They represent the units of traffic that flow through the model
  • Each transaction has attributes called parameters that carry information
  • Transactions move from block to block, competing for system resources like facilities and storages
  • They are placed on chains (Current Events Chain and Future Events Chain) to manage scheduling

Facility in GPSS

A facility is a system resource in GPSS that can be used by only one transaction at a time, representing single-server entities like a barber, a machine, or a counter.

  • A facility has two states: busy or idle
  • A transaction captures a facility using the SEIZE block
  • A transaction releases a facility using the RELEASE block
  • If a transaction tries to SEIZE a busy facility, it is placed in a delay chain (queue)
  • GPSS automatically collects statistics for facilities: utilization, average time per transaction, number of entries

Key Statistics Collected:

  • Utilization — fraction of time the facility is busy
  • Entries — number of transactions that used the facility
  • Average time/transaction — mean time a transaction held the facility

Barbershop Problem — GPSS Model

Problem Statement:

  • Customers arrive every 15±3 minutes (uniform distribution)
  • Haircut takes 18±2 minutes
  • Simulate for 9 hours = 540 minutes

GPSS Block Diagram (Described)

GENERATE 15,3         → Customers arrive every 15±3 min
      ↓
QUEUE BARBERQ         → Join the waiting line
      ↓
SEIZE JOEY            → Capture the barber (facility)
      ↓
DEPART BARBERQ        → Leave the waiting line
      ↓
ADVANCE 18,2          → Get haircut (18±2 min)
      ↓
RELEASE JOEY          → Free the barber
      ↓
TERMINATE 1           → Customer leaves the system

Timer Segment:

GENERATE 540          → Generate one transaction after 540 min
      ↓
TERMINATE 1           → Stop simulation

GPSS Code

* Joey Barbershop Simulation
* Simulation time: 9 hours = 540 minutes

        SIMULATE

* Customer Segment
        GENERATE    15,3          ;Customers arrive every 15±3 min
        QUEUE       BARBERQ       ;Enter the queue
        SEIZE       JOEY          ;Capture barber facility
        DEPART      BARBERQ       ;Leave the queue
        ADVANCE     18,2          ;Haircut takes 18±2 min
        RELEASE     JOEY          ;Release the barber
        TERMINATE   0             ;Customer exits system

* Timer Segment
        GENERATE    540           ;Timer transaction at 540 min
        TERMINATE   1             ;Decrement TG1 counter

* Control Statement
        START       1             ;Run until 1 termination from timer
        END

Explanation of Key Blocks

Block Purpose
GENERATE 15,3 Creates transactions (customers) at mean 15 min, spread ±3 min
QUEUE BARBERQ Collects queue statistics (waiting time, queue length)
SEIZE JOEY Transaction captures the single-server facility "JOEY"
DEPART BARBERQ Removes transaction from queue statistics collection
ADVANCE 18,2 Holds transaction for service time (18±2 min)
RELEASE JOEY Frees the facility for the next transaction
TERMINATE Removes transaction from the model
START 1 Runs simulation until termination counter reaches 1

Conclusion

This model uses one facility (JOEY) representing the single barber. Since service time (18 min avg) exceeds inter-arrival time (15 min avg), we expect high utilization and queue buildup. The simulation runs for exactly 540 minutes (9 hours), after which GPSS automatically generates statistics on facility utilization, queue length, and waiting times.

2.
Why accuracy of analog computer is low? Explain analog computer with suitable example. Differentiate between analog and digital computer.[10]
3.
Define and develop a Poker test for four-digit random numbers. A sequence of 1,000 random numbers, each of four digits has been generated. The analysis of the numbers reveals that in 525 numbers all four digits are different, 419 contain exactly one pair of like digits, 47 contain two pairs, 9 have three digits of a kind and 7 contain all like digits. Use Poker test to determine whether these numbers are independent. (Critical value of chi-square for a = 0.05 and N = 4 is 9.49).[10]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
Why Confidence interval is needed in the analysis of simulation output. How can we establish a confidence interval? [5]
5.
Explain the Monte Carlo simulation method with example. [5]
6.
Generate ten 3 digit random integers and corresponding random variables using Multiplicative Congruential method where a =7, and X0= 22. [5]
7.
"Building a model right" and "Building a right model". Are both statements same? Discuss the importance of V&V. [5]
8.
Differentiate between discrete and continuous system. [5]
9.
What is markov chain? Explain with example. [5]
10.
Explain basic characteristics of Queuing System [5]
11.
Describe dynamic physical model in detail with the help of suitable example. [5]
12.
Write short notes: a. Hypothesis testing b. Stationary poisson process [5]