NCTUNS 網路模擬器操作與 模擬程式開發 柯志亨 國立金門大學資訊工程學系 副教授

Slides:



Advertisements
Similar presentations
DIR-636L Support 10/100/1000Mbps 1WAN and 4LAN N 300Mbps Wireless Easy wizard setup Support mydlink cloud service mydlink apps (iOS/android) Support.
Advertisements

1 生物計算期末作業 暨南大學資訊工程系 2003/05/13. 2 compare f1 f2  只比較兩個檔案 f1 與 f2 ,比完後將結果輸出。 compare directory  以兩兩比對的方式,比對一個目錄下所有檔案的相 似程度。  將相似度很高的檔案做成報表輸出,報表中至少要.
Divide-and-Conquer. 什麼是 divide-and-conquer ? Divide 就是把問題分割 Conquer 則是把答案結合起來.
布林代數的應用--- 全及項(最小項)和全或項(最大項)展開式
第七章 抽樣與抽樣分配 蒐集統計資料最常見的方式是抽查。這 牽涉到兩個問題: 抽出的樣本是否具有代表性?是否能反應出母體的特徵?
Event Sampling 事件取樣法. 關心重點為「事件」本身明確的焦點 行為 清楚掌握主題 - 當「事件」出現時才開 始記錄 記錄程序 等待目標事件的發生 開始記錄 事件結束,停止記錄.
3Com Switch 4500 切VLAN教學.
指導教授:陳淑媛 學生:李宗叡 李卿輔.  利用下列三種方法 (Edge Detection 、 Local Binary Pattern 、 Structured Local Edge Pattern) 來判斷是否為場景變換,以方便使用者來 找出所要的片段。
SIP Mobiity TA: 洪敏書
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 參 實驗法.
亂數產生器安全性評估 之統計測試 SEC HW7 姓名:翁玉芬 學號:
©Ming-chi Chen 社會統計 Page.1 社會統計 第十講 相關與共變. ©Ming-chi Chen 社會統計 Page.2 Covariance, 共變量 當 X, Y 兩隨機變數不互為獨立時,表示 兩者間有關連。其關連的形式有很多種, 最常見的關連為線性的共變關係。 隨機變數 X,Y.
Review of Chapter 3 - 已學過的 rules( 回顧 )- 朝陽科技大學 資訊管理系 李麗華 教授.
STAT0_sampling Random Sampling  母體: Finite population & Infinity population  由一大小為 N 的有限母體中抽出一樣本數為 n 的樣 本,若每一樣本被抽出的機率是一樣的,這樣本稱 為隨機樣本 (random sample)
1. 假設以下的敘述為一未提供 “ 捷徑計算 ” 能力的程式段,試用程 式設計的技巧,使此敘述經此改 寫的動作後,具有與 “ 捷徑計算 ” 之 處理方法相同之處理模式。 if and then E1 else E2 endif.
Section 2.2 Correlation 相關係數. 散佈圖 1 散佈圖 2 散佈圖的盲點 兩座標軸的刻度不同,散佈圖的外觀呈 現的相聯性強度,會有不同的感受。 散佈圖 2 相聯性看起來比散佈圖 1 來得強。 以統計數字相關係數做為客觀標準。
各種線上電子資源的特異功能 STICnet 的 SDI 專題訂閱服務 2003/4/28 修改. 無論校內外皆可使用。連線至
8.1 何謂高度平衡二元搜尋樹 8.2 高度平衡二元搜尋樹的加入 8.3 高度平衡二元搜尋樹的刪除
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
Monte Carlo Simulation Part.2 Metropolis Algorithm Dept. Phys. Tunghai Univ. Numerical Methods C. T. Shih.
Chapter 13 塑模靜態觀點:物件圖 Static View : Object Diagram.
Introduction to Java Programming Lecture 17 Abstract Classes & Interfaces.
最新計算機概論 第 5 章 系統程式. 5-1 系統程式的類型 作業系統 (OS) : 介於電腦硬體與 應用軟體之間的 程式,除了提供 執行應用軟體的 環境,還負責分 配系統資源。
3-3 使用幾何繪圖工具 Flash 的幾何繪圖工具包括線段工具 (Line Tool) 、橢圓形工具 (Oval Tool) 、多邊星形 工具 (Rectangle Tool) 3 種。這些工具畫出 來的幾何圖形包括了筆畫線條和填色區域, 將它們適當地組合加上有技巧地變形與配 色, 不但比鉛筆工具簡單,
Matlab Assignment Due Assignment 兩個 matlab 程式 : Eigenface : Eigenvector 和 eigenvalue 的應用. Fractal : Affine transform( rotation, translation,
第二章 供給與需求 中興大學會計學系 授課老師:簡立賢.
選舉制度、政府結構與政 黨體系 Cox (1997) Electoral institutions, cleavage strucuters, and the number of parties.
各種線上電子資源的特異功能 SpringerLINK 的 Alert, Serials Update, News 2003/4/28 修改.
實驗六 WLAN 的設定 WLAN card 的設定. Reference Wireless Local Area Network by Dr.Morris Chang.
:Nuts for nuts..Nuts for nuts.. ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 10944:Nuts for nuts.. 解題者:楊家豪 解題日期: 2006 年 2 月 題意: 給定兩個正整數 x,y.
資料結構實習-一 參數傳遞.
手機模擬機車事故黑盒子 指導教授 : 姚修慎 教授 李易璋 鍾明哲 黃靖宇.
6-2 認識元件庫與內建元件庫 Flash 的元件庫分兩種, 一種是每個動畫專 屬的元件庫 (Library) ;另一種則是內建元 件庫 (Common Libraries), 兩者皆可透過 『視窗』功能表來開啟, 以下即為您說明。
第 9 章 TSR 程式基本教練. 本章提要 TSR 程式 以熱鍵 (Hot key) 叫用 TSR 程式 Clock 中斷 int 08h 、 int 1ch DOS reentrant 的問題 有用的 TSR 程式.
Section 4.2 Probability Models 機率模式. 由實驗看機率 實驗前先列出所有可能的實驗結果。 – 擲銅板:正面或反面。 – 擲骰子: 1~6 點。 – 擲骰子兩顆: (1,1),(1,2),(1,3),… 等 36 種。 決定每一個可能的實驗結果發生機率。 – 實驗後所有的實驗結果整理得到。
Teacher : Ing-Jer Huang TA : Chien-Hung Chen 2015/6/25 Course Embedded Systems : Principles and Implementations Weekly Preview Question CH 2.4~CH 2.6 &
函式 Function Part.2 東海大學物理系‧資訊教育 施奇廷. 遞迴( Recursion ) 函式可以「呼叫自己」,這種動作稱為 「遞迴」 此程式的執行結果相當於陷入無窮迴圈, 無法停止(只能按 Ctrl-C ) 這給我們一個暗示:函式的遞迴呼叫可以 達到部分迴圈的效果.
JAVA 程式設計與資料結構 第二十章 Searching. Sequential Searching Sequential Searching 是最簡單的一種搜尋法,此演 算法可應用在 Array 或是 Linked List 此等資料結構。 Sequential Searching 的 worst-case.
演算法 8-1 最大數及最小數找法 8-2 排序 8-3 二元搜尋法.
Chapter 3 Entropy : An Additional Balance Equation
資訊理論 授課老師 : 陳建源 研究室 : 法 401 網站
845: Gas Station Numbers ★★★ 題組: Problem Set Archive with Online Judge 題號: 845: Gas Station Numbers. 解題者:張維珊 解題日期: 2006 年 2 月 題意: 將輸入的數字,經過重新排列組合或旋轉數字,得到比原先的數字大,
寬頻通訊系統基礎教育計畫 分項計畫二 寬頻網路通訊 主要參與人員 黎碧煌 教 授 鍾順平 副教授
Learning Method in Multilingual Speech Recognition Author : Hui Lin, Li Deng, Jasha Droppo Professor: 陳嘉平 Reporter: 許峰閤.
Chapter 10 m-way 搜尋樹與B-Tree
The Advantages Of Elliptic Curve Cryptography For Wireless Security Computer and Information Security 資工四 謝易霖.
網路介紹及其運用 講師陳炯勳. 5-2 IP 協定 ( 一 ) IP 協定運作 (1) – 網路成員:主機 (Host) 與路由器 (Router) – 路由表 – 電報傳輸運作.
Quality Enhancement for VoIP by Partial-Reliable UDP Ren-Yuh Lu.
概念性產品企劃書 呂學儒 李政翰.
無線通訊網路 Mac 層 TDM 通訊模式的操作與效能研究 專題生 : 林書弘、蔡逸祥、毛建翔、王政 華 指導教授 : 黃依賢.
無線網路防干擾機制 彭祺恩 蔣軼倫. 前言 一個區域內存在有多台 AP(Access Point) ,在 許多研究中發現,多台 AP 彼此在一定的範圍 內,對於鄰頻 (Next Channel) 或同頻 (co- Channel) 的 AP 會互相干擾,尤其鄰頻的干擾 程度會遠大於同頻。
QoS Assurance for VoIP over P2Pnet Ren-Yuh Lu. Outline Introduction –MobileLAN –P2Pnet –Motivation –Problem Description Our Approach –Partial-Reliable.
: Problem E Antimatter Ray Clearcutting ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11008: Problem E Antimatter Ray Clearcutting 解題者:林王智瑞.
連續隨機變數 連續變數:時間、分數、重量、……
Teacher : Ing-Jer Huang TA : Chien-Hung Chen 2015/6/30 Course Embedded Systems : Principles and Implementations Weekly Preview Question CH7.1~CH /12/26.
指導教授 : 林啟芳 教授 組員 : 邱秉良 林育賢. 何謂 GPS  GPS 即全球定位系統,是一個中距離圓 型軌道衛星導航系統。它可以為地球表面 絕大部分地區( 98% )提供準確的定位、 測速和高精度的時間標準。
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 參 資料蒐集的方法.
: Finding Paths in Grid ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11486: Finding Paths in Grid 解題者:李重儀 解題日期: 2008 年 10 月 14 日 題意:給一個 7 個 column.
著作權所有 © 旗標出版股份有限公司 第 14 章 製作信封、標籤. 本章提要 製作單一信封 製作單一郵寄標籤.
幼兒行為觀察與記錄 第八章 事件取樣法.
CH 14-可靠度工程之數學基礎 探討重點 失效時間之機率分配 指數模式之可靠度工程.
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
Simulation and Emulation with NCTUns
MPLS ( Multi-Protocol Label Switching ) 屬於第三代網路架構,是新一代的 IP 高速骨幹 網路交換標準,由 IETF ( Internet Engineering Task Force ,網際網路工程專案小 組 ) 所提出,由 Cisco 、 3Com 等網路設備大.
Date : 2010/11/23 Speaker : Chia-Wen Lu 1.  Network Simulation  Introduction to NS2  Simple Simulation Example 2.
RPL: IPv6 Routing Protocol for Low power and Lossy Networks
NCTUns Emulation 指導教授:潘仁義 報告者:李詩涵、蕭惠陽. Kernel Re-entering Simulation Methodology  Tunnel 網路介面是實現 Kernel Re-entering Simulation Methodology 的關鍵技術  Tunnel.
Lab 1 Introduction MMLAB. Environment Install Linux OS in a computer( VirtualBox or Vmware or Native) It’s all up to you for selecting Ubuntu Server or.
Presentation transcript:

NCTUNS 網路模擬器操作與 模擬程式開發 柯志亨 國立金門大學資訊工程學系 副教授

大綱 1. NCTUNS 簡介與 GUI 操作 2. LAN & WLAN 3. Emulation 4. How to insert a new module into NCTUNS? How to Get/Set a variable at the run-time? How to write a simple MAC for wireless network? How to write a flooding module for wireless simulations?

1. NCTUNS 簡介與 GUI 操作 Simulates and emulates network protocols Open source Modified Linux kernel GUI and shell commands Client-server model to allow communication between simulation/emulation engine and interface Uses native Linux TCP/IP stack Interacts with real devices in virtual networks Allows experiments with real applications There is no need to change the real applications Allows remote simulations and concurrent simulations Easy to create simulation servers Can take advantage of multiple cores/processors

4 Features (1) ‏ Support to several protocols is already included : IEEE 802.3, IEEE , IEEE , Learning bridge protocol, Spanning tree protocol,... IP, Mobile IP, RIP, OSPF, OBS, GPRS,... TCP, UDP, SDP,... HTTP, FTP, telnet,... (+ any real application)‏ Some specific applications included: stcp/rtcp - Greedy TCP traffic ttcp - Greedy TCP/UDP trafic stg/rtg - Greedy TCP/UDP traffic, trace driven, self-similar traffic, on-off, constant-bit-rate, and various packet streams.

5 Features (2) ‏ Support to several links and devices is already included PPP link, ethernet link,... Host, hub, switch, router,... QoS Diffserv boundary/interior routers Optical burst/circuit switch External host, external router (emulation) ‏

6 Features (3) ‏ Creates virtual interfaces to simulate the devices of the scenario Inspiration from loopback interface Utilizes IP address During the simulation it is possible to “see” the interfaces with the commands /sbin/ifconfig or /sbin/route Interfaces named tun0, tun1, tun2,...

7 Features (4) ‏ Kernel re-entering methodology

10 Utilization (1) ‏ Basic components (binaries) ‏ nctunsclient – GUI interface between user and system nctuns – shell interface between user and system nctunsse – NCTUns core dispatcher – Manage the simulation requests. Can control multiple coordinators running in different machines coordinator – Receives the simulation from the dispatcher and forward it to the nctunsse

11 Utilization (2) ‏  Each simulation server = kernel modifications + nctunsse + protocol modules + coordinator

13 Utilization (3) ‏ Folders organization tools = executable programs of various applications and tools pre-installed (/usr/local/nctuns/tools) bin = executable programs of the GUI program, dispatcher, coordinator, and the simulation engine (/usr/local/nctuns/bin) etc = configuration files needed by the dispatcher and coordinator programs (/usr/local/nctuns/etc) BMP = icon bmp files uses by the GUI program (/usr/local/nctuns/BMP) lib = libraries used by the simulation engine

14 Utilization (4 )‏ Execution order dispatcher  Waits client connection via TCP port 9800  Waits coordinator connection via TCP port 9810 coordinator  Connects to dispatcher nctunsclient or nctuns  Connects to dispatcher to send the scenario and waits the end of the simulation. The nctunsse is started by the coordinator

15 Utilization (5) ‏ How to use the GUI?

NCTUns - Professor Nelson Fonseca16 Utilization (6 )‏ Draw topology

17 Utilization (7) ‏

18 Utilization (8 )‏ Edit property

19 Utilization (9) ‏

20 Utilization (10) ‏ Run simulation

21 Utilization (11) ‏

22 Utilization (12) ‏

23 Utilization (13) ‏ Playback

24 Utilization (14) ‏

25 Utilization (15) ‏

26 Utilization (16) ‏

NCTUns - Professor Nelson Fonseca27 Utilization (17) ‏ Main simulation files.emu: external routing table (needed to emulation) ‏.ndt: nodes identification.tfc: list of commands to be executed.srt-l: internal routing table (tun[0-9]* devices) ‏.tcl: scenario details One example of each file is available at See p54~p70 in DeveloperManual.pdf

28 Utilization (18) ‏ To run without the GUI Create the basic scenario from the GUI (It is easier) ‏ Make the necessary changes in the files Run nctuns  is generated by the GUI Wait for the results

29 Examples (1) ‏ Scenario 1 Network topology: 2 hosts connected by an ethernet link Protocols: TCP and UDP Applications: rtcp/stcp Devices:

30 Examples (2) ‏ Scenario 1 – Applications configuration To simulate data transfer between host 1 ( ) and hosts 2 ( ) via TCP using stcp and rtcp Host 1: stcp -p  Sending TCP segments to at port 8000 Host 2: rtcp -p 8000  Receiving TCP segments from port 8000

31 Examples (3) ‏

Scenario 2 To simulate data transfer between host 1 ( ) and host 2 ( ) via UDP using stg and rtg Host 1: stg -u m p  Sending UDP datagrams to at port Transmission rate limited to 50Mbps and packet size equal to 1000 bytes. Host 2: rtg -u -p 8000  Receiving UDP datagrams from port Examples (4) ‏

2. LAN & WLAN Basic performance evaluation Routing (Static routing vs. Dynamic routing) Performance Anomaly Problem Performance evaluation of ad hoc routing protocols Performance evaluation of IEEE b wireless networks

Basic performance evaluation Tools – Wireshark ( 封包觀測 ) yum install wireshark* – Gnuplot ( 繪圖 ) yum install gnuplot Throughput Measurement (Application and MAC Level)

tcpdump –i eth1 –U –w mylog wireshark mylog udp_sudp_c 封包觀測 hub Example: hub

client  server

server->client

3~30s: ttcp –t –s –p ~30s: ttcp –t –s –p ~30s: ttcp –r –s –p 4321 –w thr_n3n4 0~30s: ttcp –r –s – p 1234 –w thr_n2n5 switch Application level MAC level Example: switch

At Node 4 Throughput: Application level vs. MAC level

Dynamic routing vs. Static Routing Bandwidth=10Mbps Link down = 5 ~ 25 sec (from R3 to R4) Run time:1~100 seconds rtcp stcp Example: routing_wired

How to manually set the routing tables in wired simulation ? rtcp stcp Example: routing_wired_static

rtcp stcp *.srt-l

How to manually set the routes in the wireless simulations? $node_(NID) + entry-changing time + "set-next-hop" + SrcNode + DstNode + NextHop + "chan" + channel

在 IEEE 的標準裡 a/b/g 分別利用不同的編碼 方式可支援多種不同的傳輸速度, b 提供了 四種傳輸速度, (1M/2M/5.5M/11M) , a 則提 供多達八種傳輸速度。 較低的傳輸速度對於訊號的抗干擾性較強,反之較 高的傳輸速度則較弱。當訊號不良的時候選擇低速 的傳輸速度,當訊號收訊良好時則選擇高速的傳輸。 所以在一個無線區域網路中,可能同時存在具有不 同傳輸速率的行動節點,我們通常稱這樣這網路為 多速率網路環境 (multi-rate wireless network) 。 無線網路異常問題 (Performance Anomaly Problem) 1

假設所有無線網路所有傳輸的封包大小都是相同 的,在此假設下,當低速節點得到通道存取機會 時,需要較久的時間才能把封包傳送完畢;另外, 若是高速節點和低速節點發生傳輸碰撞,則高速 節點還是需要等待低速節點把整個封包傳送過程 完成後,才能重新競爭通到存取機會。以上兩個 情況是主要造成整個無線網路效能變差的原因。 無線網路異常問題 (Performance Anomaly Problem) 2

Performance Anomaly Problem 11M 在 group wireless nodes 時, 第一個一定要先選 AP stg -u ~30sec stg -u ~20sec Example: anomaly

11M 1M stg -u ~30sec stg -u ~20sec Change link bandwidth from 11 to 1

Increase the cwmin value of the 1Mbps node to lower the contending probability a.Press the R b.Edit the *.tcl file to increase the cwmin value c.Run

Limit the packet length of the 1Mpbs node

Performance evaluation of ad hoc routing protocols Compare DSDV, AODV, DSR routing protocols under static or dynamic situations The nodes are all fixed. Example : wrouting

比較 DSDV, AODV, DSR Random Number 要設定相同的數值, 但不能為 0

The nodes are randomly moving. Example : wrouting2

Performance evaluation of IEEE b wireless networks packet size vs. throughput – with/without wireless transmission error Example: wperformance

without wireless transmission error

Kbytes/sec Application data:500 bytes

Application data:1000 bytes Kbytes/sec

Application data:2000 bytes Kbytes/sec ??? Why ???

Packets are fragmented into small packets and need to contend more times for transmission.

Application data:2000 bytes Kbytes/sec Packet size Overhead Throughput

With transmission error Set the bit error rate to Kbytes/sec Application data:500 bytes

Application data:1000 bytes Kbytes/sec With transmission error, Packet size throughput How to design a mechanism that can adjust the packet size under different wireless transmission error rates is important !!!

4. Emulation Example: emu

Simulated Host External Host

How to insert a new module into NCTUNS? [Background] 1. This is a simplified version of First In First Out (Drop Tail) Queue. The codes were mainly re-written from original FIFO.cc/FIFO.h. 2. Please refer to DeveloperManual.pdf which is under /root/ NCTUns- 6.0/doc/Developer.Manual folder. Take a closer look at the chapter 2 and chapter 5. [Preparation] 1. Change the path to /root/NCTUns-6.0/src/nctuns/module/ps 2. Create a new folder named sFIFO. 3. Prepare 3 files under sFIFO.

PACKET RECEPTION PACKET TRANSMISSION

THE RELATIONSHIP BETWEEN PUT(), GET() AND SEND().

THE RELATIONSHIP BETWEEN PUT(), GET() AND RECV().

#ifndef __NCTUNS_sfifo_h__ #define __NCTUNS_sfifo_h__ #include /* Define Interface Queue for every Interface */ struct ifqueue { ePacket_ *ifq_head; /* head of ifq */ ePacket_ *ifq_tail; /* tail of ifq */ int ifq_len; /* current queue length */ int ifq_maxlen;/* max queue length */ int ifq_drops; /* drops count */ }; /* Define Macros for IFq */ #define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) #define IF_DROP(ifq) ((ifq)->ifq_drops++) #define IF_ENQUEUE(ifq, m) { \ if ((ifq)->ifq_tail == 0) \ (ifq)->ifq_head = m; \ else \ (ifq)->ifq_tail->next_ep = m; \ (ifq)->ifq_tail = m; \ (ifq)->ifq_len++; \ } sfifo.h #define IF_PREPEND(ifq, m) { \ (m)->next_ep = (ifq)->ifq_head; \ if ((ifq)->ifq_tail == 0) \ (ifq)->ifq_tail = (m); \ (ifq)->ifq_head = (m); \ (ifq)->ifq_len++; \ } #define IF_DEQUEUE(ifq, m) { \ (m) = (ifq)->ifq_head; \ if (m) { \ if (((ifq)->ifq_head = (m)->next_ep) == 0) \ (ifq)->ifq_tail = 0; \ (m)->next_ep = 0; \ (ifq)->ifq_len--; \ } \ }

class sfifo : public NslObject { private: struct ifqueue if_snd; /* output interface queue */ protected: int intrq(MBinder *); public: sfifo(u_int32_t type, u_int32_t id, struct plist* pl, const char *name); ~sfifo(); int init(); int recv(ePacket_ *); int send(ePacket_ *); }; #endif /* __NCTUNS_sfifo_h__ */

#include MODULE_GENERATOR(sfifo); sfifo::sfifo(u_int32_t type, u_int32_t id, struct plist* pl, const char *name) : NslObject(type, id, pl, name) { /* disable flow control */ s_flowctl = DISABLED; r_flowctl = DISABLED; /* initialize interface queue */ if_snd.ifq_head = if_snd.ifq_tail = 0; if_snd.ifq_len = 0; if_snd.ifq_drops = 0; /* bind variable */ vBind("max_qlen", &if_snd.ifq_maxlen); if_snd.ifq_maxlen = 50; /* by default */ } sfifo.cc sfifo::~sfifo() { } int sfifo::init() { int (NslObject::*upcall)(MBinder *); /* set upcall */ upcall = (int (NslObject::*)(MBinder *))&sfifo::intrq; sendtarget_->set_upcall(this, upcall); return(1); }

int sfifo::send(ePacket_ *pkt) { assert(pkt&&pkt->DataInfo_); /* * If Module-Binder Queue(MBQ) is full, we should * insert the outgoing packet into the interface * queue. If MBQ is not full, we can call the * put() or NslObject::send() method to pass the * outgoing packet to next module. */ if( sendtarget_->qfull() ) { /* MBQ is full, insert to ifq */ if (IF_QFULL(&if_snd)) { /* ifq full, drop it! */ IF_DROP(&if_snd); freePacket(pkt); return(1); } /* otherwise, ifq not full, insert it */ IF_ENQUEUE(&if_snd, pkt); return(1); } else { /* * MBQ is not full, pass outgoing packet * to next module. */ return(NslObject::send(pkt)); }

int sfifo::recv(ePacket_ *pkt) { /* Just by pass incoming packet */ assert(pkt&&pkt->DataInfo_); return(NslObject::recv(pkt)); } int sfifo::intrq(MBinder *port) { ePacket_ *pkt; /* * Push the packet in the interface queue * to the MBQ. Whenever the pakcet in the * MBQ is sent, the scheduler will call this * member function to give sfifo module a * chance to send the next packet in the * interface queue. */ IF_DEQUEUE(&if_snd, pkt); if (pkt != NULL) { /* * If still exist packet in the interface * queue, we try to push it to the MBQ, */ assert(sendtarget_->enqueue(pkt) == 0); } return(1); } # # Makefile for the NCTUns engine module # obj-y = sfifo.o Makefile

Change path to /root/NCTUns-6.0/src/nctuns and edit the nctuns.cc Recompile the nctuns

方法一

(change FIFO to sFIFO and remove some redundant functions)

方法二

記得要關閉 nctunsclient, 再重新開啟才會生效

How to Get/Set a variable at the run- time? [Background] Refer to the section in the DeveloperManual.pdf for advanced information. But in that document, it teaches you to use “EXPORT” function to register the variables that you are interested in. And then modify the module description file in order to get/set a variable at the run-time. Take the following scenario as an example. Node 2 is using stg program to send packets to Node 3. If we are interested in the current queue length in the Node 2, we have to do the following procedures: “Simulation/Run”->Node 2-> Node editor->FIFO->GET (Current Queue Length) in the Run Time Query group. It takes time and many procedures to achieve what we want. Therefore, I will introduce another method. With this method, you can get/set the information at the time exactly at any time you want during simulation.

How to write a flooding module for wireless simulations?

How to write a simple MAC for wireless network? MYMAC_SIMPLE