Nghiên cứu nâng cao hiệu năng giao thức định tuyến cho mạng Manet212

140 6 0
Nghiên cứu nâng cao hiệu năng giao thức định tuyến cho mạng Manet212

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘI Cung Trọng Cường NGHIÊN CỨU NÂNG CAO HIỆU NĂNG GIAO THỨC ĐỊNH TUYẾN CHO MẠNG MANET LUẬN ÁN TIẾN SĨ HỆ THỐNG THÔNG TIN Hà Nội - 2015 BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘI Cung Trọng Cường NGHIÊN CỨU NÂNG CAO HIỆU NĂNG GIAO THỨC ĐỊNH TUYẾN CHO MẠNG MANET Chuyên ngành: Hệ thống thông tin Mã số: 62480104 LUẬN ÁN TIẾN SĨ HỆ THỐNG THÔNG TIN NGƯỜI HƯỚNG DẪN KHOA HỌC: GS.TS Nguyễn Thúc Hải PGS.TS Võ Thanh Tú Hà Nội - 2015 LỜI CẢM ƠN Luận án tiến sĩ hệ thống thông tin “Nghiên cứu nâng cao hiệu giao thức định tuyến cho mạng MANET” hoàn thành thời gian học tập, nghiên cứu Viện Công nghệ Thông tin Truyền thông, Đại học Bách khoa Hà Nội Để có kết này, trước hết Tơi xin bày tỏ lịng biết ơn sâu sắc đến thầy giáo hướng dẫn GS.TS Nguyễn Thúc Hải, PGS.TS Võ Thanh Tú, người định hướng nghiên cứu, hướng dẫn khoa học, dẫn cho phương pháp luận thực nghiên cứu luận án hướng giải vấn đề cụ thể liên quan đến luận án Tôi xin trân trọng cám ơn viện Công nghệ Thông tin Truyền thông, Đại học Bách khoa Hà Nội hỗ trợ, giúp đỡ tạo điều kiện thuận lợi cho tơi q trình học tập nghiên cứu Tôi xin chân thành cám ơn Lãnh đạo Trường Cao đẳng Công nghiệp Huế, tập thể cán bộ, giảng viên, đồng nghiệp trường tạo điều kiện, hỗ trợ giúp đỡ cho tham gia cơng tác học tập, nghiên cứu hồn thành luận án Xin trân trọng cám ơn tất nhà khoa học, chuyên gia dành thời gian đọc góp ý hồn thiện cho luận án Cuối cùng, tơi xin bày tỏ lịng biết ơn sâu sắc đến bố mẹ, vợ tôi, tất người thân gia đình bạn bè, đồng nghiệp dành cho ủng hộ nhiệt tình, động viên để tơi có điều kiện hồn thành luận án Hà Nội, Tháng 05 năm 2015 Cung Trọng Cường i LỜI CAM ĐOAN Tôi xin cam đoan luận án “Nghiên cứu nâng cao hiệu giao thức định tuyến cho mạng MANET” cơng trình nghiên cứu riêng Các kết quả, số liệu nêu luận án trung thực, phần cơng bố trên tạp chí khoa học chun ngành, phần cịn lại chưa cơng bố cơng trình khác Hà Nội, Ngày 29 tháng 05 năm 2015 Tập thể hướng dẫn Nghiên cứu sinh GS.TS Nguyễn Thúc Hải Cung Trọng Cường PGS.TS Võ Thanh Tú ii MỤ C L Ụ C Lời cam đoan Mục lục Danh mục từ viết tắt Danh mục hình vẽ Danh mục bảng biểu MỞ ĐẦU CHƯƠNG TỔNG QUAN VỀ MẠNG MANET VÀ GIẢI PHÁP NÂNG CAO HIỆU NĂNG………………… 1.1 Tổng quan mạng không dây 1.2 Tổng quan mạng MANET ứng dụng 11 1.3 Các yếu tố ảnh hưởng hiệu phương pháp đánh giá hiệu mạng MANET 13 1.4 1.5 1.3.1 Các vấn đề định tuyến mạng MANET 13 1.3.2 Vấn đề sử dụng thuật toán định tuyến mạng MANET 14 1.3.3 Các yếu tố đánh giá hiệu mạng 16 1.3.4 Các phương pháp đánh giá hiệu mạng áp dụng cho mạng MANET 16 Công nghệ tác tử ứng dụng cho mạng MANET 17 1.4.1 Giới thiệu 17 1.4.2 Mơ hình tác tử ứng dụng cho mạng MANET 19 1.4.2.1 Mơ hình hoạt động tác tử ứng dụng 19 1.4.2.2 Mơ hình tác tử điều khiển định tuyến cho mạng MANET 21 Kết luận Chương 22 CHƯƠNG ĐỊNH TUYẾN TRONG MẠNG MANET 23 2.1 Tổng quan định tuyến mạng MANET 23 2.1.1 Các thuật toán định tuyến 23 2.1.1.1 Thuật toán Véc tơ khoảng cách 23 2.1.1.2 Thuật toán Trạng thái liên kết 24 2.1.1.3 Định tuyến nguồn 25 2.1.2 Các kỹ thuật định tuyến cho mạng MANET 25 2.1.2.1 Giao thức định tuyến theo ghi 26 2.1.2.2 Giao thức định tuyến điều khiển theo yêu cầu 28 2.1.2.3 Giao thức định tuyến kết hợp 31 iii 2.2 2.3 2.4 Giao thức định tuyến điều khiển theo yêu cầu DSR AODV 32 2.2.1 DSR 32 2.2.2 AODV 38 Nghiên cứu cải tiến định tuyến cho mạng MANET 41 2.3.1 Một số nghiên cứu định tuyến cho mạng MANET 41 2.3.2 Một số nghiên cứu cải tiến giao thức định tuyến DSR AODV 44 2.3.3 Một số nhận xét đánh giá 46 2.3.4 Nội dung nghiên cứu luận án 47 Kết luận Chương 48 CHƯƠNG GIẢI PHÁP CẢI TIẾN GIAO THỨC ĐỊNH TUYẾN MANET SỬ DỤNG TÁC TỬ…… 49 3.1 3.2 3.3 Đánh giá giao thức định tuyến DSR AODV 49 3.1.1 Một số đánh giá giao thức DSR 49 3.1.2 Một số đánh giá giao thức AODV 50 3.1.3 So sánh nguyên lý hoạt động hai giao thức DSR AODV 50 3.1.4 Đánh giá kết mô giao thức DSR AODV 52 3.1.4.1 Xây dựng kịch mô 52 3.1.4.2 Đánh giá kết mô 53 Giải pháp cải tiến giao thức định tuyến điều khiển theo yêu cầu DSR AODV 58 3.2.1 Ý tưởng giải pháp đề xuất 58 3.2.2 Mơ hình tác tử giải pháp đề xuất 60 3.2.3 Thiết kế, cài đặt tác tử FA, BA phần mềm OMNeT++ 62 Đề xuất thuật toán cải tiến giao thức định tuyến DSR, AODV 64 3.3.1 Ý tưởng thuật toán 64 3.3.1.2 Mơ tả thuật tốn 64 3.3.1.3 Mô đánh giá kết 68 3.3.2 Thuật toán MAR-AODV 72 3.3.2.1 Ý tưởng thuật toán 72 3.3.2.2 Mơ tả thuật tốn 73 3.3.2.3 Mô đánh giá kết 77 3.3.3 3.4 Thuật toán MAR-DSR 64 3.3.1.1 Thuật toán MAR2-AODV 81 3.3.3.1 Mơ tả thuật tốn 81 3.3.3.2 Mô đánh giá kết 84 Đánh giá kết thuật toán cải tiến cho giao thức DSR AODV 92 3.4.1 Đánh giá MAR-AODV MAR2-AODV 92 3.4.2 Đánh giá MAR-DSR MAR-AODV 95 iv 3.4.3 Đánh giá MAR-DSR, MAR-AODV MAR2-AODV 97 3.5 Đề xuất áp dụng thuật toán cải tiến 99 3.6 Kết luận Chương 100 KẾT LUẬN VÀ NHỮNG ĐÓNG GÓP CỦA LUẬN ÁN 101 HƯỚNG PHÁT TRIỂN CỦA ĐỀ TÀI LUẬN ÁN 103 DANH MỤC CÁC CƠNG TRÌNH ĐÃ CƠNG BỐ CỦA LUẬN ÁN 104 TÀI LIỆU THAM KHẢO 105 v DANH MỤC CÁC TỪ VIẾT TẮT STT Từ viết tắt 3G 4G LTE ACK AODV AOZDV AP ARPM 10 11 12 13 14 15 16 17 BA BS CBR CLR CP CPU CS DAG DoS DRP 18 DSDV 19 DSN 20 DSR 21 DVT 22 EDGE 23 FA 24 GPS 25 GSM 26 HSPA 27 ID 28 IEEE Nghĩa tiếng Anh Nghĩa tiếng Việt Third Generation Mạng di động hệ thứ Fourth Generation Long-Term Mạng di động hệ thứ Evolution Acknowledgement Xác nhận Giao thức định tuyến véc tơ Ad hoc On demand Distance khoảng cách theo yêu cầu vector mạng Ad hoc Giao thức định tuyến véc tơ Ad hoc On demand Zone khoảng cách theo yêu cầu sử dụng Distance vector định tuyến vùng mạng Ad hoc Access Point Điểm truy cập Giao thức định tuyến sử dụng tác Agent-based Routing Protocol tử Back Agent Tác tử phản hồi Base Station Trạm gốc Constant Bit Rate Lưu lượng tốc độ bit ổn định Clear Packet Gói tin xóa thơng tin định tuyến Congestion Probability Mức độ tắc nghẽn Central Processing Unit Đơn vị xử lý trung tâm Congestion State Tình trạng tắc nghẽn Directed Acyclic Graph Đồ thị khơng chu trình có hướng Denial-of-service Từ chối dịch vụ Dynamic Routing Protocol Giao thức định tuyến động Destination-Sequenced Giao thức định tuyến véc tơ Distance-Vector khoảng cách theo thứ tự đích Destination Sequence Number Số thứ tự đích Dynamic Source Routing Giao thức định tuyến nguồn động Destination-Vector Table Bảng véc tơ đích Enhanced Data Rates for GSM Công nghệ truyền liệu GSM Evolution nâng cao Forward Agent Tác tử chuyển tiếp Global Positioning System Global System for Mobile Communications High-Speed Downlink Packet Access Identify Institude of Electrical and vi Hệ thống định vị toàn cầu Hệ thống thơng tin di động tồn cầu Cơng nghệ truy nhập gói đường xuống tốc độ cao, Định danh Viện Kỹ thuật điện, điện tử 29 30 31 32 33 34 35 36 IP IrDA ISP Kbps LAN LAR LSA LSDB Electronics Engineers Internet Protocol Infrared Data Association Internet Service Provider Kilo bits per second Local Area Network Location Aided Routing Link State Advertisment Link State Database Giao thức Internet Hiệp hội Dữ liệu hồng ngoại Nhà cung cấp dịch vụ Internet Ki lô bit giây Mạng cục Định tuyến hỗ trợ vị trí Quảng bá trạng thái liên kết Cơ sở liệu trạng thái liên kết Điều khiển truy nhập lớp trung 37 MAC Medium Access Control gian 38 MANET Mobile Ad hoc Network Mạng tùy biến không dây 39 MAR-AODV Mobile Agent Routing – AODV Giao thức cải tiến MAR-AODV Mobile Agent Routing – 40 MAR2-AODV Giao thức cải tiến MAR2-AODV AODV 41 MAR-DSR Mobile Agent Routing – DSR Giao thức cải tiến MAR-DSR 42 Mbps Mega bits per second Mê ga bit giây 43 MPR Multi Point Relays Các chuyển tiếp đa điểm 44 NC Node Congestion Tắc nghẽn nút 45 NE Node Energy Năng lượng nút 46 NFC Near Field Communication Công nghệ giao tiếp tầm ngắn 47 NSV Node Status Value Giá trị tình trạng nút Giao thức định tuyến trạng thái 48 OLSR Optimized Link State Routing liên kết tối ưu 49 PDA Personal Digital Accessory Thiết bị điện tử cá nhân 50 RERR Route Error Gói tin lỗi lộ trình 51 RREP Route Reply Gói tin trả lời lộ trình 52 RREQ Route Request Gói tin yêu cầu lộ trình 53 SP Status Probability Tình trạng xác suất 54 TC Topology Control Điều khiển tô pô mạng Thời gian để di trú (chuyển sang 55 TtM Time-to-Migrate nút khác) Temporally Ordered Routing Giao thức định tuyến dùng giải 56 TORA Algorithm thuật Yêu cầu tạm thời 57 TTL Time To Live Thời gian sống Universal Mobile Hệ thống thông tin di động đa 58 UMTS Telecommunications Systems 59 VPN 60 WIFI 61 WiMAX 62 WLAN 63 WPAN Viture Private Network Mạng riêng ảo Hệ thống mạng khơng dây sử Wireless Fidelity dụng sóng vơ tuyến Worldwide Interoperability for Hệ thống mạng không dây băng Microwave Access thông rộng khoảng cách lớn Wireless Local Area Network Mạng cục không dây Wireless Personal Area Network Mạng cá nhân không dây vii 64 WRP 65 ZHLS 66 ZPR Wireless Routing Protocol Giao thức định tuyến không dây Zone-Based Hierarchical Link Giao thức định tuyến Trạng thái State Routing Protocol liên kết phân cấp theo vùng Zone Routing Protocol Giao thức định tuyến theo vùng viii [87] Tanya Koohpayeh Araghi, Mazdak Zamani, Azizah BT Abdul Mnaf (2013) Performance Analysis in Recactive Routing Protocols in Wireless Mobile Ad hoc Networks Using DSR, AODV and AOMDV International conference on Informatics and Creative Multimedia (ICICM), Kuala Lumpur, 09.2013, pp.81-84 [88] Tao Lin (2004) Mobile Ad-hoc Network Routing Protocols: Methodologies and Applications, Thesis of PhD, Blacksburg, Virginia, 03.2004 [89] Uma Rathore Bhatt, Priyanka Jain, Raksha Upadhyay (2013) Enhanced AODVAn Energy Efficient Routing Protocol for MANET Nirma University International Conference on Engineering (NUiCONE), Ahmedabad, 11.2013, pp.1-4 [90] Thomas H Cormen, Charles E Leiserson, Ronald L Rivest, Clifford Stein (2009) Intruduction to Algorithms The 3rd Edition, MIT Press, ISBN 978-0-26203384-8 [91] Wan-Jun Yu, Guo-Ming Zuo, Qianq-Qian Li (2008) Ant Colony optimization for routing in mobile ad hoc networks International Conference on Machine Learning and Cybernetics, Kunming, 07.2008, pp.1147-1151 [92] Werner Van Belle, Karsten Verelst, Theo D’Hondt (2007) Mobile Agents for Clustering and Routing in Mobile Ad Hoc Networks Springer Berlin, ISBN: 978-3540-20260-8, pp.271-276 [93] Yanbin Yang, Hongbin Chen (2009) An Improved AODV Routing Protocol for MANETs The 5th Wireless Communications Networking and Mobile Computing (WiCom’09), Beijing, 09.2009, pp 1-4 [94] Yang Xiao, Yi Pan (2009) Emering Wireless LANs, Wirless PANs, and Wireless MANs, IEEE 802.11, IEEE 802.15, 802.16 Wireless Standard Family, Wiley, A John Wiley&Son, INC., [95] Yashpalsinh Jadeja, Kirit Modi (2012) Cloud Computing – Concepts, Architecture and Challenges International Conference on Computing, Electronics and Electrical Technologies [ICCEET], Kumaracoil, 03.2012, pp 877-880 [96] Yu-Chee Tseng,Wen-Hua Liao, Shih-Lin Wu (2002) Mobile Ad hoc Networks and Routing Protocols, Handbook of Wireless Networks and Mobile Computing, John Wiley & Sons, Inc 2002, pp 371-392 [97] Zhang Binbin, Liu Quan and Zhao Shouling (2010) Using Statistical Network Link Model for Routing in Ad hoc Networks with multi-agent Reinforcement Learning The nd International Conference Advanced Computer Control (ICACC 2010), Shenyang, 03.2010, pp.462-466 [98] Zhang Jianwu, Zou Jingyuan, Zhao Qi (2009) MANET Routing Protocol for Improving Routing Discovery Based on AODV International Conference on Networks Security, Wireless Communications and Trusted Computing, Wuhan, 04.2009, pp.197-200 [99] Zhongming Zheng, Lin X.Cai, Xuemin Shen (2013) Sunstainable Wireless Networks ISBN 978-319-02469-1, Springer 112 PHỤ LỤC MƠ HÌNH MƠ PHỎNG CÁC THUẬT TỐN ĐỊNH TUYẾN TRONG MẠNG MANET SỬ DỤNG TÁC TỬ Giới thiệu mơ hình mơ Mơ thuật toán định tuyến mạng MANET triển khai số phần mềm mô mạng phổ biến NS-2, OPNET, NCTU-NS OMNeT++ Đặc biệt, OMNeT++ (Objective Modular Network Testbed in C++) phần mềm mô kiện rời rạc mã nguồn mở, sử dụng phổ biến cho việc mô giao thức điều khiển truyền tải mạng viễn thơng Với MANET, có nhiều Modules mơ thuật toán định tuyến viết OMNeT++ chuẩn hóa như: INETMANET, AdhocSim, DYMO, Trong luận án, tác giả phát triển module AdhocSim để mô thuật toán định tuyến đề xuất bao gồm MAR-DSR, MAR-AODV MAR2-AODV cách tích hợp thêm khối điều khiển MobileAgent cấu trúc nút mạng mô hình AdhocSim Giao diện chương trình trình bày Hình bên dưới: b) Kịch nút thiết lập mô c) Kịch trình khám phá lộ trình nút Hình Giao diện chương trình mơ OMNeT++ Tác tử cài đặt Simple Module OMNeT++, tích hợp vào cấu trúc nút mạng phần mềm Adhocsim Hình Trong khối MobileAgent thực quy trình cập nhật thơng tin trạng thái mạng thực sau: - Khi có yêu cầu khám phá lộ trình thơng qua tin RREQ, MobileAgent đọc thơng tin tình trạng tắt nghẽn nút mạng Module Physic - Khối MobileAgent phát gói FA BA truyền đến nút khác mạng để thơng báo tình trạng nút mạng - Thuật tốn MAR-DSR MAR-AODV dựa thơng tin gói FA BA để chọn lộ trình có mức độ tắc nghẽn nhỏ Hình Cấu trúc nút mạng MANET sử dụng Mobile Agent Mã nguồn số mudule a Code NED định nghĩa cấu trúc nút mạng module MobileHost parameters: numHost: numeric const, x: numeric, // actual position y: numeric, // " Xbound: numeric, Ybound: numeric, macAlgorithm: string, routeAlgorithm: string, mobilityModel: string; //randomWP or Pursuit submodules: mobility: mobilityModel like Mobility; parameters: maxSpeed = input(0,"max speed"), minSpeed = input(0,"min speed"), movKind = input(0,"0 toroidal, rebound"), XRange = Xbound, YRange = Ybound, moveInterval = input(0.5s ,"movement period"), distance = input(100 ,"distance to cover"), target = input(-1,"target node id"), pauseTime = input(0,"pause between two moves"), speedVariator = input(1,"speed choice variance"); display: "i=block/control;p=220,248"; physic: Physic; parameters: txPower = input, rxThreshold = input, channelDelay = input, channelDatarate = input, channelError = input; display: "i=abstract/dispatcher;p=92,246"; mac: macAlgorithm like Mac; parameters: inBufferSize = input, promisqueMode = input; display: "i=old/switch1;p=92,180"; route: routeAlgorithm like Routing; parameters: display: "i=abstract/router;p=92,99"; app: Application; parameters: rate = input, pktSize = input, burstInterval = input, hostNum = numHost, active = input; display: "i=device/wifilaptop;p=92,48"; MobileAgent: Agent; display: "p=220,152;i=block/socket,#ff0000, o=#ff00"; connections: app.out > route.fromApp display "m=m,52,28,52,28"; route.toMac > mac.fromRoute display "m=m,24,0,24,4"; mac.toRoute > route.fromMac display "m=m,80,0,80,0"; mac.toPh > physic.fromMac display "m=m,24,12,24,12"; physic.toMac > mac.fromPh display "m=m,80,0,80,8"; mobility.out > physic.fromMobility display "m=m,52,36,80,40"; physic.toAgent > MobileAgent.in; MobileAgent.out > physic.fromAgent; display: "p=10,10;b=255,282"; endmodule b Hàm định nghĩa khởi tạo Agent: #include #include #include #include #include #include class Agent : public cSimpleModule { Module_Class_Members(Agent,cSimpleModule,16384) virtual void activity(); virtual void initialize(); }; Define_Module(Agent); void Agent::initialize() { for (int i=0; ipar("x"); posY = (int)parent->par("y"); numHost = (int)parent->par("numHost"); power = (double) par("txPower"); rxThreshold = (double) par("rxThreshold"); ev getFieldCount(); } switch (field) { case 0: return "ID"; case 1: return "Src_ID"; case 2: return "Dest_ID"; default: return NULL; } } const char *FADescriptor::getFieldTypeString(int field) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldTypeString(field); field -= baseclassdesc->getFieldCount(); } switch (field) { case 0: return "int"; case 1: return "int"; case 2: return "int"; default: return NULL; } } const char *FADescriptor::getFieldEnumName(int field) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldEnumName(field); field -= baseclassdesc->getFieldCount(); } switch (field) { default: return NULL; } } int FADescriptor::getArraySize(int field) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getArraySize(field); field -= baseclassdesc->getFieldCount(); } FA *pp = (FA *)p; switch (field) { default: return 0; } } bool FADescriptor::getFieldAsString(int field, int i, char *resultbuf, int bufsize) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldAsString(field,i,resultbuf,bufsize); field -= baseclassdesc->getFieldCount(); } FA *pp = (FA *)p; switch (field) { case 0: long2string(pp->getID(),resultbuf,bufsize); return true; case 1: long2string(pp->getSrc_ID(),resultbuf,bufsize); return true; case 2: long2string(pp->getDest_ID(),resultbuf,bufsize); return true; default: return false; } } bool FADescriptor::setFieldAsString(int field, int i, const char *value) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->setFieldAsString(field,i,value); field -= baseclassdesc->getFieldCount(); } FA *pp = (FA *)p; switch (field) { case 0: pp->setID(string2long(value)); return true; case 1: pp->setSrc_ID(string2long(value)); return true; case 2: pp->setDest_ID(string2long(value)); return true; default: return false; } } const char *FADescriptor::getFieldStructName(int field) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldStructName(field); field -= baseclassdesc->getFieldCount(); } switch (field) { default: return NULL; } } void *FADescriptor::getFieldStructPointer(int field, int i) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldStructPointer(field, i); field -= baseclassdesc->getFieldCount(); } FA *pp = (FA *)p; switch (field) { default: return NULL; } } sFieldWrapper *FADescriptor::getFieldWrapper(int field, int i) { return NULL; } e Code định nghĩa tác tử BA Register_Class(BA); BA::BA(const char *name, int kind) : cMessage(name,kind) { this->ID_var = 0; this->Src_ID_var = 0; this->Intermediate_ID_var = 0; this->CP_var = 0; } BA::BA(const BA& other) : cMessage() { unsigned int i; setName(other.name()); operator=(other); } BA::~BA() { unsigned int i; } BA& BA::operator=(const BA& other) { if (this==&other) return *this; unsigned int i; cMessage::operator=(other); this->ID_var = other.ID_var; this->Src_ID_var = other.Src_ID_var; this->Intermediate_ID_var = other.Intermediate_ID_var; this->CP_var = other.CP_var; return *this; } void BA::netPack(cCommBuffer *b) { cMessage::netPack(b); doPacking(b,this->ID_var); doPacking(b,this->Src_ID_var); doPacking(b,this->Intermediate_ID_var); doPacking(b,this->CP_var); } void BA::netUnpack(cCommBuffer *b) { cMessage::netUnpack(b); doUnpacking(b,this->ID_var); doUnpacking(b,this->Src_ID_var); doUnpacking(b,this->Intermediate_ID_var); doUnpacking(b,this->CP_var); } int BA::getID() const { return ID_var; } void BA::setID(int ID_var) { this->ID_var = ID_var; } int BA::getSrc_ID() const { return Src_ID_var; } void BA::setSrc_ID(int Src_ID_var) { this->Src_ID_var = Src_ID_var; } int BA::getIntermediate_ID() const { return Intermediate_ID_var; } void BA::setIntermediate_ID(int Intermediate_ID_var) { this->Intermediate_ID_var = Intermediate_ID_var; } double BA::getCP() const { return CP_var; } void BA::setCP(double CP_var) { this->CP_var = CP_var; } class BADescriptor : public cStructDescriptor { public: BADescriptor(); virtual ~BADescriptor(); BADescriptor& operator=(const BADescriptor& other); virtual cPolymorphic *dup() const {return new BADescriptor(*this);} virtual int getFieldCount(); virtual const char *getFieldName(int field); virtual int getFieldType(int field); virtual const char *getFieldTypeString(int field); virtual const char *getFieldEnumName(int field); virtual int getArraySize(int field); virtual bool getFieldAsString(int field, int i, char *resultbuf, int bufsize); virtual bool setFieldAsString(int field, int i, const char *value); virtual const char *getFieldStructName(int field); virtual void *getFieldStructPointer(int field, int i); virtual sFieldWrapper *getFieldWrapper(int field, int i); }; Register_Class(BADescriptor); 10 BADescriptor::BADescriptor() : cStructDescriptor("cMessage") { } BADescriptor::~BADescriptor() { } int BADescriptor::getFieldCount() { return baseclassdesc ? 4+baseclassdesc->getFieldCount() : 4; } int BADescriptor::getFieldType(int field) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldType(field); field -= baseclassdesc->getFieldCount(); } switch (field) { case 0: return FT_BASIC; case 1: return FT_BASIC; case 2: return FT_BASIC; case 3: return FT_BASIC; default: return FT_INVALID; } } const char *BADescriptor::getFieldName(int field) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldName(field); field -= baseclassdesc->getFieldCount(); } switch (field) { case 0: return "ID"; case 1: return "Src_ID"; case 2: return "Intermediate_ID"; case 3: return "CP"; default: return NULL; } } const char *BADescriptor::getFieldTypeString(int field) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldTypeString(field); field -= baseclassdesc->getFieldCount(); } switch (field) { case 0: return "int"; case 1: return "int"; case 2: return "int"; case 3: return "double"; default: return NULL; } } const char *BADescriptor::getFieldEnumName(int field) 11 { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldEnumName(field); field -= baseclassdesc->getFieldCount(); } switch (field) { default: return NULL; } } int BADescriptor::getArraySize(int field) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getArraySize(field); field -= baseclassdesc->getFieldCount(); } BA *pp = (BA *)p; switch (field) { default: return 0; } } bool BADescriptor::getFieldAsString(int field, int i, char *resultbuf, int bufsize) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldAsString(field,i,resultbuf,bufsize); field -= baseclassdesc->getFieldCount(); } BA *pp = (BA *)p; switch (field) { case 0: long2string(pp->getID(),resultbuf,bufsize); return true; case 1: long2string(pp->getSrc_ID(),resultbuf,bufsize); return true; case 2: long2string(pp->getIntermediate_ID(),resultbuf,bufsize); return true; case 3: double2string(pp->getCP(),resultbuf,bufsize); return true; default: return false; } } bool BADescriptor::setFieldAsString(int field, int i, const char *value) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->setFieldAsString(field,i,value); field -= baseclassdesc->getFieldCount(); } BA *pp = (BA *)p; switch (field) { case 0: pp->setID(string2long(value)); return true; case 1: pp->setSrc_ID(string2long(value)); return true; case 2: pp->setIntermediate_ID(string2long(value)); return true; case 3: pp->setCP(string2double(value)); return true; default: return false; } 12 } const char *BADescriptor::getFieldStructName(int field) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldStructName(field); field -= baseclassdesc->getFieldCount(); } switch (field) { default: return NULL; } } void *BADescriptor::getFieldStructPointer(int field, int i) { if (baseclassdesc) { if (field < baseclassdesc->getFieldCount()) return baseclassdesc->getFieldStructPointer(field, i); field -= baseclassdesc->getFieldCount(); } BA *pp = (BA *)p; switch (field) { default: return NULL; } } sFieldWrapper *BADescriptor::getFieldWrapper(int field, int i) { return NULL; } f File thiết lập tham số đầu vào mô #omnetpp.ini [General] network = world ini-warnings = no snapshot-file = snapShot.sna output-vector-file = xputVect.vec output-scalar-file = yputVect.sca #sim-time-limit = 0.5h sim-time-limit = 50000s total-stack-kb = 32768 num-rngs=5 [Cmdenv] module-messages =no event-banners =no runs-to-execute = express-mode = yes status-frequency= 500000 default-run = [Tkenv] default-run= slavelog = yes slavelog-file = slave.log use-mainwindow = yes modmsgs-to-console = yes animation-speed = 2.0 13 [Parameters] #world module world.height = 550 world.width = 700 world.dim = 10 #Tong so node mo phong #mobility model # include Ini/avrSpeed.ini # world.N[*].mobilityModel = "RandomWalk" # include Ini/randWalk.ini # world.N[*].mobilityModel = "RestrictedRandWalk" # include Ini/resRWalk.ini world.N[*].mobilityModel = "RandomWP" include Ini/randWP.ini # world.N[*].mobilityModel = "RandomDirection" # include Ini/rDir.ini # world.N[*].mobilityModel = "Pursuit" # include Ini/pursuit.ini # world.N[*].mobilityModel = "Normal" # include Ini/normal.ini #mobile host module world.N[*].x = intuniform(5,95) world.N[*].y = intuniform(5,95) world.N[*].routeAlgorithm = "AODV" world.N[*].macAlgorithm = "SimpleMac" #pyisic module world.N[*].physic.txPower = uniform(9000,9900) world.N[*].physic.rxThreshold = world.N[*].physic.channelDelay = 0.0001 world.N[*].physic.channelDatarate = 11.04858e+6 world.N[*].physic.channelError = 0.000001 #mac module world.N[*].mac.promisqueMode = true; world.N[*].mac.inBufferSize = 8.38864e6 #application module # pakets per second world.N[*].app.rate = # pakets of 512 byte = 4096 bit world.N[*].app.pktSize = 1002096# Thiet lap luu luong phat sinh # time elapsed between two data burst # world.N[*].app.burstInterval = truncnormal(2,1.0) # Goc # world.N[*].app.burstInterval = world.N[*].app.burstInterval = exponential(0.5) # indicate the active hosts, they will generate traffic in all the # simulator run # Due to the different random position of each node # fixing the host name that will work will not cause any # statistical problem # world.N[1].app.active = # world.N[3].app.active = # world.N[7].app.active = # world.N[10].app.active = # world.N[4].app.active = world.N[*].app.active = # include all the execution'seeds # include Ini/seeds.ini 14 ... loại giao thức định tuyến cho mạng MANET 2.1.2.1 Giao thức định tuyến theo ghi Giao thức định tuyến theo ghi gọi giao thức định tuyến chủ động (proactive) Theo giao thức định tuyến này, nút mạng. .. [84](pp.106-110) 2.1.2.3 Giao thức định tuyến kết hợp Trong giao thức định tuyến có kết hợp hai chế giao thức định tuyến chủ động giao thức định tuyến phản ứng lại Giao thức phù hợp với mạng quy mơ, kích... thơng mạng Vì vậy, giao thức định tuyến theo ghi áp dụng mơ hình mạng MANET mà nút di chuyển 26 Một số giao thức định tuyến hoạt động theo kiểu giao thức định tuyến theo ghi như: Giao thức định tuyến

Ngày đăng: 30/03/2022, 02:38

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan