Beruflich Dokumente
Kultur Dokumente
EE 132B
2014 Fall
1/9
Outline
Admin
EE 132B
2014 Fall
2/9
Admin
Admin
Computer Assignment #2
Submit a WORD or pdf file that contains graphs, results, and (e.g.,
Matlab) code into our CCLE.
Specify the software/language used (e.g., MATLAB).
Deadline: 12/10/14 (Wed.) Midnight
EE 132B
2014 Fall
3/9
Arrival process
Message (customer) inter-arrival times are i.i.d. random variables
that are governed by an exponential distribution with parameter .
Service Times
Message (customer) service times are i.i.d. random variables that
follow an exponential distribution with parameter .
Single server (m = 1)
Buffer capacity: unlimited (infinite)
Service policy: FCFS (FIFO)
EE 132B
2014 Fall
4/9
M/M/1 QS Process
3
2
1
ttotal
EE 132B
2014 Fall
5/9
EE 132B
2014 Fall
6/9
E[X ] =
i = , i 1.
=
<1
P(j) = (1 )j , j 0.
E[Q] = D E[W ] =
D =
j=0 jP(j) = 1 ,
1
E[D] = 1
D E[X ] = (1) ,
i = , i 0.
EE 132B
2
1 .
2014 Fall
7/9
, 0 i N 1,
0 , i = N.
i = min(i, m), i 1.
f = , =
m .
P(j) = aj P(0), j 0.
P
P(0) =
aj =
j
f
j!
fj
m!mjm
a0 = 1.
N
j=0
aj
E[D] =
1
E[X ]
D .
E[W ] = E[D] 1
P
E[X ] = N
j=0 jP(j),
, 0 < j < m,
E[Q] = D E[W ].
, m j N.
N
EE 132B
2014 Fall
8/9
Initialize
Setting the initial values of system states and parameters
Report
Collect simulation data to compute and present performance
metrics.
Prof. Izhak Rubin (UCLA)
EE 132B
2014 Fall
9/9
M/M/1 Simulation:
Global Parameters
time_next_event(1:2) = 0;
% The state evolution of a single node queueing system is described through the iterative computation of
2 types of events (arrival and departure times)
% Maximum number of packets that arrive to the system (whether admitted or blocked) which induce,
when met, termination of the simulation run
Initialization
total_of_delay_time = 0;
main
% checks that the max number of served packets is below the specified limit and calls the timing( )
routine.
% The program should also include termination conditions that involve maximum a simulation run time
and queue-size limits to assure timely completion and stable operation.
timing(); % Determines the next event type and updates the current simulation time.
arrive();
case 2
depart();
end
end
report(); % report subroutine is called to generate performance exhibits.
timing()
min_time_next_event = time_next_event(k);
next_event_type = k;
end
end
sim_time = min_time_next_event;
update_time_avg_stats()
arrive()
time_next_event(1) = sim_time +
exprnd(mean_interarrival);
system_size = system_size + 1;
time_arrival_system(system_size) = sim_time;
if server_status == 1
queueing_size = queueing_size + 1;
time_arrival_queue(queueing_size) = sim_time;
wait = 0;
num_packets_wait = num_packets_wait + 1;
server_status = 1;
% server is busy
time_next_event(2) = sim_time +
exprnd(mean_service_time);
end
departure()
system_size = system_size - 1;
delay = sim_time - time_arrival_system(1);
time_arrival_system(k) =
time_arrival_system(k+1);
server_status = 0;
time_next_event(2) = 1.0e+30;
else
time_arrival(k) = time_arrival(k+1);
end
end
report()
display(['E[D] = 'num2str(total_of_delay_time/num_packets_delay)]);