Assignment 4
Assignment 4
● Extensive Libraries
● Visualization Tools
● Customization
Simulink
● Graphical Interface
● Dynamic Simulation
● Integration with MATLAB
Model Characteristics:-
Queue Behavior:-
(c)QSIM
5.Visualization
Ques8:- Write an algorithm to update the queue length for a queuing system. Queue
length is updated as and when a person joins or leave the queue.
queue_length = 0
function join_queue():
queue_length = queue_length + 1
print("A person joined the queue. Updated queue length: ", queue_length)
function leave_queue():
if queue_length > 0:
queue_length = queue_length - 1
print("A person left the queue. Updated queue length: ", queue_length)
while true:
if event == "join":
join_queue()
leave_queue()
Step6:- END
Ques9:- Write an algorithm to update queue length and queue time for a queuing
system if each service takes 3 minutes.
Function: process_customer_arrival(arrival_time)
Function: process_customer_departure()
● If queue_length > 0:
○ Subtract 1 from queue_length (a customer has been serviced).
○ If queue_length > 0:
■ Update total_queue_time by adding service_time (next
customer starts service).
○ Else:
■ Update current_time to current_time (no customers left to
service).
● Return updated value of queue_length.
Step7:- End
Ques10:- Write an algorithm to update queue length and queue time for a queuing
system. New queue is formed only when a queue has 10 or more people in the queue.
Maximum number of queue are 4, after that a person can not join the system. Service
time is 5 minute per person.Update queue length, number of queues and queue time.
Variables:
Step1:- Start
● Set maxQueues = 4
● Create arrays queues[maxQueues] and queueTime[maxQueues] to
store queue lengths and queue times.
● Initialize all elements of queues and queueTime to 0.
● Set totalPeople = 0.
Step6:- End
Ques6:- Draw flow chart, write algorithm and programs for: a. Queuing Model
{(M / M /1):(∞/ FCFS)}.
Ans:-