Question: The first function prob_block is responsible for calculating the number 0.0004 from the slide, but doing so in the following more general situation.For a shared
The first function prob_block is responsible for calculating the number 0.0004 from the slide, but doing so in the following more general situation.For a shared packet switched link, given these parameters:
Rlink, data rate of the shared link, measured in bits per second
Ruser, data rate of each user when active, measured in bits per second
active, fraction of time each user is active
N, number of packet switching users
what is the probability that a user will be unable to transmit when they attempt to do so, which is called the blocking probability?The function should calculate and return that value.
For the scenario quoted above, Rlink = 1 Mb/s, Ruser = 100 kb/s, active is 0.1 (10%) and N is 35. For this calculation, assume that all packets are the same length, and all users randomly choose at each moment whether to actively use the link.
The second task is to calculate the switch capacity given the same link and user information, but now to reverse the situation and ask given an acceptable blocking probabilty, what is the capacity for packet switching?
In addition, you will also calculate the capacity for circuit switching, but this will not depend on the blocking limit, since there is no blocking in a circuit switched network (i.e. the number of users is limited at the start, so the users, once granted acccess to the network, do not have their data restricted any more).The parameters for this calculation are:
Rlink, data rate of the shared link, measured in bits per second
Ruser, data rate of each user when active, measured in bits per second
active, fraction of time each user is active
Pb=block_limit, the maximum acceptable blocking probability
and the function is to return the results for the circuit switching capacity of users and the packet switching capacity of users as a tuple (Ncircuit, Npacket)The switching capacity calculation should make use of the previously written blocking probability function.
from scipy.special import comb
def prob_block(Rlink, Ruser, active, N):
return 0.1
def capacity(Rlink, Ruser, active, block_limit):
return (5, 15)
def main():
# This section is only here so you can run your python code # directly from the command line by typing
# $ python3 lab1_yourname.py # There is nothing to do here.
R=1000000
r=100000
active = 0.1
N=35
pb = prob_block(R, r, active, N)
print(f"Given link rate {R} and user rate {r}, with {N} users active {active:.1%}")
print(f"of the time, the blocking probability is {pb:.6f}")
limit = 0.00043
(C,P) = capacity(R, r, active, 0.00043)
print(f" Given link rate {R} and user rate {r}, users active {active:.1%}")
print(f"blocking probability limit of {limit}, the capacity is") print(f"{C} for circuit switching and {P} for packet switching.")
if __name__ == '__main__': main()
# Correct output
"""
Given link rate 1000000 and user rate 100000, users active 10.0% blocking probability is 0.000424
Given link rate 1000000 and user rate 100000, users active 10.0% blocking probability limit of 0.00043, the capacity is
10 for circuit switching and 35 for packet switching.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
