NS2之移动节点能量模型
- 格式:docx
- 大小:49.82 KB
- 文档页数:8
无线传感器网络中的节点能耗分析方法无线传感器网络(Wireless Sensor Network,WSN)是一种由大量分布在监测区域内的无线传感器节点组成的网络系统。
这些节点通过无线通信协作工作,收集和传输环境信息。
然而,由于节点的能源有限,如何有效地分析和管理节点的能耗成为了WSN研究的重要课题之一。
本文将介绍一些常用的节点能耗分析方法。
一、能耗模型能耗模型是分析节点能耗的基础。
常用的能耗模型有能量消耗模型和电池模型。
能量消耗模型通常基于节点的功能和通信行为,用于估计节点在不同操作模式下的能耗。
电池模型则用于描述电池的能量消耗特性,包括电池的容量、电流和电压等参数。
二、能耗分析方法1. 基于仿真的方法基于仿真的方法通过构建节点能耗模型,模拟节点在不同场景下的能耗情况。
这种方法可以通过调整仿真参数来探索不同的能耗策略和算法。
常用的仿真工具有NS-2、NS-3等。
2. 基于理论分析的方法基于理论分析的方法通过数学建模和分析,推导出节点的能耗方程。
这种方法通常需要对网络的拓扑结构、通信协议和节点行为进行详细的分析。
例如,可以通过分析节点在不同状态下的能耗和传输距离的关系,来评估节点的能耗。
3. 基于实测数据的方法基于实测数据的方法通过实际部署节点并收集能耗数据,来分析节点的能耗情况。
这种方法可以更真实地反映节点在实际环境中的能耗特性。
通过收集和分析大量的实测数据,可以得到节点能耗的统计特性和规律。
三、能耗优化策略在分析节点能耗的基础上,可以采取一些优化策略来延长节点的寿命和提高网络性能。
常用的能耗优化策略有以下几种:1. 路由优化通过优化路由算法和协议,减少节点之间的通信距离和传输功耗。
例如,可以采用多跳路由、集群化等方法来减少节点的传输功耗。
2. 能量调度通过调度节点的工作模式和任务分配,合理分配节点的能量消耗。
例如,可以根据节点的能量剩余情况,动态调整节点的工作模式和任务负载,以达到能耗均衡和寿命延长的目的。
计算能量模型分析报告程序中的计算能量消耗的模型有以下几种:一、发送一个数据包消耗的能量的模型:发送一个数据包消耗的能量dEng为:发送功率P_tx 与发送时间txtime的乘积,公式为:dEng = P_tx * txtime现有能量energy_为:原节点处的能量energy_与消耗的能量dEng 之差,公式为:energy_ = energy_ - dEng总的发送数据包消耗的能量et_为:原先消耗的et_与现在消耗能量dEng之和,公式为:et_=et_+dEng二、接收一个数据包消耗的能量模型:接收一个数据包消耗的能量dEng为:接收功率P_rcv与接收时间rcvtime的乘积,公式为:dEng = P_rcv * rcvtime现有能量energy_为:原节点处的能量energy_与消耗的能量dEng 之差公式为:energy_ = energy_ - dEng总的接收数据包消耗的能量er_为:原先消耗的er_与现在消耗能量dEng之和,公式为:er_=er_+dEng三、空闲状态的能量消耗模型:空闲状态消耗的能量dEng为:空闲状态功率P_idle与空闲时间idletime的乘积公式为:dEng = P_idle * idletime现有能量energy_为:原节点处的能量energy_与消耗的能量dEng 之差公式为:energy_ = energy_ - dEng空闲状态消耗的能量ei_为:原先消耗的ei_与现在消耗能量dEng之和,公式为:ei_=ei_+dEng四、睡眠状态的能量消耗模型:睡眠状态消耗的能量dEng为:睡眠状态功率P_sleep与睡眠时间sleeptime的乘积公式为:dEng = P_sleep * sleeptime现有能量energy_为:原有的能量energy_与消耗的能量dEng 之差公式为:energy_ = energy_ - dEng睡眠状态消耗的能量es_为:原先消耗的es_与现在消耗能量dEng之和,公式为:es_=es_+dEng五、传输能量模型:传输消耗的能量dEng为:睡眠状态功率P_transition与睡眠时间transitiontime的乘积公式为:dEng = P_transition * transitiontime现有能量energy_为:原有的能量energy_与消耗的能量dEng 之差公式为:energy_ = energy_ - dEng。
一种减少移动自组织网络能量消耗的新方法苏赛语;王小平;林秦颖;王路通【摘要】Route establishment between source and destination is a difficult process in mobile ad hoc networks.Many approaches have been developed to find a route from source to destination without considering the stability of the nodes and it's link life time.It affect the network performance such as packet delivery ratio,delay,energy consumption and so on.In order to improve the performance of MANETs,both network lifetime and energy consumption associate with intermediate nodes should be jointly take into account for devising routing schemes in MANETs.This would improve the packet delivery ratio and reduce the end to end delay.In this paper,lifetime of node is measured based on the residual energy and energy consumption rate of the node.And then we use it to devise a new routing scheme called energy optimization routing based on the variable transmission power technique and to minimize the over utilization of nodes.Via NS2 simulation,comparing with AODV and LER,we demonstrate that our proposed algorithm results in improved in network lifetime,packet delivery ratio,and reduce the energy consumption,end to end delay and control the amount of the RREQ packet number.%移动自组织网络中,建立从源端到目的端路径的过程比较困难.提出了许多方法用来寻找从源端到目的端的路径,但都没有考虑节点稳定性和它的链路生存时间.这就会对网络数据传输效率、延时、能量消耗等方面的性能造成影响.为了提高移动自组织网路的性能,设计移动自组织网络路由协议时,应当把网络生存时间、能量消耗、以及中间节点同时考虑进来.这将会提高数据传输效率,减少端到端延时.根据节点的剩余能量和节点能量消耗速率,测量了节点的生存时间.根据节点的生存时间,结合可变功率传输技术,为了减少节点的过度利用,设计了一种新的能量优化路由机制.通过NS2仿真,与AODV和LER相比,证实了提出的算法提高了网络生存时间和数据传输效率.并且降低了能量消耗和端到端延时,另外也控制了RREQ包的数量.【期刊名称】《火力与指挥控制》【年(卷),期】2018(043)003【总页数】6页(P63-68)【关键词】移动自组织网络;路由协议;网络生存时间;能量消耗;NS2【作者】苏赛语;王小平;林秦颖;王路通【作者单位】空军工程大学航空航天工程学院,西安710038;空军工程大学航空航天工程学院,西安710038;西安交通大学电信学院,西安710045;空军工程大学航空航天工程学院,西安710038;西安交通大学电信学院,西安710045;空军工程大学航空航天工程学院,西安710038【正文语种】中文【中图分类】TP3930 引言移动自组织网络(Mobile Ad Hoc Networks,MANETs)是由一群移动节点,通过无线连接组成的临时网络,并不需要任何基础设施[1]。
分类:NS22011-12-10 19:54 738人阅读评论(0) 收藏举报listmobilemethodsaccessobject移动节点的邻居节点的发现函数实现如下:[cpp]view plaincopy1.//You can use the following methods to discover neighbors:2.//1. Use Hello Packets for *neighbor* discovery.3.//2. Use Communication range for neighbour discovery.4.//3. Use Nodes Positions for *neighbor* discovery.5.6.void Node::addNeighbor(Node * neighbor) {7.8.int flag=0;9.neighbor_list_node* my_neighbor_list;10.my_neighbor_list=neighbor_11.list_;12.//cout <<"MMMMM"<<my_neighbor_list->13.nodeid<<endl;14.//return;15.16.while(my_neighbor_list)17. {18.if(my_neighbor_list->nodeid == neighbor->nodeid())19. {20. flag = 1;21.break;22. }23.else24. {25. my_neighbor_list=my_neighbor_list->next;26. }27. }28.29.30.//cout<<"MMM "<<my_neighbor_list->nodeid<<endl;31.if(flag == 1)32. {33.//neighbour already exist do nothing34. }35.else36. {37. neighbor_list_node* nlistItem = (neighbor_list_node38.*)malloc(sizeof(neighbor_list_node));39. nlistItem->nodeid = neighbor->nodeid();40. nlistItem->next = neighbor_list_;41. neighbor_list_=nlistItem;42. }43.44.45.46.}47.48.49.//After that you can easily get access to any node's neighbor list by creating50.//its object and calling its neighbor list.51.52.Node* m_node = Node::get_node_by_address(this->addr());53.neighbor_list_node* my_mobile_neighbor_list;54.my_mobile_neighbor_list = m_node->neighbor_list_;55.56.while(my_mobile_neighbor_list)57. {58. cout<<"## Mubashir Neighbor ID:"<<my_mobile_neighbor_list->nodeid<<endl;59. my_mobile_neighbor_list=my_mobile_neighbor_list->next;60. }61.62.cout<<"node id : " <<put here node id<<" Mubashir Neighbor list contains ID:"<<my_mobile_neighbor_list-> nodeid<<endl;。
移动传感器网络的传感器搬迁摘要:最近有大量的研究一直在使用移动传感器网络中节点的初始部署协助。
移动传感器是在这样的环境中非常有用,因为他们可以移动到的位置,以满足覆盖要求。
本文探讨了运动能力搬迁传感器处理传感器故障或应对新的事件。
我们定义传感器搬迁的问题,并提出一个两阶段的传感器搬迁解决方案:首先确定冗余传感器,然后搬迁到目标位置。
我们提出了一个网格法定人数消息复杂度低最接近的冗余传感器解决方案,能够快速定位,并提出,使用级联运动搬迁冗余传感器在及时,高效和平衡的方式。
仿真结果验证了所提出的方案优于其他方面的搬迁时间,总的能源消耗,最小剩余能量。
引言由于许多吸引人的特点,如体积小,成本低,传感器网络的传感器节点[10],[13],[15],[17],[1]已经成为了许多军事和民用领域,包括军事侦察,智能家居[18],远程环境监控,和厂内的机械手控制和指导。
为了正确地感知现象,必须适当地部署传感器节点发出的遥感任务的圆满完成以达到足够的覆盖水平[5],[14]。
在许多潜在的工作环境,如远程苛刻的领域或灾区传感器部署,不能进行手动或精确。
此外,一旦部署中,传感器节点可能会失败,需要被移动的节点创建的故障的传感器克服了覆盖孔。
在这些情况下,有必要使用移动传感器[20],[21],它可以移动,以提供所需的覆盖范围。
的一个例子移动传感器Robomote的的[16]。
这些传感器是小于0.000047立方米的成本低于150美元。
在本文中,我们解决传感器搬迁的问题,即,将先前部署的传感器克服了其他节点故障,或发生的事件,需要移动其位置传感器响应。
该传感器搬迁是不同于现有的工作集中部署传感器的移动传感器,运动传感器提供一定的初始覆盖[11],[12],[20],[21],[24]。
搬迁传感器与传感器部署相比,有许多特殊的困难。
首先,传感器搬迁可能有严格的响应时间要求。
例如,如果传感器监测安全敏感区域去世,另一个传感器应该尽快移动到更换。
分类:NS22011-12-10 19:59 1024人阅读评论(0) 收藏举报tclrandomdelaylistfloatclass移动节点能量函数分析代码:[cpp]view plaincopy1.#include <stdarg.h>2.#include <float.h>3.4.#include "random.h"5.#include "energy-model.h"6.#include "mobilenode.h"7.#include "god.h"8.9.static class EnergyModelClass : public TclClass10.{11.public:12. EnergyModelClass ():TclClass ("EnergyModel") {}13. TclObject *create (int argc, const char *const *argv) {14.if (argc == 8) {15. MobileNode *n=(MobileNode*)TclObject::lookup(argv[4]);16.return (new EnergyModel(n, atof(argv[5]),17. atof(argv[6]), atof(argv[7])));18. } else {19. Tcl::instance().add_error("Wrong arguments to ErrorModel");20.return 0;21. }22. }23.} class_energy_model;24.25.void EnergyModel::DecrTxEnergy(double txtime, double P_tx)26.{27.double dEng = P_tx * txtime;28.if (energy_ <= dEng)29. energy_ = 0.0;30.else31. energy_ = energy_ - dEng;32.if (energy_ <= 0.0)33. God::instance()->ComputeRoute();34.}35.36.37.void EnergyModel::DecrRcvEnergy(double rcvtime, double P_rcv)38.{39.double dEng = P_rcv * rcvtime;40.if (energy_ <= dEng)41. energy_ = 0.0;42.else43. energy_ = energy_ - dEng;44.if (energy_ <= 0.0)45. God::instance()->ComputeRoute();46.}47.48.void EnergyModel::DecrIdleEnergy(double idletime, double P_idle)49.{50.double dEng = P_idle * idletime;51.if (energy_ <= dEng)52. energy_ = 0.0;53.else54. energy_ = energy_ - dEng;55.if (energy_ <= 0.0)56. God::instance()->ComputeRoute();57.}58.59.// XXX Moved from . These wireless stuff should NOT stay in the60.// base node.61.void EnergyModel::start_powersaving()62.{63. snh_ = new SoftNeighborHandler(this);64. snh_->start();65.66. afe_ = new AdaptiveFidelityEntity(this);67. afe_->start();68.69. state_ = EnergyModel::POWERSAVING;70. state_start_time_ = Scheduler::instance().clock();71.}72.73.void EnergyModel::set_node_sleep(int status)74.{75. Tcl& tcl=Tcl::instance();76.//static float last_time_gosleep;77.// status = 1 to set node into sleep mode78.// status = 0 to put node back to idle mode.79.// time in the sleep mode should be used as credit to idle80.// time energy consumption81.if (status) {82. last_time_gosleep = Scheduler::instance().clock();83.//printf("id=%d : put node into sleep at %f\n",84.// address_,last_time_gosleep);85. sleep_mode_ = status;86.if (node_->exist_namchan())87. tcl.evalf("%s add-mark m1 blue hexagon",node_->name());88. } else {89. sleep_mode_ = status;90.if (node_->exist_namchan())91. tcl.evalf("%s delete-mark m1", node_->name());92.//printf("id= %d last_time_sleep = %f\n",93.// address_, last_time_gosleep);94.if (last_time_gosleep) {95. total_sleeptime_ += Scheduler::instance().clock() -96. last_time_gosleep;97. last_time_gosleep = 0;98. }99. }100.}101.102.void EnergyModel::set_node_state(int state)103.{104.switch (state_) {105.case POWERSAVING:106.case WAITING:107. state_ = state;108. state_start_time_ = Scheduler::instance().clock();109.break;110.case INROUTE:111.if (state == POWERSAVING) {112. state_ = state;113. } else if (state == INROUTE) {114.// a data packet is forwarded, needs to reset 115.// state_start_time_116. state_start_time_= Scheduler::instance().clock(); 117. }118.break;119.default:120. printf("Wrong state, quit...\n");121. abort();122. }123.}124.125.void EnergyModel::add_neighbor(u_int32_t nodeid)126.{127. neighbor_list_item *np;128. np = neighbor_list.head;129.for (; np; np = np->next) {130.if (np->id == nodeid) {131. np->ttl = maxttl_;132.break;133. }134. }135.if (!np) { // insert this new entry136. np = new neighbor_list_item;137. np->id = nodeid;138. np->ttl = maxttl_;139. np->next = neighbor_list.head;140. neighbor_list.head = np;141. neighbor_list.neighbor_cnt_++;142. }143.}144.145.void EnergyModel::scan_neighbor()146.{147. neighbor_list_item *np, *lp;148.if (neighbor_list.neighbor_cnt_ > 0) {149. lp = neighbor_list.head;150. np = lp->next;151.for (; np; np = np->next) {152. np->ttl--;153.if (np->ttl <= 0){154. lp->next = np->next;155.delete np;156. np = lp;157. neighbor_list.neighbor_cnt_--; 158. }159. lp = np;160. }161.// process the first element162. np = neighbor_list.head;163. np->ttl--;164.if (np->ttl <= 0) {165. neighbor_list.head = np->next; 166.delete np;167. neighbor_list.neighbor_cnt_--; 168. }169. }170.}171.172.173.void SoftNeighborHandler::start()174.{175. Scheduler::instance().schedule(this, &intr, CHECKFREQ); 176.}177.178.void SoftNeighborHandler::handle(Event *)179.{180. Scheduler &s = Scheduler::instance();181. nid_->scan_neighbor();182. s.schedule(this, &intr, CHECKFREQ);183.}184.185.void AdaptiveFidelityEntity::start()186.{187. sleep_time_ = 2;188. sleep_seed_ = 2;189. idle_time_ = 10;190. nid_->set_node_sleep(0);191. Scheduler::instance().schedule(this, &intr,192. Random::uniform(0, idle_time_)); 193.}194.195.void AdaptiveFidelityEntity::handle(Event *)196.{197. Scheduler &s = Scheduler::instance();198.int node_state = nid_->state();199.switch (node_state) {200.case EnergyModel::POWERSAVING:201.if (nid_->sleep()) {202.// node is in sleep mode, wake it up203. nid_->set_node_sleep(0);204. adapt_it();205. s.schedule(this, &intr, idle_time_);206. } else {207.// node is in idle mode, put it into sleep208. nid_->set_node_sleep(1);209. adapt_it();210. s.schedule(this, &intr, sleep_time_);211. }212.break;213.case EnergyModel::INROUTE:214.// 100s is the maximum INROUTE time.215.if (s.clock()-(nid_->state_start_time()) <216. nid_->max_inroute_time()) {217. s.schedule(this, &intr, idle_time_);218. } else {219. nid_->set_node_state(EnergyModel::POWERSAVING);220. adapt_it();221. nid_->set_node_sleep(1);222. s.schedule(this, &intr, sleep_time_);223. }224.break;225.case EnergyModel::WAITING:226.// 10s is the maximum WAITING time227.if (s.clock()-(nid_->state_start_time()) < MAX_WAITING_TIME) { 228. s.schedule(this, &intr, idle_time_);229. } else {230. nid_->set_node_state(EnergyModel::POWERSAVING);231. adapt_it();232. nid_->set_node_sleep(1);233. s.schedule(this, &intr, sleep_time_);234. }235.break;236.default:237. fprintf(stderr, "Illegal Node State!");238. abort();239. }240.}241.242.void AdaptiveFidelityEntity::adapt_it()243.{244.float delay;245.// use adaptive fidelity246.if (nid_->adaptivefidelity()) {247.int neighbors = nid_->getneighbors();248.if (!neighbors)249. neighbors = 1;250. delay = sleep_seed_ * Random::uniform(1,neighbors); 251. set_sleeptime(delay);252. }253.}。