COMP 5416编程讲解、辅导R编程设计、R留学生程序讲解 辅导R语言程序|讲解数据库SQL

- 首页 >> Java编程
COMP 5416 Assignment 2
Due: 16 November 2020, 23:59. Sydney time
Question 1 (TCP, 20%). In the following network, node A transmits packets that pass through B and C, and arrive at the
destination D. The bit rate of all links is R = 1 Mbit/sec. The maximum packet size in the network is 500 Bytes. Ignore the
header size. The one-way propagation delay on each link is 4 msec.
How long does it take to transmit 100 + s packets if TCP Reno is used, where s is the last two digits of your student number.
At the beginning, ssthresh is 8 segment size (4000 bytes). B and C use Store-and-Forward. No packet is lost. There is no
bit-error in transmission. The size of ACK packets is negligible. The size of TCP header is negligible.
$ % & '
2
Question 2 (Queueing Theorem: Simulation, Analysis, and Application, 20%). In this task, you need to simulate and analyze
an M/M/m/n queue with arbitrary m and n. You can reuse the codes in Week 6 Lab to simulate an M/M/m/n queue. You
Python code must be submitted as supplementary material. You also need to theoretically compute the stationary distribution to
verify your simulation. Finally, you will understand how queueing theorem will help design and install real-world telephone and
cellular networks.
Throughout this question, let the arrival rate be λ. Let the service rate of each server be µ.
(1) Let λ = 2 and µ = 3. What is the stationary distribution of an M/M/1/10 queue. Please figure out this result by both
simulation and analysis.
(2) Let λ = 5 and µ = 1. What is the stationary distribution of an M/M/5/10 queue. Please figure out this result by both
simulation and analysis.
(3) Use theoretical analysis only. What is the stationary distribution of an M/M/m/m queue (now n = m). What is the
probability that a new arrival is blocked (dropped) by the system? This probability is defined as pb.
(4) Follow (3). Let µ = 1 and m = 10. If the blocking probability pb must be limited to 0.001, what is the maximum value of
λ?
(5) Follow (3). Let λ = 10 and µ = 1. If the blocking probability pb must be limited to 0.001, what is the minimum value of
m, i.e., the number of servers?
(6) Telecom/cellular companies usually use methods in (4) and (5) to design their telephone/cellular networks. In (4), given
the required blocking probability pb and the number of telephone lines m, they want to know the maximum possible traffic
intensity λ they can accommodate. In (5), given the required blocking probability pb and the traffic intensity λ, they want to
know how many telephone lines they shall install. The method to compute pb is also well known as Erlang Formula. Google
Erlang Formula and answer the following questions.
(a) What are Erlang-B and Erlang-C Formulas? When are they used? What is the difference between them?
(b) In (4) and (5), do you use Erlang-B or Erlang-C Formula? Why?
(7) Use the Erlang table provided, and find the solution to the following question. A base station in a cellular network has 50 +s
channels, where s is the last digit of your student number. Each user uses one channel. On average, each user uses a channel
for 0.5 minutes. The blocking probability must be limited to 0.5%, what is the maximum user arrival rate λ (units/minute) that
can be supported by the base station? Which row/column in the table do you use to find the result?
3
Question 3 (Multi-thread Server: Implementation, 20%). You are given the complete code for the client in Lab in Week 8. Your
task is to write the TCP server. The client code is in client.py. You must not modify this code. (However, you are allowed
to change ServerName and ServerPort). Only Python 3 is allowed.
Different from the server in the lab, the new server must be able to serve multiple clients simultaneously. Please note that the
server code in Week 8 can only accept one client! In order to serve multiple clients simultaneously. The server should run multiple
threads. The server will establish a new connection socket to communicate with one new client, and each new connection socket
will be managed by a new thread. You should self-study the following function: _thread.start_new_thread().
The following figure shows an example of server when two clients are sending images at the same time. The two connections
are closed in the end, demonstrating that there are two concurrent transmissions before the first “Connection closed”.
You also need to capture the concurrent data transmission by Wireshark. In the example in the next page, we can see that the
two clients are running at 192.168.0.3, with port numbers 60458 and 60462. The server is running at 192.168.0.4, with port
number 12011. The throughputs of the two connections are both positive at around the 4th second.
Tasks and submissions:
(1) Build up a multi-thread server which can serve multiple clients at the same time. Submit your server-side Python code.
Submit your server code as Lastname_Firstname_Server.py. We will use the client in Week 8 to test against your server.
(2) Test your server with three clients sending images at the same time. Capture the packets by Wireshark at the server side.
You are allowed to run the server and clients in one computer using localhost. Submit your Wireshark capture. Your capture
file must be smaller than 10MB. Your capture will be ignored and will not be marked if it is greater than 10MB. Submit your
capture as Lastname_Firstname_Capture.pcapng (or .pcap).
(3) In the main submission file, based on your capture in (2), plot the throughput vs. time of the three connections (similar to
the figures in the next page). Show that they are operated in parallel. In the main file, you also need to give the three clients’
IP addresses, clients’ port numbers, server’s IP address, and server’s port number.
4
You overall mark will be zero if you do not submit code in (1), no matter if you submit (2) or (3).
You submission in (2) and (3) will be ignored and will not be marked if your submission in (1) does not work.
You overall mark will be zero if your Wireshark capture in (2) does not match the throughput plots in (3).
5
Question 4 (BER vs SNR with different modulation schemes, 20%). We aim to plot BER vs SNR curves of two modulation
schemes in this question.
(1) BPSK. In wireless communication, we can transmit 0 and 1 through signals −1 and 1 respectively. Both −1 and 1 signals
have power of 1, so that the mean signal power is 1. This is called Binary Phase Shift Keying (BPSK). Due to the existence of
noise, the received signal is −1+n or 1+n respectively, where n is the noise term. n follows Gaussian distribution n ∼ N(0, σ2
).
σ
2
is the power of the noise, and thus 1
σ2 is SNR. If the received signal is ≥ 0, it is decoded as 1; if the received signal is < 0,
it is decoded as 0. We assume that 0 and 1 are sent with equal probabilities. Compute average BER vs SNR of BPSK when
SNR = [0,5,10,15,20,25] dB. Hint: What is dB?
(2) 4PAM. Now we consider another modulation scheme, where each signal can represent two bits. We can transmit 00, 01, 11,
10 through signals −3, −1, 1, and 3 respectively. The mean signal power of the signal is 3
2+12+12+32
4 = 5. This is called 4
pulse-amplitude modulation (4PAM). Still, due to the existence of noise, the received signal is −3 + n, −1 + n, 1 + n, or 3 + n
respectively, where n is the noise term. Still, n follows Gaussian distribution n ∼ N(0, σ2
). σ
2
is the power of the noise, and
thus 5
σ2 is SNR. If the received signal is in (−∞, −2], (−2, 0], (0, 2], and (2, ∞), it is decoded as 00, 01, 11, and 10 respectively.
We assume that 00, 01, 11, and 10 are sent with equal probabilities. Compute average BER vs SNR of 4PAM when SNR =
[0,5,10,15,20,25] dB. Note that if 00 is decoded as 01, it is regarded as one bit error; if 00 is decoded as 11, it is regarded as
two bit errors.
To compute Q function, you can use Python math.erfc() function. math.erfc() returns result of erfc function, and Q(x) =
1
2
erfc( √x
2
).
(3) Plot the BER vs SNR curves of BPSK and 4PAM. You should derive a figure like Page 45 in the slides of Week 8. Discuss
why improved data rate can cause higher BER.
6
Question 5 (VoIP, 20%). A VoIP trace is included in A2Q5trace.xlsx. The trace includes VoIP data packets. Each line in the
trace shows the sending timestamp, sequence number, and receiving timestamp of a VoIP packet. At the beginning, the delay
estimation di
is 100ms, and the deviation of delay vi
is 10ms. Find the right place in the slides to review how di and vi values
are updated. Let α = 0.1 and β = 0.1. The playout time is set as follows.
playouttimei = ti + di + xvi
, (1)
where x = 2 + s/10, and s is the last digit of your student number. For example, if your student number is 490123456, x = 2.6
in your case. Please answer the following questions.
(1) What are the playout times of all packets? List all of them in a table.
(2) How many packets missed the playout time?
7
Question 6 (Bonus Question, optimization, additional 10%). In this question, we aim to solve the following optimization problem.
min
x
kAx − bk
2
,
subject to Gx = h.
x is an n-dimension vector, A is an m × n matrix, G is a p × n matrix. Give the KKT conditions, and derive expression and
values for the optimal solution x

. m ≥ n, p ≤ n.
Please unzip A2Q6input.zip. The values of A, b, G, h are stored in the SIDX.txt, where X is the last digit of your SID. In
the file, the first part is 10 × 8 matrix of A; the second part is 10-dimension b; the third part is 5 × 8 matrix of G; and the
fourth part is 5-dimension h. k · k indicates the L2-norm of a vector. Please note that you will get zero if you do not use your
own SID.
8
Submission Instructions: You should submit one main file and several supplementary files. You should include your answers
to Q1–Q6 and explanations of your answers in the main file. You should submit your main file at “main file submission”. The
main file is in the format of pdf. For Q2, you must submit your queue simulator at “Q2 code submission”. For Q3, you must
submit your Python code at “Q3 code submission” and Wireshark capture at “Q3 capture submission”. Your code and capture
will be examined against your answers in the main file. Penalty would be incurred if your code/capture does not match your
answer in the main file. For Q4, you may upload Python code to calculate Q-function in “Q4 Q-function calculation”. For Q5,
you may use Python or Excel to process the raw data. You may upload Python code or excel file in “Q5 data processing”. Please
note that, files uploaded in Q4 and Q5 will be marked as intermediate steps. Wrong answers in Q4 and Q5 without file uploads
will incur heavier penalties.
File upload File format Must upload?
main file submission pdf Yes
Q2 code submission Python 3 code Yes
Q3 code submission Python 3 code Yes
Q3 capture submission Wireshark capture Yes
Q4 Q-function calculation Python 3 code No
Q5 data processing Python 3 code or Excel file No
TABLE I
FILE UPLOAD
All your submissions will be checked by plagiarism examination tools.
This is one assignment with multiple pieces to submit. Your submission time is equal to the submission time of the last piece.

站长地图