- 浏览: 896661 次
- 性别:
- 来自: 太原
文章分类
- 全部博客 (198)
- Linux/Unix (38)
- TinyOS / NS-2 for『WSN』 (44)
- 思想的拼图 (5)
- 开源 OpenSource (2)
- Framework 开发框架 (0)
- Software Engineering 软件工程 (2)
- IT项目管理 (6)
- Networking 网络技术 (2)
- Java (6)
- C语言 ANSI C (22)
- .NET / C# (9)
- C++ (12)
- Web 语言 Html/Xml (5)
- Groovy on Grails (1)
- Algorithm 算法 (1)
- Database 数据库技术 (5)
- Tools (21)
- VM 虚拟机 (3)
- WSN (wireless sensor network) (2)
- Linux 命令专辑 (3)
- PHP (0)
- 办公软件 (3)
最新评论
-
cfczdws:
感谢楼主,查了半天终于发现居然是htmlentities()做 ...
htmlentities()函数把中文转成了乱码 -
decoxiaohan:
这本书的名字 有谁知道????~~~
OMNeT++中文用户手册(完全版) -
huonie:
怎么下载啊
OMNeT++中文用户手册(完全版) -
huonie:
没有内容啊
OMNeT++中文用户手册(完全版) -
kyx0413:
谢谢先 先看看
OMNeT++中文用户手册(完全版)
SRM using NS-2
这一节给出一个关于在NS中实现SRM的概况。运行一个SRM模拟需要
- 建立并配置代理creating and configuring the agent
- 添加一个应用层的数据源application level data source (a traffic generator)
- 启动代理和流量产生器starting the agent and the traffic generator
The key steps in configuring a virgin SRM agent are to assign its multicast group and attach it to a node. Other useful configuration parameters are to assign a separate flow id to traffic originating from this agent, to open log file for statistics, and a trace file for trace data. The agent does not generate any application data on its own; instead the simulation user can connect any traffic generation module to any SRM agent to generate data. The user can attach any traffic generator to n SRM agent. The SRM agent will add the SRM headers, set the destination address to the multicast group and deliver the packet to its target. SRM header contains the type of message, identity of the sender, the sequence number of the message, the round for which this message is being sent.Each data unit in SRM is identified as < sender’s id, message sequence number >. The SRM agent does not generate its own data; it does not also keep track of the data sent except to record the sequence numbers of messages received in the event that it has to do error recovery. Since the agent has no actual record of the past data, it needs to know what packet size to use for each repair message. The agent and the traffic generator must be started separately using : $srm start and $exp0 start
At start, the agent joins the multicast group and starts generating the session messages.
Each agent tracks two sets of statistics: statistics to measure the response to data loss and overall statistics for each request/repair.
Data Loss:
The statistics to measure the response to data losses track the duplicate request (and repair), and the average request (and repair) delay. Each new request (or repair) starts a new request (or repair) period. During the request (or repair) period, the agent measures the number of first round duplicate requests (or repair) until the round terminates either due to receiving a request (or repair) or due to the agent sending one.
Overall Statistics:
In addition, each loss recovery and session object keeps a track of times and statistics. In particular, each object records its startTime. ServiceTime, distance, are relevant to the object; startTime is the time that this object was created, serviceTime is the time for this object to complete its task, and the distance is the one-way time to reach the remote peer.
For request objects, startTime is the time a packet loss is detected, serviceTime is the time to finally receive that packet and the distance is the distance to the original sender of the packet. For repair objects, startTime is the time that a request for retransmission is received, serviceTime is the time to send a repair and the distance is the distance to the original requester. For both types of objects, the serviceTime is normalized by distance. For the session object, startTime is the time that the agent joins the multicast group, serviceTime and distance are not relevant.
Each object also maintains statistics particular to that type of object. Request objects track the number of duplicate requests and repairs received, the number of requests sent, and the number of times that this object had to backoff before finally receiving the data. Repair objects track the number of duplicate requests and repairs, as well as whether or not this object for this agent sent the repair. Session objects simply record the number of session messages sent.
The values of timers and the statistics for each object are written to the log file every time an object completes the error recovery function it was tasked to do.
Tracing :
Each object writes out trace information that can be used to track the progress of the object in its error recovery. Each trace entry is of the form:
<prefix> <tag> <type of entry> <values>
The prefix is as described in the previous section for statistics. The tag is Q for requets objects, P for repair objects, and S for session objects.
Architecture and Internals:
The SRM agent implementation splits the protocol functions into packet handling, loss recovery, and session message activity.
- Packet handling consists of forwarding application data messages, sending and receipt of control messages. These activities are executed by C++ methods.
- Error detection done in C++ due to receipt of error messages. However, loss recovery is entirely done through instance procedures in Otcl.
- The sending and processing of messages is accomplished in C++; the policy about when these messages should be sent is decided by instance procedures in Otcl
Packet Handling: Processing received messages.
The recv() method can receive 4 types of messages: data, request, repair and session messages.
Data Packets
The agent does not generate any data messages. The user has to specify an external agent to generate traffic. The recv() method must distinguish between locally originated data, that must be sent to the multicast group, and the data received from the multicast group that must be processed. Therefore, the application agent must set the packet's destination address to zero.
For locally originated data, the agent adds the appropriate SRM headers, sets the destination address to the multicast group and forwards the packet to its target.
On receiving a data message from the group, the recv_data(sender, msgid) will update its state marking message <sender, msgid> received, and possibly trigger requests if it detects losses. In addition, if the message was an older message received out of order, then there must be a pending request or repair that must be cleared. In that case, the compiled object invokes the Otcl instance procedure, recv-data {sender,msgid}.
Currently, there is no provision for receivers to actually receive any application data. The agent does not also store any of the user data. It only generates repair messages of the appropriate size, defined by instance variable packetSize_. However, the agent assumes that any application data is placed in the data portion of the packet, pointed to by
packet->accessdata().
Request Packets :
On receiving a request, recv_rqst(sender, msgid) will check whether it needs to schedule requests for other missing data. If it has received this request before it was aware that the source had generated this data message(i.e the sequence no. of this message is higher than the last known sequence no. of data from this source), then the agent can infer that it is missing this, as well as data from the last known sequence no. onwards; it schedules requests for all of the missing data and returns. On the other hand, if the seuqence no. of the request is less than the last know sequence no. from the source, then the agent can be in one of the three states: a) it does not have this data, and has a requets pending for it, b) it has the data, and has seen an earlier request, upon which it has a repair pending for it, or c) it has the data, and it should instantiate a repair. All of these error recovery mechanisms are done in OTcl; recv_rqst() invokes the instance procedure recv-rqst{sender, msgid, requester} for futher processing.
Repair Packets :
On receiving a repair packet, recv_repr(sender, msgid) will check whether it needs to schedule requests for other missing data. If it has received this repair before it was aware that the source had generated this data message(i.e. the sequence no. of the repair is higher than the last known sequence no. from this source), then the agent can infer that it is missing all data between the last known sequence no. and that on the repair; it schedules requests for all of this data, marks this message as received, and returns. On the other hand, if the sequence no. of the request is lesser than the last known sequence no. from the source, then the agent can be in one of the 3 states; a) it does not have the data. and has a request pending for it, b) it has the data, and has seen an earlier request, upon which it has a repair pending for it, or c) it has the data, and probably scheduled a repair for it at some time; after recovery it holds down its timer (equal to three times its distance to some requester)expired, at which time the pending object was cleared. In this last situation, the agent will simply ignore the repair, for lack of being able to do anything meaningful. All of these error recovery mechanisms are done in OTcl; recv_repr() invokes the instance procedure recv-repr{sender, msgid} to complete the loss recovery phase for the particular message.
Session Packets :
On receiving a session message, the agent updates its sequence numbers for all the active sources, and computes its instantaneous distance to the sending agent if possible. This agent will ignore earlier session messages from a group member, if it has received a later one out of order.
Session message processing is done in recv_sess(). The format of the session message is:<count of tuples in this message, list of tuples>, where each tuple indicates the <sender id, last sequence no. from the source, time the last session message was received from this sender, time that the message was sent>. The first tuple is the information about the local agent.
It is possible to trivially obtain two flavors of SRM based on whether the agents use probabilistic or deterministic suppression. The default request and repair timer parameter for each SRM agent are
Agent/ SRM set C1_ 2.0
Agent/ SRM set C2_ 2.0
Agent/ SRM set D!_ 1.0
Agent/ SRM set D2_ 1.0
Deterministic Suppressions:
Class Agent/ SRM/ Deterministic – superclass Agent / SRM
Agent/SRM/ deterministic sets C2_ 0.0
Agent /SRM/ deterministic sets D2_ 0.0
Probabilistic Suppressions:
Class Agent/ SRM/ Probabilistic – superclass Agent / SRM
Agent/SRM/ Probabilistic sets C1_ 0.0
Agent /SRM Probabilistic sets D1_ 0.0
Loss Detection:
The SRM agent implementation splits the protocol functions into
- Packet handling,
- Loss recovery, and
- Session message activity.
Packet handling consists of forwarding application data messages, sending and receipt of control messages. These applications are executed by C++ methods.
Error detection is done in C++ due to receipt of messages. However, the loss recovery is entirely done through instance procedures in OTcl.
Sending and processing of messages is accomplished through C++; the policy about when these messages should be sent is decided by instance procedures in OTcl.
A very small encapsulating class, entirely in C++, tracks a number of assorted state information. Each member of a group, ni, uses one SRMinfo block for every other member of the group. An SRMinfo object about group member nj at ni, contains information about session messages received by ni from nj. Ni can use this information to compute its distance to nj. If nj, sends is active in sending data traffic, then the SRMinfo object will also contain information about the received data, including a bit vector indicating all packets received from nj.
The agent keeps a list of SRMinfo objects, one per group member, in its member variable, sip_. Its method get_state(int sender) will return the object corresponding to that sender, possibly creating that object, if it did not already exist. The class SRMinfo has two methods to access and set the bit vector, i.e.
IfReceived(int id) indicates whether the particular message from the appropriate sender, with id id was received at ni.
SetReceived(int id) to set the bit to indicate that the particlar message from the appropriate sender, with id id was received at ni.
The session message variables to access timing information are public; no encapsulating methods are provided. These are:
Int lsess_; /* # of last session msg. Received */ Int sendTime_; /* Time session msg. # sent */ Int recvTime_; /* Time session message # received */ Double distance_; /* Delay between nodes */ int ldata_; /* Data Messages */
Loss Recovery Objects:
Timers are used to control when any particular control message is to be sent. The SRM agent uses a separate class SRM to do the timer based processing. Class SRM is used for sending periodic session messages. An SRM agent will instantiate one object to recover from one lost data packet. Agents that detect the loss will instantiate an object in the class SRM/request; agents that receive a request and have the required data will instantiate an object in the class SRM/ repair.
SRM agents detect loss when they receive a message, and infer the loss based on the sequence number on the message received. Since packet reception is handled entirely by the compiled object, loss detection occurs in the C++ methods. Loss recovery, however, is handled by instance procedures of the corresponding object in OTcl.
Repair Mechanisms:
The agent will initiate a repair if it receives a request for a packet, and it does not have a request object pending_ for that packet. The default repair object belongs to the class SRM/repair. Barring minor differences, the sequence of events and the instance procedures in this class are identical to those for SRM/request.
-
Sample Code :
# STAR TOPOLOGY source /usr/lib/ns-allinone-2.1b4/ns-2/tcl/mcast/srm-nam.tcl ;# to separate $ source /usr/lib/ns-allinone-2.1b4/ns-2/tcl/mcast/srm-debug.tcl ;# to trace del$ Simulator set NumberInterfaces_ 1 set ns [new Simulator] Simulator set EnableMcast_ 1 $ns trace-all [open out.tr w] $ns namtrace-all [open out.nam w] set srmSimType Probabilistic $ns color 0 red ;#data source $ns color 40 blue ;#session $ns color 41 green ;#request $ns color 42 white ;#repair $ns color 4 red ;#source node # Creating The Nodes set nmax 8 for {set i 0} {$i <= $nmax} {incr i} { set n($i) [$ns node] } $n(1) color "red" # Creating The Links for {set i 1} {$i <= $nmax} {incr i} { $ns duplex-link $n($i) $n(0) 1.5Mb 10ms DropTail } # Orienting The Links $ns duplex-link-op $n(0) $n(1) orient right $ns duplex-link-op $n(0) $n(2) orient right-up $ns duplex-link-op $n(0) $n(3) orient up $ns duplex-link-op $n(0) $n(4) orient left-up $ns duplex-link-op $n(0) $n(5) orient left $ns duplex-link-op $n(0) $n(6) orient left-down $ns duplex-link-op $n(0) $n(7) orient down $ns duplex-link-op $n(0) $n(8) orient right-down set group 0x8000 set cmc [$ns mrtproto CtrMcast {}] $ns at 0.3 "$cmc switch-treetype $group" # SRM TRACE EVENTS set srmStats [open srmStats.tr w] set srmEvents [open srmEvents.tr w] set fid 0 for {set i 1} {$i <= $nmax} {incr i} { set srm($i) [new Agent/SRM/$srmSimType] $srm($i) set dst_ $group $srm($i) set fid_ [incr fid] $srm($i) log $srmStats $srm($i) trace $srmEvents $ns at 0.5 "$srm($i) start" $ns attach-agent $n($i) $srm($i) } # Attach a CBR Agent to srm(1) set packetSize 800 set s [new Application/Traffic/CBR] $s set packet_size_ $packetSize $s set interval_ 0.02 $s attach-agent $srm(1) $srm(1) set tg_ $s $srm(1) set app_fid_ 0 $srm(1) set packetSize_ $packetSize $ns at 2.0 "$srm(1) start-source" set loss_module [new SRMErrorModel] $loss_module drop-packet 2 10 1 $loss_module drop-target [$ns set nullAgent_] $ns at 0.75 "$ns lossmodel $loss_module $n(1) $n(0)" $ns at 4.0 "finish $s" proc distDump interval { global ns srm foreach i [array names srm] { set dist [$srm($i) distances?] if {$dist != ""} { puts "[format %7.4f [$ns now]] distances $dist" } } $ns at [expr [$ns now] + $interval] "distDump $interval" } proc finish src { global prog ns env srmStats srmEvents srm nmax $src stop $ns flush-trace close $srmStats close $srmEvents puts "converting output to nam format..." if [info exists env(DISPLAY)] { puts "running nam..." exec nam out.nam & } else { exec cat srmStats.tr >@stdout } exit 0 } $ns run
发表评论
-
几种用于WSN的仿真工具
2009-12-09 15:26 4241为评价无线传感器网络协议算法的性能,仅通过实验是无法实现的,特 ... -
OMNeT++中文用户手册(完全版)
2009-11-18 22:36 16647http://www.netforum.com.cn/view ... -
改变Telos 系列节点Serial baud rate
2009-08-21 18:50 2198如果节点与PC通信时出现非正常丢包或者serial不稳定当收包 ... -
TinyOS编译问题
2009-08-18 20:47 13241. 有时候编译提示找不到某个文件时, 可能是由于在linux ... -
改变节点transmission power, radio power level (tx_power)
2009-08-11 20:03 4317使用 CC2420Packet 中 setPower 来改变每 ... -
Tcl/tk 小记
2009-07-22 23:43 15331. 检查variable变量是否声明 在使用Tcl时候会经常 ... -
NS无线仿真中无法设置节点颜色的解决方案
2009-07-22 18:57 1935NS中提供了配置节点与 ... -
awk: malloc(): memory corruption 错误
2009-07-09 21:56 7250问题如下: *** glibc detected *** aw ... -
ns2 对无线网络模拟
2009-07-06 19:52 2663在模拟无线网络时需要对tcl模拟脚本文件的参数进行设置,比如P ... -
使用Gnuplot 绘制ns2模拟结果图
2009-06-25 17:48 8215Gnuplot(command-driven inter ... -
ns2模拟无线网络的NAM动画
2009-06-24 22:26 5010无线的各个参数 ####################### ... -
ns2 模拟WSN协议之手记
2009-06-23 23:55 2958ns2中模拟WSN,用Timestamp时间戳计算点对点Del ... -
ns2 中得到Agent的实例
2009-06-16 21:02 2914下面代码说明了如何访问其他节点的Agent,以AODV协议为例 ... -
TinyOS使用MIG时报错!
2009-04-06 01:30 1829在Makefile中加入启用MIG的选项后,编译出现一下错误: ... -
Tinyos 2.0 笔记小结(1)
2009-03-16 20:11 23661. configure组件注意事项 一般在confi ... -
Tinyos 2.0使用笔记
2009-03-06 19:48 27931.编译与安装程序到节点 引用 $ make mica2 ... -
Tinyos 中常用术语
2009-03-05 03:32 1095EOFF 关断能量损耗 用于 device off, stop ... -
什么是 nx_ type
2009-03-01 03:29 1515nx_ types 是在nesC 1.2,tinyos中用到的 ... -
TinyOS 下安装 JNI 的问题
2009-02-25 00:05 32271. "java not found, not i ... -
『TinyOS』学习笔记 #11?
2009-02-20 01:09 3811Lesson 11 TOSSIM Compiling ...
相关推荐
### ns2学习:从《ns by example》理解网络模拟器 #### 概览与基础知识 《ns by example》是一份详尽的指南,专为希望深入理解ns2(一种事件驱动的网络模拟器)的初学者设计。不同于繁杂的技术手册,这份资料以...
NS comes with a range of examples covering diverse network scenarios, like local area networks (LAN), multicasting, web server simulations, and Shortest Remaining Path (SRM) routing. These examples ...
SAP SRM 介绍
### VMWARE SRM快速部署手册知识点详解 #### 一、准备工作 在开始部署VMware Site Recovery Manager (SRM)之前,需要确保以下几项基础组件已经准备妥当: 1. **vCenter服务器**:作为VMware环境的核心管理平台,...
《图像分割技术:SRM算法在MATLAB中的实现》 图像分割是计算机视觉领域中的一个核心问题,它旨在将图像划分为多个具有不同特征的区域。在这个领域中,SRM(Statistical Region Merging,统计区域合并)算法因其高效...
根据给定的文件信息,我们将深入探讨“SRM-MDM Catalog Setup – Ready Reference”这一主题,专注于SAP NetWeaver MDM系统中的SRM-MDM目录设置过程。这份文档不仅适用于SAP SRM(Supplier Relationship Management...
Driver HASP SRM emulator (x86)
SRM空间富模型隐写分析算法,选区高维特征,使用集成分类器进行训练
"SRM阅读器"是一款专为处理SRM格式文件而设计的应用程序。SRM格式通常与电子书或专业文献相关,这种格式可能由特定的软件或平台创建,以提供一种组织和阅读复杂文本内容的方式。在描述中提到的"SRM格式阅读器"暗示了...
HASP SRM加密狗简介 HASP SRM加密狗是一种软件保护解决方案,由阿拉丁公司开发。它提供了多种型号,以满足不同业务需要。下面将对HASP SRM加密狗的各种型号进行详细介绍。 首先是HASP HL基本型,这是阿拉丁公司最...
多年SRM实施经验总结,对希望从事SRM实施或规划的同学们有帮助
【标题】"VSAN与SRM"涉及到的是VMware虚拟化环境中的两个关键组件:Virtual SAN(VSAN)和Site Recovery Manager(SRM)。这两个工具在企业级数据中心中发挥着至关重要的作用,确保业务连续性和灾难恢复能力。 VSAN...
SAP SRM(供应商关系管理)是一种 SAP 产品,有助于通过基于 Web 的平台采购货物。 组织可以采购所有类型的产品,如直接和间接材料,服务,这可以与 SAP ERP 模块和其他非 SAP 后端系统集成,用于会计和计划。 SAP...
分块描述SRM系统的作用:寻源、协同和考核 涉及具体的业务用途,供前期规划作参考,可根据实际情况调整,再考虑如何实现
【标题】"SRM 210 供应商关系管理"涉及的是SAP的企业级采购解决方案,SAP Supplier Relationship Management(SRM)系统的一个特定版本。SRM 210是这个模块的一个迭代,旨在帮助企业更有效地管理和优化其与供应商的...
根据给定的文件信息,我们可以提炼出以下关于SAP SRM(Supplier Relationship Management)的知识点,这主要聚焦于SAP SRM的配置、组件、版权信息以及先修课程建议。 ### SAP SRM概述 SAP SRM是SAP提供的一款用于...
【标题】:“手把手教你玩SRM” 在IT领域中,SRM(Supplier Relationship Management,供应商关系管理)是一个重要的概念,它涉及到企业如何与供应商进行有效的合作和沟通,以优化供应链流程,降低运营成本,提高...
**SRM系统资源管理器详解** SRM(System Resource Manager)系统资源管理器是一个专为Linux环境设计的工具,它的主要功能是作为一个守护进程在后台持续监控非root用户的进程,以便控制系统的CPU和内存(MEM)资源...
**SRM需求分析** 在企业运营中,供应链管理(Supply Chain Management, 简称SCM)扮演着至关重要的角色,而SRM(Supplier Relationship Management)是SCM的一个关键组成部分,专注于优化企业与供应商之间的关系。...
SRM210 (PA)SAP SRM Server Configuration (Col92) Configuration