Hierarchical Routing分层路由方式
1 Hierarchical Routing分层路由方式
如之前的文章提及,无线传感器在网络层通过路由逻辑分类,分为四类: 以数据为中心、分层路由、地理路由。
这篇简述Hierarchical Routing分层路由方式。
2 背景说明
2.1 对比:为什么不一直用 Data-Centric(如 Rumor Routing)?
Data-centric routing with flat topologies suffer from data overload close to the sink as the node density increases 随着节点密度的增加,具有扁平拓扑的数据中心路由会遭受接收器附近的数据过载
2.1.1 unequal use of energy 能源使用不均衡
靠近 Sink 的节点负载太重: 因为所有数据都必须通过靠近 Sink 的节点来中转,这些节点就像“瓶颈”,处理过多信息。
2.1.2 nodes die out fast 节点快速消亡
能耗不平衡 → 节点容易早死:一些节点总是被用(靠近 Sink),一些节点几乎不被用,导致网络整体寿命缩短。
3 Hierarchical Routing 分层路由结构
Hierarchical routing assumes a hierarchical topology 把网络组织成“分层结构”
实现方式:
所有节点被划分成不同的“簇”(clusters)
每个簇选出一个“簇头”(Cluster Head,红色点)
簇内的普通节点把数据先传给簇头
簇头负责将数据传给 Sink(聚合、压缩后再发)
4 LEACH(Low-Energy Adaptive Clustering Hierarchy)路由协议
LEACH(Low-Energy Adaptive Clustering Hierarchy)路由协议是无线传感器网络(WSN)中一种经典、节能的分层路由协议。
LEACH – dynamically selects cluster heads to form clusters
LEACH 协议的核心就是:动态选出簇头(Cluster Head)来组成簇
不是一开始就固定谁是领导,而是定期轮换,以节省能量。
绿色节点:簇成员
黄色节点:簇头
4.1 协议实现特征
4.1.1 簇头动态变化
cluster head role is dynamically changed so high-energy consumption is spread across all nodes 簇头角色是动态变化的,因此高能耗分散到所有节点
簇头是“高能耗角色”,因为它负责收集和上传数据。所以 LEACH 会让每个节点轮流做簇头,避免个别节点耗尽能量太快。
✅ 能量消耗更均匀,延长网络寿命。
4.1.2 簇头整合数据
communications inside a cluster are directed to the cluster head → data aggregation 簇内的通信直接发送到簇头→数据聚合
簇头会合并数据(Aggregation)& 去重(去掉重复数据),只保留有用部分发给 Sink
Duplicate Suppression(去重)
如果多个节点发来相同的数据,簇头会“只保留一个”,不重复上传。比如 source 1 和 2 都说“温度是25℃”,簇头就只发一次。
聚合函数可以是:max(取最大),min(最小),avg(平均)或者自定义函数(多输入合成一个)
✅ 进一步减少通信数据量,节能
4.1.3 簇头&SINK 相互通信
cluster heads directly communicate with the sink (or other cluster heads) 簇头直接与接收器(或其他簇头)通信
4.1.4 簇头轮次有控制
Operation of LEACH is controlled through rounds LEACH 的运行通过轮次控制
4.2 协议核心——Rounds轮次
LEACH 是一个周期性运行的协议,每一轮(Round)都分为两个主要阶段
🌟 一轮(Round)包含两个阶段:Set-up Phase(建立阶段)& Steady State Phase(稳定阶段)
4.2.1 Set-up Phase(建立阶段)
这一阶段的目的是“分簇和建立通信结构”。包括以下步骤
[ 1 ] Advertisement(广播)——选簇头(Cluster Head)
每个节点根据一定的概率 随机决定是否成为簇头。决定当簇头的节点,会向周围广播一个消息:“我可以做簇头”。
每个节点如何决定是否成为簇头(cluster head)?
LEACH 协议中节点是如何决定自己是否成为簇头的数学机制
根据期望的簇头百分比(先验确定)以及该节点迄今为止担任簇头的次数
- 每个节点 𝑛,在 [0,1) 范围内选择一个随机数
- 如果该数字小于阈值 T(n) ,该节点成为本轮簇头
每轮选择簇头的门限函数 T(n) :
T
(
n
)
=
{
P
1
−
P
∗
[
r
m
o
d
(
1
P
)
]
if
n
∈
G
0
otherwise
T(n) = \begin{cases} \frac{P}{1 - P* \left[ r \bmod \left( \frac{1}{P} \right) \right]} & \text{if } n \in G \\ 0 & \text{otherwise} \end{cases}
T(n)={1−P∗[rmod(P1)]P0if n∈Gotherwise
P:期望簇头百分比,例如P=0.05 表示希望5%的节点当簇头,一个节点20轮就会当簇头一次
1/P 一个周期的轮数。例如 P=0.1,每10轮为一个周期
r:当前轮次
G:过去1/P 轮中没有当过簇头的节点集合
mod 取模运算(模运算,求余数),例如 7mod3=1
简单记:当簇头的概率/没当过的概率
During round 𝑟 = 0, each node has a probabilityP of becoming a cluster-head. 在第 𝑟 = 0 轮期间,每个节点成为簇头的概率为 P;
Cluster-heads in round 0 cannot be cluster-heads for the next 1/P rounds. 第 0 轮中的簇头不能在接下来的 1/P 轮中担任簇头;
After (1/P ) -1 rounds, T(n) = 1 for nodes that have not yet been cluster-heads. 在 (1/P ) -1 轮之后,对于尚未成为簇头的节点,T(n) = 1;
After 1/P rounds, all nodes are once again eligible to become cluster-heads, 𝑟 is set back to 0. 在 1/P 轮之后,所有节点再次有资格成为簇头,𝑟 重置回 0。
[ 2 ] Cluster Set-up(分簇)
After selection, cluster heads advertise their decision to their neighbors → CSMA-based random access 选择后,簇头会将其决定通告给其邻居节点 → 基于 CSMA 的随机访问
- nodes become cluster members of the first cluster head from which they receive an advertisement 节点成为其收到通告的第一个簇头的簇成员
普通节点会选择 第一个发来簇头广播的簇头 来加入,所以谁抢先广播,谁可能招到更多成员 - nodes advertise information about their membership to the cluster head→CSMA-based random access 节点向簇头通告其成员身份信息 → 基于 CSMA 的随机访问
普通节点也要向簇头“回报信息”说:“我决定加入你,报告一下我的ID”
什么是 CSMA-based random access?
CSMA = Carrier Sense Multiple Access(载波监听多路访问)
节点在广播前先“听一下”信道是不是空的,空了就发,否则等一会再试
[ 3 ] Schedule Creation(创建时隙表)
为了节能,采用 TDMA(时分多址)或CDMA(码分多址) 簇头会分配时间表(schedule),让每个成员在不同时间发送数据,避免冲突和同时发数据浪费能量
🔹TDMA:Time Division Multiple Access(时分多址)
把通信时间分成一个个“时间片”,每个成员节点被分配一个固定的“时间段”发数据
🔹CDMA:Code Division Multiple Access(码分多址)
给每个节点一个独特的编码,所有节点可以同时发数据,靠编码区分出是谁发的
4.2.2 Steady State Phase(稳定阶段)
Each cluster communicates using CDMA 每个簇使用 CDMA 进行通信
- When a node becomes a cluster-head, it randomly chooses a spreading code from a
list of available codes 当一个节点成为簇头时,它会从可用扩频码列表中随机选择一个扩频码 - Cluster-heads inform all the nodes in the cluster about the chosen spreading code 簇头会将所选扩频码告知簇内所有节点
当一个节点被选为簇头(cluster-head)时,它会 从一个可用码字的列表中,随机选择一个扩频码(spreading code) 来用于该簇的通信。
🔍 拆解解释如下:
“spreading code”(扩频码) 是 CDMA(码分多址)中每个通信组用来区分信号的“身份标识”。
每个簇使用不同的码字 → 避免信号之间互相干扰。 比如:簇A用码1,簇B用码2,即便同时通信也不会冲突。
“randomly chooses”(随机选择):表示簇头节点不是人工设置或预定义选择码字,而是自动从一组可用的码字中随机选一个。
“a list of available code”(可用码字的列表):是网络中预定义的一组扩频码集合。例如可能有 {code1, code2, …, code10},每个簇头选其中一个。
🧠 举个例子:
假设有一组扩频码 {A, B, C, D}:
簇头1 选中了 A → 它的簇成员用 A 通信
簇头2 选中了 C → 它的簇成员用 C 通信
这样它们在同一区域也不会冲突