頻寬與延時知識整理
一直以來對頻寬和時延的計算都迷迷糊糊,今天做了一個簡單的整理。
基礎
首先弄清楚幾個概念:訊號佔用頻寬、資料傳輸速率(位元率)、波特率、通道頻寬
訊號的誤區:0101、0110 等等,這些不是訊號(是訊息)。訊號是實實在在的波形,方波、正弦波等。
訊號佔用頻寬指的是訊號傳輸速率。
碼元(code)——在使用時間域(或簡稱為時域)的波形表示數字訊號時,代表不同離散數值的基本波形。
訊息的傳遞整個過程是這樣的:
如果訊息是模擬訊號,那麼先要取樣、量化,變為 0101、0110 這樣的抽象訊息。
將 0101、0110 這樣的訊息編碼為訊號。有各種編碼方式,歸零、不歸零等等。這樣得到的訊號是基頻訊號。
注意:4B/5B 編碼是將訊息編碼為訊息,編碼後的結果還是 00101、01101 等資料,而不是實實在在的資訊。
頻寬
頻寬,又叫頻寬,是資料的傳輸能力,指單位時間內能夠傳輸的位元數。高頻寬意味著高能力。
數字裝置中頻寬用bps(b/s)表示,即每秒最高可以傳輸的位數。模擬裝置中頻寬用Hz表示,即每秒傳送的訊號週期數。通常描述頻寬時省略單位,如10M實質是10M b/s。
下面解釋來自《資料網路技術》ppt 第一章 73 頁。
“頻寬”(bandwidth)本來是指訊號具有的頻頻寬度,單位是赫(或千赫、兆赫、吉赫等)。
現在“頻寬”是數字通道所能傳送的“最高資料率”的同義語,單位是“位元每秒”,或 b/s (bit/s)。
資料傳輸速率
資料傳輸速率,又稱位元率,指每秒鐘實際傳輸的位元數,是資訊傳輸速率(傳信率)的度量。單位為“位元每秒(bps)”。其計算公式為S=1/T。T為傳輸1位元資料所花的時間。
波特率
在資訊傳輸通道中,攜帶資料資訊的訊號單元叫碼元,每秒鐘通過通道傳輸的碼元數稱為碼元傳輸速率,簡稱波特率。波特率是指資料訊號對載波的調製速率,它用單位時間內載波調製狀態改變的次數來表示(也就是每秒調製的符號數),其單位是波特(Baud,symbol/s)。波特率是傳輸通道頻寬的指標。
位元率=波特率*單個調製狀態對應的二進位制位數(Rb=RB*log2 N。其中,N為進位制數)
通道頻寬
通道頻寬是指通道支援的最大傳輸速率,由夏農定理決定
無噪通道頻寬:R=B log2(N)
有噪通道頻寬:Rb=W*log2(1+S/N)
參考網頁:
通訊常識
一般說的訊號頻寬指的是,訊號佔用的頻寬,即訊號的傳輸速率。
下面圖片來自《資料網路技術》ppt 第一章 75 頁。
下面圖清晰的說明了訊號基頻與傳輸速率的關係,以及訊號頻率頻寬的作用。
訊號基頻決定傳輸熟慮,訊號頻率頻寬只是決定訊號質量而已。
碼元與信元的理解
從上圖可以看出一個碼元指的是一個 0,1 這樣的訊息。一個信元指的是一個電平。
如果用 TCP 協議傳輸,那麼傳輸速率與視窗大小的關係?
視窗越大,則傳輸速率越大。
計算公式為: rate = window/RTT
注:視窗的大小為位元組數。視窗作用是傳送 window 個位元組後等待另一方的應答。
參考網頁:這個部落格中例題
這個例題中假設的視窗大小為資料包的個數,不準確,應該是位元組數。
總結:
傳輸速率計算公式已知的有兩個,
- 基波頻率(與取樣週期、訊號等級有關)
- 視窗大小(傳輸資料量/耗費時間)
下面這段話說明傳輸速率取決於調變解調器(取樣率)和信達容量(上限)。
The communication link considered is viewed as a bit pipe over which a given number
of bits per second can be transmitted. This number is called the transmission capacity of
the link. It depends on both the physical channel and the interface (e.g., modems), and is
simply the rate at which the interface accepts bits.
時延
下面圖片來自《資料網路技術》ppt 第一章 81 頁。
In what follows, we will mostly focus on packet delay within the communication
subnet (i.e., the network layer). This delay is the sum of delays on each subnet link
traversed by the packet. Each link delay in tum consists of four components.
- The processing delay between the time the packet is correctly received at the head
node of the link and the time the packet is assigned to an outgoing link queue
for transmission. (In some systems, we must add to this delay some additional
processing time at the DLC and physical layers.) - The queueing delay between the time the packet is assigned to a queue for transmission and the time it starts being transmitted. During this time, the packet waits
while other packets in the transmission queue are transmitted. - The transmission delay between the times that the first and last bits of the packet
are transmitted. - The propagation delay between the time the last bit is transmitted at the head
node of the link and the time the last bit is received at the tail node. This is
proportional to the physical distance between transmitter and receiver; it can be
relatively substantial, particularly for a satellite link or a very high speed link.
按照上面的意思:
時延 = 處理時延 + 排隊時延 + 傳送時延 + 傳播時延
QoS
現有網路控制時延和頻寬的方式為:
將路由器中正在排隊的資料包放在不同的優先順序佇列中,優先順序高的佇列,優先發送。
這樣在傳輸資料量不變的情況下,耗費時間變了,計算出來的頻寬也就變了,同時延時也發生了改變。
從下面這句話理解:FDM 控制頻寬的方式為減少採樣頻率,TDM 控制頻寬的方式為增加等待時間。
In time-division (TDM) and frequency-division multiplexing (FDM) with m traffic
streams, the link capacity is essentially subdivided into m portions-one per traffic
stream. In FOM, the channel bandwidth W is subdivided into m channels each with
bandwidth W /m (actually slightly less because of the need for guard bands between
channels). The transmission capacity of each channel is roughly C /m, where C is
the capacity that would be obtained if the entire bandwidth were allocated to a single
channel. The transmission time of a packet that is L bits long is Lm/C, or m times
larger than in the corresponding statistical multiplexing scheme. In TOM, allocation is
done by dividing the time axis into slots of fixed length (e.g., one bit or one byte long,
or perhaps one packet long for fixed length packets). Again, conceptually, we may view
the communication link as consisting of m separate links with capacity C /m. In the case
where the slots are short relative to packet length, we may again regard the transmission
time of a packet L bits long as Lm/C. In the case where the slots are of packet length,
the transmission time of an L bit packet is L/C, but there is a wait of (m - 1) packet
transmission times between packets of the same stream.