Full text
PRELIMINARY STUDY OF COOPERATION IN HYBRID AD-HOC NETWORKS Memòria del Treball Final de Carrera d'Enginyeria Tècnica de Telecomunicació, especialitat Sistemes Electrònics realitzat per Federico Fernández Delgado i dirigit per María Ángeles Vázquez Castro Bellaterra, 9 de Juny de 2007
Escola Tècnica Superior d’Enginyeria El sotasignat, Maria Ángeles Vázquez Castro, Professor/a de l'Escola Tècnica Superior d'Enginyeria de la UAB, CERTIFICA: Que el treball a què correspon aquesta memòria ha estat realitzat sota la seva direcció per en Federico Fernández Delgado, I per tal que consti firma la present. Signat: ............................................ Bellaterra, ........de...............................de 200.....
ABSTRACT In this paper, we present a first approach to evolve a cooperative behavior in ad hoc networks. Since wireless nodes are energy constrained, it may not be in the best interest of a node to always accept relay requests. On the other hand, if all nodes decide not to expend energy in relaying, then network throughput will drop dramatically. Both these extreme scenarios are unfavorable to the interests of a user. In this paper we deal with the issue of user cooperation in ad hoc networks by developing the algorithm called Generous TIT-FOR-TAT (GTFT). We assume that nodes are rational, i.e., their actions are strictly determined by selfinterest, and that each node is associated with a minimum lifetime constraint. Given these lifetime constraints and the assumption of rational behavior, we study the added behavior of the network. vii
TABLE OF CONTENTS ABSTRACT VII 1 INTRODUCTION 13 1.1 OVERVIEW 13 1.2 MOTIVATION AND OBJECTIVES 14 1.3 STRUCTURE OF THE PAPER 15 2 DVB-RCS 17 2.1 WHAT IS DVB-RCS? [1] 17 2.2 UNDERSTANDING DVB-RCS 18 2.3 CAPACITY REQUEST CATEGORIES [3] 20 2.4 QUEUING STRATEGY 25 2.5 REQUESTING STRATEGY 26 2.6 DVB-RCS ON AD HOC NETWORKS 28 3 AD-HOC NETWORK 29 3.1 UNDERSTANDING AD-HOC NETWORKS [7] 29 3.2 ROUTING PROTOCOLS [9] 33 3.3 LOAD BALANCING [10] 37 3.4 GAME THEORY IN TELECOMMUNICATIONS [11] 38 3.5 STATE OF THE ART [12] 39 4 PROBLEM STATEMENT 43 4.1 UNDERSTANDING THE COOPERATION IN THE WIRELESS AD-HOC NETWORKS [6] 43 4.2 SYSTEM MODEL 45 4.3 THE GTFT ALGORITHM 46 ix
CHAPTER 2: DVB-RCS 2 DVB-RCS 2.1 WHAT IS DVB-RCS? [1] DVB-RCS stands for Digital Video Broadcast - Return Channel Satellite. DVB-RCS is part of the DVB standards for satellite communication, DVB-S and DVB-S2. The purpose of DVB-RCS is to provide a return channel to enable Internet and other data services over satellite. The DVB standards are maintained by the DVB Project, which is an industry-led consortium of over 260 broadcasters, manufacturers, network operators, software developers, regulatory bodies and others in over 35 countries. It is officially defined in ETSI EN 301 790: Digital Video Broadcasting (DVB); Interaction channel for satellite distribution systems. The DVB-RCS standard is explained in ETSI EN 101 790: Digital Video Broadcasting (DVB); Interaction channel for Satellite Distribution Systems; Guidelines for the use of EN 301 790. DVB-RCS is the open standard for bi-directional or two-way transmission of digital data. It employs satellite transmission using combinations of C, Ku and Ka bands with return bandwidth up to 2 Mbit/s. It takes full advantage of the benefits of satellite and is instrumental in efforts to bridge the digital divide. Interoperability is one of the main advantages of DVB-RCS. Until DVB-RCS came along, customers of two-way broadband access via satellite had no choice except to commit to propriety systems, with all its inherent inflexibility and higher cost. Interoperability gives customers the choice of purchasing from one or several vendors throughout the lifetime of their systems. The result will be improved competition among vendors, reduced costs for users and accelerated enhancement of DVB-RCS equipment. 17
CHAPTER 2: DVB-RCS 2.2 UNDERSTANDING DVB-RCS The first version of DVB-RCS was released in April 2000 [2]. Its main objective is the definition of an interaction channel via satellite for GEO satellite interactive networks. The standard mainly addresses air-interface issues: physical layer aspects such as modulation, coding, synchronization and medium access control procedures for sharing the return link, maintaining MF-TDMA as the reference Radio Transmission Technology (RTT). The system features a star architecture (Fig.2-1): satellite terminals (RCSTs) transmit towards the Hub (gateway station) over the medium access controlled return link, whereas the Hub uses a forward broadcast link for transmitting data towards RCSTs. All communications, including those between the two DVB-RCS terminals, have to be routed via the Hub. Figure 2-1 Reference architecture for DVB-RCS network [2] Network Control Centre: a NCC provides Control and Monitoring Functions (CMF). It generates control and timing signals for the operation of the Satellite Interactive Network to be transmitted by one or several Feeder Stations. 18
CHAPTER 2: DVB-RCS Traffic Gateway: a TG receives the RCST return signals, provides accounting functions, interactive services and/or connections to external public, proprietary and private service providers (data bases, pay-per-view TV or video sources, software download, tele-shopping, tele-banking, financial services, stock market access, interactive games etc.) and networks (Internet, ISDN, PSTN, etc.). Feeder: a Feeder transmits the forward link signal, which is a standard satellite digital video broadcast (DVB-S or DVB-S2) uplink, onto which are multiplexed the user data and/or the control and timing signals needed for the operation of the Satellite Interactive Network. In general the standard does not go into much detail, leaving great deal of implementation aspects open for individual operators to determine. At medium access control (MAC) level, the standard only describes capacity request categories that can be used as building blocks for implementing elementary MAC transfer capabilities over the satellite network. A separate technical report stands complementary to the standard specification, in providing guidelines for the actual standard implementation [3]. Interestingly, two types of RCS terminals are identified, called type A and B: the former supports IP traffic (Fig. 2-2) and the latter is envisaged for the support of native ATM protocols. User data are carried over two types of bursts, the one carrying ATM cells and the other (optional) MPEG-2 packets. IP traffic is encapsulated into either ATM cells via ATM adaptation layer 5 or, optionally, MPEG-2 bursts via Multi Protocol Encapsulation and is carried by the respective types of traffic bursts. ATM is therefore present in DVB-RCS, although in the case of RCST-A, its functionality is limited to the packetisation of the variable-length IP datagrams. There is no ATM signaling or ATM QoS framework. 19
CHAPTER 2: DVB-RCS Figure 2-2 User plane protocol stack for type A RCS terminal [2] The DVB-RCS standard enjoys the strong support of ESA. An expression of this support has been the set-up of two special interest groups, the ad-hoc RSAT group and, more recently, the SatLabs group. The RSAT group consists of major, mainly European, industrial players. It produced a report listing the changes that are necessary to expand the standard applicability to the regenerative satellite scenario[4], thus enabling single-hop mesh connectivity between DVBRCS terminals. Most of the proposed changes have been incorporated in the latest version of the DVB-RCS specification and the group is currently inactive. The SatLabs group introduces itself as an international, non-profit association, whose main objective is the large-scale adoption of the DVB-RCS standard as a platform for system interoperability. The group consists of many significant industrial players, ranging from satellite manufacturers to system integrators and service providers, and has recently produced its first set of recommendations [5]. 2.3 CAPACITY REQUEST CATEGORIES [3] Hereinafter, MSL refers to the minimum scheduler (i.e. the entity which generates the TBTP) latency. For example, the MSL (in frames) can be defined as the minimum time from the beginning of the frame in which a request is sent until the frame in which a corresponding assignment will apply. The MSL corresponds to the worst case round trip 20
CHAPTER 2: DVB-RCS propagation delay from any RCST to scheduler and back again, plus any on-board delay at the satellite, plus scheduler processing delays, rounded up to a whole number of frames (figure 2-3) where the bandwidth of a frame is less or equal to the frequency hopping range of RCSTs, which is 20 MHz in this example. Figure 2-3 Example frame composition principle. The sum of allocated or requested capacity for any given Return Channel Satellite Terminal (RCST) shall not exceed the maximum transmit capability of that RCST, or the maximum allowed transmit capability whichever is less. The mapping between source traffic type and capacity category depends on the types of service provided, on the transmission protocols used and on constraints imposed by the satellite orbit. For these reasons, the following suggested mapping is only provided as examples. In most networks, RCSTs transmit in all assigned time slots, even when they have no actual traffic to send. Some networks may prefer that RCST's generally do not transmit 21
CHAPTER 2: DVB-RCS in this case. Such networks can occasionally force a transmission by means of the mechanism described below: Assignment_type: the meaning of the field values in table 29 of EN 301 790: • 00: One time assignment: the slot(s) is (are) assigned only for this superframe. • 01: Repeating assignment: the slot(s) is (are) assigned in all superframes after the current one, until released. • 10: Assignment release: the slot(s) previously allocated are no longer useable by the RCST. • 11: Forced_transmission one time assignment: the RCST is forced to transmit in the burst(s), even if it has no traffic to send. The assignment_type field is used to specify the type of allocation, which is granted to the RCST. In most networks,RCSTs transmit in all assigned time slots, even when they have no actual traffic to send. In these systems, the reserved value of the assignment_type field can be used exceptionally to force transmission in a burst. It should be noted that the "forced_transmssion" uses the combination "11", which is currently a "reserved value" in the normative document. 2.3.1 CONTINUOUS RATE ASSIGNMENT (CRA) CRA is rate capacity, which shall be provided in full for each and every superframe while required. Such capacity shall be negotiated directly between the RCST and the Network Control Center (NCC). CRA should be used for traffic, which requires a fixed guaranteed rate, with minimum delay and minimum delay jitter, such as the Constant Bit Rate (CBR) class of Asynchronous Transfer Mode (ATM) traffic. 22
CHAPTER 2: DVB-RCS This category is also preferred for variable rate traffic, which cannot tolerate the Minimum Scheduler Latency (MSL) delay. An example of such traffic for a GEO satellite could be the ATM Variable Bit Rate - real time (VBR-rt) class. 2.3.2 RATE BASED DYNAMIC CAPACITY (RBDC) RBDC should be used for variable rate traffic, which can tolerate the MSL delay. A typical application for RBDC over a GEO satellite could be the ATM Available Bit Rate (ABR) class. RBDC is rate capacity, which is requested dynamically by the RCST. RBDC capacity shall be provided in response to explicit requests from the RCST to the NCC, such requests being absolute (i.e. corresponding to the full rate currently being requested). Each request shall override all previous RBDC requests from the same RCST, and shall be subject to a maximum rate limit negotiated directly between the RCST and the NCC. To prevent a terminal anomaly resulting in a hanging capacity assignment, the last RBDC request received by the NCC from a given terminal shall automatically expire after a time-out period whose default value is 2 superframes, such expiry resulting in the RBDC being set to zero rate. The time-out can be configured between 1 and 15 superframes (if set to 0 the time out mechanism is disabled). CRA and RBDC can be used in combination, with CRA providing a fixed minimum capacity per frame and RBDC giving a dynamic variation component on top of the minimum. A typical application could be the ATM Variable Bit Rate - non real time (VBR-nrt) class. 2.3.3 VOLUME BASED DYNAMIC CAPACITY (VBDC) VBDC is volume capacity, which is requested dynamically by the RCST. VBDC capacity shall be provided in response to explicit requests from the RCST to the NCC, such requests being cumulative (i.e. each request shall add to all previous requests from the same RCST). The cumulative total per RCST shall be reduced by the amount of this capacity category assigned in each superframe. 23
CHAPTER 2: DVB-RCS VBDC should be used only for traffic that can tolerate delay jitter, such as the Unspecified Bit Rate (UBR) class of ATM traffic or standard IP traffic. VBDC and RBDC can also be used in combination for ABR traffic, with the VBDC component providing a low priority capacity extension above the guaranteed limit in the RBDC category. 2.3.4 ABSOLUTE VOLUME BASED DYNAMIC CAPACITY (AVBDC) AVBDC is volume capacity, which is requested dynamically by the RCST. This VBDC capacity shall be provided in response to explicit requests from the RCST to the NCC, such requests being absolute (i.e. this request replaces the previous ones from the same RCST). The AVBDC is used instead of VBDC when the RCST senses that the VBDC request might be lost (for example in the case of contention minislots). This might happen when requests are sent on contention bursts or when the channel conditions (PER, Eb/N0) are degraded. Traffic supported by AVBDC is similar to the VBDC one. 2.3.5 FREE CAPACITY ASSIGNMENT (FCA) FCA is volume capacity, which shall be assigned to RCSTs from capacity, which would be otherwise unused. Such capacity assignment shall be automatic and shall not involve any signaling from the RCST to the NCC. It shall be possible for the NCC to inhibit FCA for any RCST or RCSTs. It should be noted that the term "free" in FCA refers to "spare" system capacity and has no bearing on accounting. CRA and FCA can also be viewed as two mechanisms to grant dynamically capacity to a terminal, without requests being made from that terminal. This does not exclude the possibility that requests may have been made at a higher level than the terminal. FCA should not be mapped to any traffic category, since availability is highly variable. Capacity assigned in this category is intended as bonus capacity, which can be used to reduce delays on any traffic, which can tolerate delay jitter. 24
CHAPTER 2: DVB-RCS 2.4 QUEUING STRATEGY An RCST may queue all traffic arriving from the user interface, using separate queues for traffic, which is subject to different transmission priorities. As an example, one queue shall be provided for each of the following priorities, where implemented: • Real Time (RT) priority, corresponding to traffic carried using the CRA capacity category. Such traffic typically represents emulated circuit switched operation with tight constraint on end-to-end jitter build-up. • Variable Rate (VR) priority, corresponding to traffic carried using the RBDC capacity category. Two VR traffic sub-priorities are possible: jitter sensitive (VR-Real Time or VR-RT) or jitter tolerant (VR-Jitter Tolerant or VR-JT). Where an RCST is required to support traffic with separate VR-RT and VR-JT components, then at least one queue shall be provided for each component with the VR-RT queue being the higher priority. • Jitter Tolerant (JT) priority, corresponding to all other traffic i.e. that carried using the VBDC/AVBDC capacity category. Queue lengths are a function of several factors including traffic profile, total system loading and congestion control methods. The queuing strategy for traffic classes using a combination of the above categories is not considered in the present document. However, it is likely that it requires a further queue per circuit source to allow context specific transmit processing. More queues may be required to meet network management constraints, such as the congestion control strategy. For example, the ATM explicit rate control for ABR traffic may require one queue per Virtual Circuit (VC). 25
CHAPTER 3: AD-HOC NETWORK Limited network access. Because there is no distribution system with ad hoc wireless LANs, users don't have effective access to the Internet and other wired network services. Of course you could setup a PC with a radio NIC and configure the PC with a shared connection to the Internet. This won't satisfy a larger group of users very well, though. As a result, ad hoc is not a good way to go for larger enterprise wireless LANs where there's a strong need to access applications and servers on a wired network. Difficult network management. Network management becomes a headache with ad hoc networks because of the fluidity of the network topology and lack of a centralized device. Without an access point, network managers can't easily monitor performance, perform security audits, etc. Effective network management with ad hoc wireless LANs requires network management at the user device level, which requires a significant amount of overhead packet transmission over the wireless LAN. This again leans ad hoc mode away from larger, enterprise wireless LAN applications. 3.1.3 MESH NETWORKING [8] Mesh networking is a way to route data, voice and instructions between nodes. It allows for continuous connections and reconfiguration around broken or blocked paths by "hopping" from node to node until the destination is reached. A mesh network whose nodes are all connected to each other is a fully connected network. Mobile ad-hoc networking (MANET), featured in many consumer devices, is a subsection of mesh networking. Figure 3-1 Image showing mesh network layout Mesh networks are self-healing: the network can still operate even when a node breaks down or a connection goes bad. As a result, a very reliable network is formed. This concept is applicable to wireless networks, wired networks, and software interaction. A mesh network is a networking technique, 32
CHAPTER 3: AD-HOC NETWORK which allows inexpensive peer network nodes to supply back haul services to other nodes in the same network. It effectively extends a network by sharing access to higher cost network infrastructure. Mesh networks differ from other networks in that the component parts can all connect to each other via multiple hops, and they generally are not mobile. 3.2 ROUTING PROTOCOLS [9] An Ad hoc routing protocol is a convention or standard that controls how nodes come to agree which way to route packets between computing devices in a mobile ad-hoc network (MANET). In ad hoc networks, nodes do not have a priori knowledge of topology of network around them, they have to discover it. The basic idea is that a new node (optionally) announces its presence and listens to broadcast announcements from its neighbors. The node learns about new near nodes and ways to reach them, and may announce that it can also reach those nodes. As time goes on, each node knows about all other nodes and one or more ways how to reach them. Routing algorithms have to • Keep routing table reasonably small • Choose best route for given destination (this can be the fastest, most reliable, highest throughput, or cheapest route) • Keep table up-to-date when nodes die, move or join • Require small amount of messages/time to converge Note that in a wider context, an ad hoc protocol can also mean an improvised and often impromptu protocol established for a particular specific purpose. A MANET consists of wireless hosts that move around, i.e. they have no permanent physical location. In order to facilitate communication within the network, a routing protocol is used to discover routes between nodes before the exchange of IP data packets. Below is a brief overview of IP routing in an Ad Hoc environment. 33
CHAPTER 3: AD-HOC NETWORK The routing protocols in Ad Hoc wireless networks are generally categorised as: 3.2.1.1 PROACTIVE These protocols require each node to maintain one or more tables to store up to date routing information and to propagate updates throughout the network. These protocols try and maintain valid routes to all communication mobile nodes all the time, which means before a route is actually needed. Periodic route updates are exchanged in order to synchronise the tables. Some examples of table driven ad hoc routing protocols include Dynamic Destination Sequenced Distance-Vector Routing Protocol (DSDV), Optimized Link State Routing Protocol (OLSR) and Fisheye State Routing Protocol (FSR). These protocols differ in the number of routing related tables and how changes are broadcasted in the network structure[12]. The problem with these protocols is the overhead; the protocols propagate and maintain routing information, regardless of whether or not it is needed. 3.2.1.2 REACTIVE These protocols create routes only when desired by a source node, therefore a route discovery process is required within the network. Once a route has been established, it is maintained by a route maintenance procedure until either the destination becomes inaccessible or until the route isn’t needed any longer. Some examples of source initiated ad hoc routing protocols include the Dynamic Source Routing Protocol (DSR), Ad Hoc On Demand Distance Vector Routing Protocol (AODV), and Temporally-Ordered Routing Algorithm (TORA). No periodic updates are required for these protocols but routing information is only available when hended[12]. 34
CHAPTER 3: AD-HOC NETWORK 3.2.1.3 HYBRID These protocols try to incorporate various aspects of proactive and reactive routing protocols. They are generally used to provide hierarchical routing; routing in general can be either flat or hierarchical in a flat approach, the nodes communicate directly with each other. The problem with this is that it does not scale well, it also does not allow for route aggregation of updates In a hierarchical approach, the nodes are grouped into clusters, within each cluster there is a cluster head, this acts as a gateway to other clusters, it serves as a sort of default route. The advantage of a hierarchical structure is that within a cluster, an on demand routing protocol could be used which is more efficient in small-scale networks. For inter cluster communication then a table driven protocol could be used which, would allow the network to scale better. An example of such a hybrid routing protocol is the Zone Routing Protocol (ZRP) [12]. 3.2.1.4 OTHER TYPES OF ROUTING PROTOCOLS There are many other types of ad hoc routing protocols; one for example LANMAR [12] uses location info, obtained using the Global Positioning System (GPS). By knowing the precise location of a node you can limit the search to a smaller “request zone” of the network. 3.2.2 SOME AD-HOC ROUTING PROTOCOLS On Demand: DSR (Dynamic Source Routing) Vector: DSDV (Destination-Sequenced Distance Vector) Hierarchy: ZRP (Zone Routing Protocol) 35
CHAPTER 3: AD-HOC NETWORK Mixed and Others: CBRP (Cluster Based Routing Protocol) LANMAR (Landmark Routing Protocol) TBRPF (Topology Broadcast Based on Reverse – Path Forwarding) AODV (Ad-hoc On-demand Distance Vector Routing) TORA (Temporally-Ordered Routing Algorithm) LAR (Location Aided Routing) OLSR (Optimized Link State Routing) FSR (Fisheye State Routing) Criterion AODV DSR OLSR FSR CBRP LANMAR TBRPF ZRP Without loop Yes Yes Yes Yes Yes Yes Yes Yes Many routes possible No Yes No No Yes No No Yes Distributed Yes Yes Yes Yes Yes Yes Yes Yes Kind reactive reactive proactive proactive hybrid hybrid proactive hybrid Security No No No No No No No No Periodic messages control No No Yes Yes Yes Yes Yes Yes Unidirectional links No Yes Yes Yes Yes No No Yes Figure 3-2 Routing Protocols Characteristics The studied metrics to analyze a concrete routing protocol are: The loss rate: important because the retransmission of the data is managed at transport level and consequently can influence the maximum throughput that the network supports. The routing overhead: it must be the less possible to optimize the band-width of the network. It is measured as a number of packets. The relevance of the path: Its the difference between the path taken by the data and the existing shortest path between the source and the destination. That shows the capacity of the protocol to find most efficient paths in terms of a number of intermediate nodes. 36
CHAPTER 3: AD-HOC NETWORK 3.3 LOAD BALANCING [10] Computer networks are complex systems, often routing hundreds, thousands, or even millions of data packets every second. Therefore, in order for networks to handle large amounts of data, it is important that the data is routed efficiently. For example, if there are ten routers within a network and two of them are doing 95% of the work, the network is not running very efficiently. The network would run much faster if each router were handling about 10% of the traffic. Likewise, if a website gets thousands of hits every second, it is more efficient to split the traffic between multiple Web servers than to rely on a single server to handle the full load. Load balancing helps make networks more efficient. It distributes the processing and traffic evenly across a network, making sure no single device is overwhelmed. Web servers, as in the example above, often use load balancing to evenly split the traffic load among several different servers. This allows them to use the available bandwidth more effectively, and therefore provides faster access to the websites they host. Whether load balancing is done on a local network or a large Web server, it requires hardware or software that divides incoming traffic among the available servers. Networks that receive high amounts of traffic may even have one or more servers dedicated to balancing the load among the other servers and devices in the network. These servers are often called (not surprisingly) load balancers. Clusters, or multiple computers that work together, also use load balancing to spread out-processing jobs among the available systems (Figure 3-4). 37
CHAPTER 3: AD-HOC NETWORK Figure 3-3 Cluster of devices balancing traffic 3.4 GAME THEORY IN TELECOMMUNICATIONS [11] Game theory has been applied to many fields of telecommunications. It is a good tool when analytical results concerning selfish users are needed. Especially the growth and commercialization of the Internet has required a new point of view. Instead of a homogeneous network where users use the agreed protocols, the Internet is today often modeled to be consisted of selfish users trying to maximize their quality of service. The term game theory is sometimes used vaguely in the context of telecommunications. Approaches discussing selfish users are called game theoretic, even if they do not have any formal game theoretic analysis. When a telecommunication system is modeled using game theory, there are some properties that are of interest. Is there a Nash equilibrium? Is it unique? Does the system converge to the equilibrium point? Is it also a system wide optimum, i.e. does it maximize the social welfare? We briefly cover some fields of telecommunications in which game theory has been applied. Most importantly, the applications to ad hoc networks are introduced. Also, some game theoretic research of the Internet is discussed in less detail. Finally, we introduce some research in other areas that may give insight into the AHNs. Game theory has been applied to the financial problems of telecommunications but they are not in the scope of this thesis. 38
CHAPTER 3: AD-HOC NETWORK Game theoretic research regarding AHNs has been focused on the cooperation of the nodes. While the mechanisms introduced try to provide means to prevent selfishness and to enforce cooperation, the game theoretic research considers the same problem using a more analytical viewpoint. 3.5 STATE OF THE ART [12] 3.5.1 DYNAMIC CONFIGURATION OF IP ADDRESSES In order to communicate nodes need IP addresses. Since Ad Hoc networks lack any centralised administration these addresses can’t be manually configured, and so must be configured dynamically. In a wired network dynamic configuration is achieved using the Dynamic Host Configuration Protocol (DHCP), however this requires the presence of a centralised DHCP server, which maintains the configuration information of all nodes in the network. Since an Ad Hoc network is devoid of any fixed infrastructure such as a central server, this approach can’t be used. The problem in regard to Internet connectivity for IPv4, is that most of the proposals for dynamic address allocation assumes the use of private addresses, due to the difficulty in obtaining global addresses. There is an issue here in regard to connectivity to the Internet, as some sort of network address translation (NAT) process will be required, this is a process that converts a private address into a unique global address. In the wired environment NAT is achieved using “Traditional Network Translation (NAT)”, this is a process that converts a non-unique IP address to a unique IP address. A solution is proposed in [13] “Connectivity for IPv4 Mobile Ad Hoc Networks” however it assumes that each node in the MANET is using Mobile IP and as a result already has a globally unique home address. It assumes that a Foreign Agent assigns “care of addresses” to nodes as they arrive into the network and acts as a gateway for them when they want to connect to the Internet. 39
CHAPTER 3: AD-HOC NETWORK 3.5.2 DYNAMIC ALLOCATION PROPOSALS When a node is assigned an address, it needs to find out whether or not the address it chooses in unique within its network. In order to determine this, a process known as duplicate address detection (DAD) is performed, it is basically a process that determines whether or not a chosen IP address is unique within a chosen network. An overview of different DAD techniques is presented in . Generally the different proposals differ in the technique they use to perform DAD. The proposals fall into two different categories. 3.5.2.1 HIERARCHICAL APPROACH In a hierarchical approach, a clustering technique is used with one node (cluster head) assuming the responsibility for the allocation of addresses to new nodes as they arrive, basically when a new node arrives, he registers with the cluster head, who then allocates a new addresses and co ordinates a duplicate address (DAD) process in order to determine whether or not the address chosen is unique within the ad hoc network. The following paper is based on this approach. A new node entering the network, hereafter called the “requester”, chooses a reachable node as the “initiator”, which performs address allocation on its behalf. All other nodes know the route to the initiator and can forward their responses to it. The initiator chooses an address it perceives as unallocated and attempts to acquire permission from all other nodes in the network to assign the address to the requester. Nodes perceiving this address as unallocated mark the requested address as allocation in progress and reply in affirmative to the initiator. This allocation is made permanent by a second message, which is sent by the initiator if the initiator receives an affirmative response from all nodes in the network. Therefore the IP address allocation is similar to a twophase commit. Nodes, which no longer wish to be part of the system, relinquish their address by broadcasting a message to the effect before leaving the network. If a node abruptly leaves the network, i.e. goes down without relinquishing its address, it would fail to 40
CHAPTER 3: AD-HOC NETWORK respond to the address allocation request by some initiator the next time a requester enter the network. In this case the address of the departed node is cleaned up by the initiator awaiting a reply from the departed node. Merging works differently, here a unique partition ID is used. When two nodes come into contact and exchange their partition ID’s, they realise that they are different partitions and so merge. To do this they exchange partition ID’s as well as the table, which shows all IP address that have been allocated. If it is found that nodes in the partitions have the same IP address, then one node gives up its IP address and requests another one. 3.5.2.2 FLAT TOPOLOGY APPROACH In a flat topology approach there is no cluster head, which assumes responsibility for the allocation. Here when a node joins the network and wants an IP address, it chooses an address at random and then performs a duplicate address procedure in order to determine whether or not that address is unique. The process us based on a proactive routing protocol e.g. Ad Hoc On Demand Distance Vector Routing (AODV) and uses a flat structure. In a proactive routing protocol routing is done on an on demand basis, in order to route to a destination a AREQ message is sent out looking for the destination. When the destination is found an AREP message is sent back indicating that the destination is reachable. A node performing the auto-configuration process picks two addresses, a temporary address and the actual address to use. The former is used only once in the uniqueness check to minimise the possibility for it to be non unique. The unique check is based on sending as address request (AREQ) and expecting an address reply (AREP) back in case the address is not unique. In case no AREP is received, the uniqueness check is passed. 41
CHAPTER 4: PROBLEM STATEMENT strategy, each player mimics the action of the other player in the previous game. Each player, however, is slightly generous and on occasion cooperates by not confessing even if the other player had confessed in the previous game. We have adapted the GTFT algorithm to our problem. P2 P1 Confess Not confess Confess (5,5) (0,10) Not Confess (10,0) (1,1) Table 1. Punishment matrix for the prisoner’s dilema. The fist entry refers to prisoner P1’s prison term and the second one to prisoner P2’s prison term. In our algorithm, each node maintains a record of its past experience by using the two variables φh and ψh , h = 1, . . . N. Each node therefore maintains only information per session type and does not maintain individual records of its experience with every node in the network. The decisions are always taken by the relay nodes based only on their φh and ψh values. We consider the case with N nodes, K classes, q(1) = 1 and M = 1, i.e., each session uses only one relay. Assume that a generic node h receives a relay request. Let ε be a small positive number. The acceptance algorithm, which we call the GTFT algorithm is as follows. • If ψ h > τ h or φ h < ψ h - ε Reject • Else Accept . Thus, a request is refused if either φ h > τ h, where is 2 ρ τ N h= i.e., node h has relayed more traffic than what it should, or φ h < ψ h - ε i.e., the amount of traffic relayed by node h is greater than the amount of traffic relayed for node h by others. Since ε is positive, 48
CHAPTER 4: PROBLEM STATEMENT nodes are a little generous by agreeing to relay traffic for others even if they have not received a reciprocal amount of help. The GTFT algorithm has the following desirable properties: It is not a stationary strategy. Each node takes its action based solely on locally gathered information; this prevents a node from being exploited. 4.3.1.2 THE FLOW DIAGRAM In this chapter we try to explain the algorithm to either reject or accept a packet from a source. We will use flow charts to understand the algorithm easier. The algorithm is called by the function ‘main’ where contains the principle functions to develop the simulation. It will create a vector, which has the time when the nodes will request for the relays. For the sake of organization, in this function we will call two subroutines: initiate_parameters and find_source, which will be explained later. 49
CHAPTER 4: PROBLEM STATEMENT START_MAIN Create the time vector for every Node (time packet per node) Input PN (packets to send per node) Initiate_parameters Create the added time vector (Ts) (time packets per node arrenged) find_source Initiate Phi and Psi parameters Plot results Phi depending on V_pak Thrp depending on V_pak Figure 4-1. Flow chart of the main function The function ‘initiate_parameters’ defines the main parameters to use in the algorithm as the number of requested packets from each node the phi and psi ratios. It let us introduce the grade of generosity we wish or the energy constraint for each node. 50
CHAPTER 4: PROBLEM STATEMENT Start_Initiate_parameters Define B-->number of relayed requested packets generated by the nodes A-> number of relay requested packets accepted by the nodes phi-->A/B C->number of relay requested accepted to the nodes D->number of relayed requested made to the nodes Psi-->C/D Input the energy contraint for each node Input the generosity grade (epsilon) Initiate p->energy constraint vector rej->packets rejected vector Thrp->packets sent succesfully from each node return to main Figure 4-2. Flow chart of initiate_parameters The function ‘find_source’ let us find which is the node what is sending the packet. We can do it by comparing the main time vector with the single vector of each node. Depending on which is the source we will call a subroutine called ‘source_1’ if the source is the node one…to not repeat four times the same chart we will show the generic one. 51
CHAPTER 4: PROBLEM STATEMENT for i=1..PN*N (total number of packets) (running through Ts vector) Start_find_source for j=1..PN tau-->actualize the energy parameter to take the reject decision V_pak-->actualize the number of packets to plot the final results Store throughput values in 'Thrp' Store Phi values in 'phi' return to main Ts(i)==Ti(j)? To find the source Source_i false true Figure 4-3. Flow chart of find_source The ‘source_i’ function is which either rejects or accepts the request from the node ‘i’. First of all it chooses randomly the way to reach the destination, and then it will check the condition parameters to take the decision. 52
CHAPTER 4: PROBLEM STATEMENT Start source_i Choose the relay randomly psi > tau or phi < psiepsilon Reject packet inc 'rej' (relay) Accept packet inc A(source) inc B(source) inc C(relay) inc D(relay) dec 'p'(source) return to find_source truefalse Figure 4-4. Flow chart of ‘source_i’ function 53
CHAPTER 5: SIMULATIONS 5 SIMULATIONS SIMULATIONS RESULTS In case 1, we are going to study the speed saturation and the maximum throughput the nodes can reach. The following case will study the dependency between the final throughput and the energy constraint for every node. In Case 3, we will observe the throughput improvement by incrementing the grade of generosity. Finally, case 4 will show how is the network behavior when nodes have internal and external traffic to treat. In this section, we investigate the behavior of the GTFT. We focus on the single relay case. We consider a system with four nodes in it (N = 4). The energy constraints are given by ρ1 , ρ2, ρ3 and ρ4. Also, we asume M = 1 (numbers of relays), i.e., the route between the source and the destination node includes exactly one relay. We study convergence of the proposed strategy by assuming that all nodes employ GTFT as their acceptance algorithm. The results show that the NAR values increase as far as ε (the grade of generosity) is higher. For the sake of simplicity, in the plot, the evolution of the NARs is shown for just one node per each session type. 5.1 CASE 1. SPEED SATURATION AND MAXIMUM THROUGHPUT In this case we want to study the general network behavior. Every time a node either relays or sends traffic in the net, we are assigning a value given in tan percent. This value tells us how much energy is consuming each node per packet treated. By changing the energy consumed by every node we will be able to elaborate a function that shows the maximum rate we can reach in our system and when it gets saturated. This information will be so useful to compare with further cases because it will provide us a point of reference. 55
CHAPTER 5: SIMULATIONS In this case we simulate the network with all the nodes fully charged, that is they have all the energy to spend in the session (ρi=1). Every node has 1.000 packets to send, in other words, every node will request a relay a thousand times. The power consumption per node is given by ‘c’. First of all, we are going to explain the main issues about a simulation by creating one with the following parameters: ρi=1 (fully charge for every node); c=0.0008(0.08% energy consumption, every packet treated per node) and ε=0 (no grade of generosity). PACKETS SENT (Y) PACKETS RE Q UESTED ( X ) Figure 5-1 Nodes throughput, case 1. Number of packets=1.000; c=0.0008; ρi=1; ε=0 As we can see in the figure 5-1 above, we have to notice that the throughput increases its rate until reaching the saturation. This point is logically explainable because ρ decreases its value meanwhile the nodes are sending traffic packets. This happens until the nodes begin to refuse the requests from their neighbors due the energy limitations. The next figure 5-2 shows how the ratio packets sent / packets requested evolves depending on the packets requested. As we have explained before we call this ratio φ. 56
CHAPTER 5: SIMULATIONS We can notice that the ratio holds on 100% the first packets treated in the net. It occurs until the energy constraint begins to be insufficient, then the ratio falls and it is when the nodes begin to refuse relay petitions from their neighbors. P.SENT / P.REQUESTED (Y) PACKETS RE Q UESTED ( X ) Figure 5-2 Throughput ratio nodes, case 1. Number of packets=1.000; c=0.0008; ρi=1; ε=0 The figure 5-3, is showing how is the behavior of the system embedded. We can see the added throughput and the φ ratio adding the parameters from the four nodes of the net seen before. In the graphic of the ratio, we have put a line to recognize the e1 level. That will help us to recognize the slump point (SP). This point we have called ‘slump point’ defines the amount of packets needed to saturate the network. In other words, we take this point when the ratio works below 37% to find out the speed saturation for every further simulation. 57
CHAPTER 5: SIMULATIONS As we can spot from the graphics, there are some irregularities at the beginning of the simulation. They are attributable to the compensating phenomenon. At the beginning the nodes have different power constraint and because of the algorithm they can reject a packet either they have relayed more traffic compared with their energy ( ψ h > τ h) or they have relied more packets than have been sent ( φ h < ψ h). This fact makes the system compensate the energy for every node until they are balanced. Remembering that a node could reject for two reasons: the first one is related to the energy constraint, and the second is related to a self-interest issue (if the node that have been requested as a relay has sent more traffic from other than its own, then the node rejects the petition). The straight zone is caused by the increase of the rejections, making slow down the throughput (numerator) meanwhile the node continues requesting to other nodes (denominator). This fact makes the curls less intensive since the throughput magnitude is significantly smaller than the requests. P.SENT (Y) PACKETS RE Q UESTED ( X ) P.SENT / P.REQUESTED (Y) Figure 5-9 Added behavior, case 3. Number of packets=1.000; c=0.0008; ρ1 =1, ρ2 = 0.9, ρ3 = 0.7, ρ4=0.5; ε=0 64
CHAPTER 5: SIMULATIONS As we can observe at the figure 5-9, we have the added behavior of the network. Now we want to study the importance of the GoG by looking at the slump point. In our case are 1474 packets to reach the slump point without GoG. For further simulations we can compare this number to confirm the throughput improvement in the network with the same parameters set. P.SENT (Y) PACKETS RE Q UESTED ( X ) P.SENT / P.REQUESTED (Y) Figure 5-10 Added behavior with grade of generosity, case 3. Number of packets=1.000; c=0.0008; ρ1 =1, ρ2 = 0.9, ρ3 = 0.7, ρ4 = 0.5; ε=0.01 The figure 5-10 above shows the behavior of the same scenario but with a GoG=0.01 we can observe the improve since the slump point is establish at 1539 packets, that is 65 packets later than before. In other words, we have hold up the throughput more time than the case before by adding a small grade of generosity for each node. The logical explanation is that the nodes have rejected fewer packets caused by their self-interest making improve the system. 65
CHAPTER 5: SIMULATIONS Now, our algorithm to refuse a petition has change, φ h < ψ h - ε , instead of only φ h < ψ h, this means that the nodes are less selfishness in view of the fact that they are thinking like before ‘I don’t help you, if you don’t help me’ but ε tell us that the other nodes have had to help less than the rely to make it help them. line 1 line 2 SLUMP POINT PACKETS (Y) GRADE OF GENEROSITY ( Y ) Figure 5-11 Slump Point depending on the grade of generosity The figure 5-11 shows how the slump point is delayed as a result of an increase of the GoG. We can observe that the tendency of this function is linear (line 1). This means that the number of packets to reach a throughput rate below 37% increases as long as we enlarge the GoG making a network more efficient. Each node has sent more packets than before with the same power constraint. We can observe that the tendency changes its slope due to this power constraint; it’s lower (line 2) . In other words, the power constraint is what sets the ceiling of the throughput, hence the slump point. 66
CHAPTER 5: SIMULATIONS 5.4 CASE 4. EXTERNAL TRAFFIC NETWORK SIMULATION Now we want to study the behavior of the system when a node creates packets to send outside the network. We assume that every packet sent out is relayed by one node (it’s the same structure network simulated before). In other words, before the packet reaches the RCST, it will be relayed before being transmitted to the satellite. Assuming an integrated system where exists a RCSTs , we could develop a network system where every node (terminal) is capable to link with the satellite through different relays. This relays are the nodes of the AHN we want to simulate in this paper. Our job will be studying the nodes behavior to improve the global system. We choose the free capacity assignment (FCA), as a capacity request category in this simulation. That means that the assignment shall be automatic and shall not involve any signaling from the DVB-RCS terminal to the NCC. 67
CHAPTER 5: SIMULATIONS Node3 Node1 Node2 Node4 RCST DBV - RCSt Figure 5-12 External traffic paths In the simulation we will create external and internal traffic for each node. Being precisely, 50% of the packets will be external. The figure 5-12 shows us the hops for the packets before reach the satellite, distinguishing a color for each node until it arrives to the RCST. A relevant issue is ‘when are created the external packets?’ since one packet is produced at the end of the simulation it has more probabilities of being rejected because of the energy constraint boundaries. So our external packets are normally distributed in time. This way we can study the simulations with fewer distortions. The simulations are set with the nodes fully charged, a power consumption of 0.008 for each packet and a grade of generosity of 0.05. We are going to spot the figures one by 68
CHAPTER 5: SIMULATIONS one to compare the throughput from the external traffic and compare it with the added traffic behavior. In the figure 5-13 we can observe the added throughput from each node. We can observe, with the characteristics of the scenario commented before, all the nodes converge around 35% of the packets requested are sent. PACKETS SENT (Y) PACKETS REQUESTED (X) Figure 5-13 Throughput nodes, case 4. Number of packets=1.000; c=0.0008; ρi = 1; ε=0.05 In the next figure 5-14, not surprisingly, we notice that the nodes converge around the 32%. That is because the network is working with the same structure and a external traffic of 50 %. The packets have to jump one relay as the previous cases. 69
CHAPTER 5: SIMULATIONS PACKETS SENT OUT (Y) PACKETS REQUESTED OUT (X) Figure 5-14 External throughput nodes, case4. Number of packets=1.000; c=0.0008; ρi =1,; ε=0.05 The interesting thing in this simulation it’s how is the behavior of the packets sent out divided by the packets requested out the network. That is showed in the figure 5-15 below. The added traffic figure shows straight functions from every node. That is because the nodes are fully charged and the time of compensation for them are shorter since they start with the same energy constraint. At the beginning, they all accept the entire requests until they are short of energy. Then the rejections are mostly because of the energy restriction. Their throughputs are compensated, so the reason to reject a source for being more helpful than the others is minimum. These facts make the fall in the throughput ratio straighter. 70
CHAPTER 5: SIMULATIONS P.SENT / P.REQUESTED (Y) PACKETS REQUESTED (X) Figure 5-15 Throughput ratio nodes, case4. Number of packets=1.000; c=0.0008; ρi =1,; ε=0.05 On the contrary, the figure 5-16 shows that the packets sent out divided by the packets requested out are choppier than the added traffic ones. The reason is caused by the time of requesting. Now, the packets taken in the functions are requested in a random distribution, this makes the φ ratio change suddenly in view of the fact that the rejection criterion is decided in different circumstances for every packets. So the compensation zone is choppier than before, which the requested packets were took in account consecutively. 71
CHAPTER 5: SIMULATIONS EXTERNAL P.SENT / P.REQUESTED (Y) EXTERNAL PACKETS REQUESTED (X) Figure 5-16 External throughput ratio nodes, case 4. Number of packets=1.000; c=0.0008; ρi =1,; ε=0.05 In the figures 5-17 and 5-18 below, we can notice the behavior of the added throughput network. As we have revealed before, the final throughput is around 35% more or less like external throughput. The φ ratio throughput function is straight because the simulation starts with the nodes fully charged. This means that as long as the packets are being requested the rejection is for either the relay or energy constraint criterion. In contrast, the added external φ throughput ratio is so irregular at the beginning because we are considering a random distribution of sent packets added. That makes that taking the decision to reject, when nodes are in a different state than the previous decision, the ratio varies excessively generating those curls in the graph. The compensating phenomenon aims to create those alterations, too. This disturbance longs until the nodes stop of relaying traffic and then the ratio plunges. 72
CHAPTER 5: SIMULATIONS P.SENT (Y) PACKETS REQUESTED (X) P.SENT / P.REQUESTED (Y) Figure 5-17 Added throughput case 4. Number of packets=1.000; c=0.0008; ρi =1,; ε=0.05 PACKETS .SENT (Y) EXTERNAL P.SENT / P.REQUESTED (Y) PACKETS RE Q UESTED ( X ) Figure 5-18 External Added throughput 50%, case 4. Number of packets=1.000; c=0.0008; ρi =1,; ε=0.05 73
APPENDIX B: CD CONTENTS APPENDIX B: CD CONTENTS The CD contains a copy of the paper zipped in PDF format. Furthermore, there is the file with the matlab code used to simulate the results. 80
APPENDIX C: ALGORITHM MATLAB CODE APPENDIX C: ALGORITHM MATLAB CODE Function ‘main’ %Generating Time of request by nodes N= input ('How many packets per Node Do you want to send') N1=exprnd(1,1,N); N2=exprnd(1,1,N); N3=exprnd(1,1,N); N4=exprnd(1,1,N); Initiate_parameters; %time vector arrangement T1=sort (N1); T2=sort (N2); T3=sort (N3); T4=sort (N4); %Bit masks to define the external packets 50% mask1 = round(rand(1,N)); mask2 = round(rand(1,N)); mask3 = round(rand(1,N)); mask4 = round(rand(1,N)); %Time vector T=[T1,T2,T3,T4]; %Time vector arrenged Ts=sort(T); %finding the node source find_source phi=A./B; psi=C./D; figure%Added system THRP=Thrp1+Thrp2+Thrp3+Thrp4; subplot(2,1,1), plot(V_pak,THRP) title('Added packets sent') ylabel('packets sent') xlabel('Packets treated') PHI=phi1+phi2+phi3+phi4; subplot(2,1,2), line([V_pak,V_pak],[k,PHI/4]) title('Added network phi') ylabel('p.sent/p.requested') xlabel('packets requested') figure%THrpt 4 nodes subplot(2,2,1), plot(request1,Thrp1) axis ([0 1000 0 500]) title('Node1') ylabel('packets sent') xlabel('packets requested') subplot(2,2,2), plot(request2,Thrp2) axis ([0 1000 0 500]) title('Node2') ylabel('packets sent') xlabel('packets requested') subplot(2,2,3), plot(request3,Thrp3) axis ([0 1000 0 500]) 81
APPENDIX C: ALGORITHM MATLAB CODE title('Node3') ylabel('packets sent') xlabel('packets requested') subplot(2,2,4), plot(request4,Thrp4) axis ([0 1000 0 500]) title('Node4') ylabel('packets sent') xlabel('packets requested') figure%phi 4 nodes subplot(2,2,1), plot(request1,phi1) title('Node1') ylabel('p.sent/p.requested') xlabel('packets requested') subplot(2,2,2), plot(request2,phi2) title('Node2') ylabel('p.sent/p.requested') xlabel('packets requested') subplot(2,2,3), plot(request3,phi3) title('Node3') ylabel('p.sent/p.requested') xlabel('packets requested') subplot(2,2,4), plot(request4,phi4) title('Node4') ylabel('p.sent/p.requested') xlabel('packets requested') % figure%external added system OutT=OutThrp1+OutThrp2+OutThrp3+OutThrp4; PHI_ext=phi_ext1+phi_ext2+phi_ext3+phi_ext4; REQEXT=req_ext1+req_ext2+req_ext3+req_ext4 % subplot(2,1,1), plot(REQEXT,OutT) title('Added packets sent') ylabel('Out Data Throughtput') xlabel('time') subplot(2,1,2), line([REQEXT,REQEXT],[k,PHI_ext/4]) title('Added network phi') ylabel('external p.sent/p.requested') xlabel('packets requested') % figure%External Thgroughput subplot(2,2,1),plot(req_ext1,OutThrp1) axis([0 500 0 250]) title('Out Data Throughtput from Node1') ylabel('Packets sent to the satellite') xlabel('Out Packets Requested') subplot(2,2,2),plot(req_ext2,OutThrp2) axis([0 500 0 250]) title('Out Data Throughtput from Node2') ylabel('Packets sent to the satellite') xlabel('Out Packets Requested') subplot(2,2,3),plot(req_ext3,OutThrp3) axis([0 500 0 250]) title('Out Data Throughtput from Node3') ylabel('Packets sent to the satellite') xlabel('Out Packets Requested') subplot(2,2,4),plot(req_ext4,OutThrp4) axis([0 500 0 250]) 82
APPENDIX C: ALGORITHM MATLAB CODE title('Out Data Throughtput from Node4') ylabel('Packets sent to the satellite') xlabel('Out Packets Requested') % figure%External PHI subplot(2,2,1), plot(req_ext1,phi_ext1) title('Node1') ylabel('external p.sent/p.requested') xlabel('Out Packets Requested') subplot(2,2,2), plot(req_ext2,phi_ext2) title('Node2') ylabel('external p.sent/p.requested') xlabel('Out Packets Requested') subplot(2,2,3), plot(req_ext3,phi_ext3) title('Node3') ylabel('external p.sent/p.requested') xlabel('Out Packets Requested') subplot(2,2,4), plot(req_ext4,phi_ext4) title('Node4') ylabel('external p.sent/p.requested') xlabel('Out Packets Requested') Function ‘initiate_parameters’ %this function 'initiate_parameters' all the parameters needed A=[0 0 0 0];%number of relayed requested generated by the nodes B=[0 0 0 0];%number of relay requested accepted by the nodes phi=A./B C=[0 0 0 0];%number of relayed requested made to the nodes D=[0 0 0 0];%number of relay requested accepted to the nodes psi=C./D en1=input('Put the energy constraint per node1') en2=input('Put the energy constraint per node2') en3=input('Put the energy constraint per node3') en4=input('Put the energy constraint per node4') c=input('put the power concumption') p=[en1 en2 en3 en4] ;%energy constraint Nn=4 n=[Nn/2];%for parameter tau epsilon=input ('choose the level of generosity')%the level of generosity rej=[0 0 0 0]%the total rejects from each node Thrp=[0 0 0 0]%the throuput of each node request=[0 0 0 0]%number of nodes requeted until time j OutThrp=[0 0 0 0]%the external throughput to the satellite grom each node req_ext=[0 0 0 0]%requested relays for external satellite phi_ext=OutThrp./req_ext 83
APPENDIX C: ALGORITHM MATLAB CODE Function ‘find_source’ %find the source for i=1:N*4, tau=n*p; phi=A./B; psi=C./D; phi_ext=OutThrp./request; V_pak=[1:N*4];%the number of packets to set the plot k(i)=1/2.72; OutThrp1(i)=OutThrp(1); OutThrp2(i)=OutThrp(2); OutThrp3(i)=OutThrp(3); OutThrp4(i)=OutThrp(4); Thrp1(i)=Thrp(1); Thrp2(i)=Thrp(2); Thrp3(i)=Thrp(3); Thrp4(i)=Thrp(4); phi1(i)=phi(1);%phi vectors to set the plot phi2(i)=phi(2); phi3(i)=phi(3); phi4(i)=phi(4); phi_ext1(i)=phi_ext(1); phi_ext2(i)=phi_ext(2); phi_ext3(i)=phi_ext(3); phi_ext4(i)=phi_ext(4); request1(i)=request(1); request2(i)=request(2); request3(i)=request(3); request4(i)=request(4); req_ext1(i)=req_ext(1); req_ext2(i)=req_ext(2); req_ext3(i)=req_ext(3); req_ext4(i)=req_ext(4); for j=1:N, if Ts(i)==T1(j) source_1%the node one will be the source end if Ts(i)==T2(j) source_2 end if Ts(i)==T3(j) source_3 end if Ts(i)==T4(j) source_4 end end end if Ts(i)==T4(j) source_4 84
APPENDIX C: ALGORITHM MATLAB CODE end end end Function ‘source1’ %this function accepts or rejects a packet from node 1 %source_1-->treats the packet from node 1, choosing the way to node3, randomly %'way' will be 1 if it chooses N2 as a relay and 2 if is N4 as a realy way=random('unid',2,1,1); request(1)=request(1)+1; if way==1; D(2)=D(2)+1; B(1)=B(1)+1; if mask1(j)~=0 req_ext(1)=req_ext(1)+1; end if psi(2)>tau(2) | phi(2)<psi(2)-epsilon rej(2)=rej(2)+1; else A(1)=A(1)+1; C(2)=C(2)+1; p(1)=p(1)-c;%power consumption p(2)=p(2)-c; p(3)=p(3)-c; Thrp(1)=Thrp(1)+1;%increases the source throughput if mask1(j)~=0 OutThrp(1)=OutThrp(1)+1; end end end if way==2; D(4)=D(4)+1; B(1)=B(1)+1; if mask1(j)~=0 req_ext(1)=req_ext(1)+1; end if psi(4)>tau(4) | phi(4)<psi(4)-epsilon rej(4)=rej(4)+1; else A(1)=A(1)+1; C(4)=C(4)+1; p(1)=p(1)-c;%power consumption p(3)=p(3)-c; p(4)=p(4)-c; Thrp(1)=Thrp(1)+1%increases the source throughput if mask1(j)~=0 OutThrp(1)=OutThrp(1)+1; end end end 85
APPENDIX C: ALGORITHM MATLAB CODE Function ‘source2’ %Source_2-->this function accepts or rejects a packet from node 2 %source_2-->treats the packet from node 2, choosing the way to node4, randomly %'way' will be 1 if it chooses N1 as a relay and 2 if is N3 as a realy way=random('unid',2,1,1); request(2)=request(2)+1; if way==1; D(1)=D(1)+1; B(2)=B(2)+1; if mask1(j)~=0 req_ext(2)=req_ext(2)+1; end if psi(1)>tau(1) | phi(1)<psi(1)-epsilon rej(1)=rej(1)+1; else A(2)=A(2)+1; C(1)=C(1)+1; p(1)=p(1)-c;%power consumption p(2)=p(2)-c; p(4)=p(4)-c; Thrp(2)=Thrp(2)+1;%increases the source throughput if mask2(j)~=0 OutThrp(2)=OutThrp(2)+1; end end end if way==2; D(3)=D(3)+1; B(2)=B(2)+1; if mask1(j)~=0 req_ext(2)=req_ext(2)+1; end if psi(3)>tau(3) | phi(3)<psi(3)-epsilon rej(3)=rej(3)+1; else A(2)=A(2)+1; C(3)=C(3)+1; p(2)=p(2)-c;%power consumption p(3)=p(3)-c; p(4)=p(4)-c; Thrp(2)=Thrp(2)+1;%increases the source throughput if mask2(j)~=0 OutThrp(2)=OutThrp(2)+1; end end end Function ‘source3’ %Source_3-->this function accepts or rejects a packet from node 3 86
APPENDIX C: ALGORITHM MATLAB CODE %source_3-->treats the packet from node 3, choosing the way to node1, randomly %'way' will be 1 if it chooses N1 as a relay and 2 if is N3 as a realy way=random('unid',2,1,1); request(3)=request(3)+1; if way==1; D(2)=D(2)+1 ; B(3)=B(3)+1; if mask1(j)~=0 req_ext(3)=req_ext(3)+1; end if psi(2)>tau(2) | phi(2)<psi(2)-epsilon rej(2)=rej(2)+1; else A(3)=A(3)+1; C(2)=C(2)+1; p(3)=p(3)-c;%power consumption p(2)=p(2)-c; p(1)=p(1)-c; Thrp(3)=Thrp(3)+1;%increases the source throughput if mask3(j)~=0 OutThrp(3)=OutThrp(3)+1; end end end if way==2; D(4)=D(4)+1; B(3)=B(3)+1; if mask1(j)~=0 req_ext(3)=req_ext(3)+1; end if psi(4)>tau(4) | phi(4)<psi(4)-epsilon rej(4)=rej(4)+1; else A(3)=A(3)+1; C(4)=C(4)+1; p(3)=p(3)-c;%power consumption p(4)=p(4)-c; p(1)=p(1)-c; Thrp(3)=Thrp(3)+1;%increases the source throughput if mask3(j)~=0 OutThrp(3)=OutThrp(3)+1; end end end Function ‘source4’ %Source_4-->this function accepts or rejects a packet from node 2 %source_4-->treats the packet from node 4, choosing the way to node2, randomly %'way' will be 1 if it chooses N1 as a relay and 2 if is N3 as a realy way=random('unid',2,1,1); request(4)=request(4)+1; 87
APPENDIX C: ALGORITHM MATLAB CODE if way==1; D(1)=D(1)+1 ; B(4)=B(4)+1; if mask1(j)~=0 req_ext(4)=req_ext(4)+1; end if psi(1)>tau(1) | phi(1)<psi(1)-epsilon rej(1)=rej(1)+1; else A(4)=A(4)+1; C(1)=C(1)+1; p(1)=p(1)-c;%power consumption p(4)=p(4)-c; p(2)=p(2)-c; Thrp(4)=Thrp(4)+1;%increases the source throughput if mask4(j)~=0 OutThrp(4)=OutThrp(4)+1; end end end if way==2; D(3)=D(3)+1; B(4)=B(4)+1; if mask1(j)~=0 req_ext(4)=req_ext(4)+1; end if psi(3)>tau(3) | phi(3)<psi(3)-epsilon rej(3)=rej(3)+1; else A(4)=A(4)+1; C(3)=C(3)+1; p(3)=p(3)-c;%power consumption p(4)=p(4)-c; p(2)=p(2)-c; Thrp(4)=Thrp(4)+1;%increases the source throughput if mask4(j)~=0 OutThrp(4)=OutThrp(4)+1; end end end function ‘casezero’ C=[0 0.0001 0.0002 0.0003 0.0004 0.0005 0.0006 0.0007 0.0008 0.0009 0.001] Rmax=[1 1 3619/4000 2813/4000 2327/4000 1992/4000 1710/4000 1534/4000 1340/4000 1245/4000 1140/4000] %the values registered from the simulations figure plot(C,Rmax) title('Maximum Rate-V.S-Energy consumption') ylabel('Rmax') xlabel('energy consumption') 88
APPENDIX C: ALGORITHM MATLAB CODE function ‘caseone’ figure TH=[THRP1; THRP2; THRP3; THRP4; THRP5; THRP6; THRP7; THRP8; THRP9; THRP10]; PR=[V_pak; V_pak; V_pak; V_pak; V_pak; V_pak; V_pak; V_pak; V_pak; V_pak;]; line([PR]',[TH]') title('Energy Constraint Dependence') ylabel('Throughput') xlabel('Packets treated') figure ro=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1]; THP=[141 280 425 534 679 834 949 1129 1230 1356]; plot (ro, THP) title('Energy Constraint Dependence') ylabel('Throughput') xlabel('Energy Constraint') function ‘casetwo’ sp=[1474 1490 1539 1555 1700 1705 1705 1706 1900 1950 2024 2013 2108 2190 2365 2287 2402 2386 2462 2407 2490] eps=[0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05 0.055 0.06 0.065 0.07 0.075 0.08 0.085 0.09 0.095 0.1] figure plot(eps,sp) title('THROUGHPUT QUANTIFICATION -VS- GRADE OF GENEROSITY') ylabel('Slump Point (packets)') xlabel('Grade of Generosity') function ‘vzero’ function [mask]=vzero; %creates a binary array to create the external traffic z=0; for i=1:1000; if z<200; a=random('unid',2,1,1); if a==1; mask(i)=1; z=z+1; else a==2; mask(i)=0; end end end mask(i)=1; end 89